無法升級或安裝/移除任何軟體包

無法升級或安裝/移除任何軟體包

我正在使用 ubuntu 14.04 我不知道不知何故我在螢幕上看到了紅色符號,如下所示:

影像

當我嘗試使用sudo apt-get upgrade它進行升級時,它會拋出錯誤:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 click : Depends: python3-click-package (= 0.4.45.1+16.10.20160916-0~619~ubuntu14.04.1)
E: Unmet dependencies. Try using -f.

當我輸入時,sudo apt-get -f install它會拋出另一個錯誤:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  at bzr bzr-builddeb click-dev click-doc dctrl-tools debian-archive-keyring
  debootstrap devscripts distro-info distro-info-data dput ebtables fcitx-libs
  fcitx-libs-gclient freetds-common gdb-multiarch libaio1
  libboost-filesystem1.54.0 libboost-program-options1.54.0
  libboost-regex1.54.0 libboost-thread1.54.0 libcommon-sense-perl
  libdistro-info-perl libdrm-intel1:i386 libdrm-nouveau2:i386
  libdrm-radeon1:i386 libelf1:i386 libexpat1:i386 libexporter-lite-perl
  libffi6:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libglapi-mesa:i386
  libio-stringy-perl libjs-sphinxdoc libjson-perl libjson-xs-perl
  libllvm3.4:i386 liblxc1 libodbc1 libparse-debcontrol-perl libpciaccess0:i386
  libpq5 librados2 librbd1 libstdc++6:i386 libsybdb5 libtie-ixhash-perl
  libtxc-dxtn-s2tc0:i386 libx11-xcb1:i386 libxcb-dri2-0:i386
  libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386
  libxcb-xinerama0 libxdamage1:i386 libxdelta2 libxfixes3:i386
  libxshmfence1:i386 libxxf86vm1:i386 lxc-common lxcfs lxd lxd-client pbuilder
  pbzip2 pristine-tar pybootchartgui python-bzrlib python-configobj
  python-debianbts python-distro-info python-dns python-fpconst python-gpgme
  python-keyring python-launchpadlib python-lazr.restfulclient python-lazr.uri
  python-lzma python-oauth python-reportbug python-secretstorage
  python-simplejson python-soappy python-wadllib qemu-utils quilt reportbug
  schroot schroot-common ubuntu-dev-tools ubuntu-emulator
  ubuntu-emulator-runtime:i386 ubuntu-sdk-tools uidmap xdelta
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  click
Suggested packages:
  ubuntu-app-launch-tools upstart-app-launch-tools
Recommended packages:
  click-apparmor
The following packages will be upgraded:
  click
1 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
13 not fully installed or removed.
Need to get 0 B/14.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 297452 files and directories currently installed.)
Preparing to unpack .../click_0.4.46+17.10.20170607.3-0~622~ubuntu14.04.1_amd64.deb ...
Failed to issue method call: Unit click-system-hooks.service not loaded.
dpkg: warning: subprocess old pre-removal script returned error exit status 5
dpkg: trying script from the new package instead ...
Failed to issue method call: Unit click-system-hooks.service not loaded.
dpkg: error processing archive /var/cache/apt/archives/click_0.4.46+17.10.20170607.3-0~622~ubuntu14.04.1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 5
Failed to issue method call: Unit click-system-hooks.service failed to load: No such file or directory. See system logs and 'systemctl status click-system-hooks.service' for details.
Errors were encountered while processing:
 /var/cache/apt/archives/click_0.4.46+17.10.20170607.3-0~622~ubuntu14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

連我都安裝不了python3-click-package

$ sudo apt-get  install python3-click-package
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-click-package is already the newest version.
python3-click-package set to manually installed.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 click : Depends: python3-click-package (= 0.4.45.1+16.10.20160916-0~619~ubuntu14.04.1)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我嘗試安裝在谷歌上找到的每個命令,但是唉:(

請指導我如何解決這個錯誤

答案1

您無意中嘗試在 Ubuntu 14.04 上安裝包含與您安裝的版本不相容的程式庫的軟體包。您必須刪除有問題的並安裝適合您的 Ubuntu 版本的軟體包。

您的錯誤表明您的click包裹python3-click-package至少需要0.4.45.1+16.10.20160916-0~619~ubuntu14.04.1python3-click-packageUbuntu 16.04的版本是0.4.43+16.04.20170613-0ubuntu1。這低於0.4.45您失敗的click安裝需求。

順便說一下python3-click-package版本0.4.45.1+16.10.20160916-0~619~ubuntu14.04.1是 Ubuntu 17.04 儲存庫的一部分。

您可以透過以下步驟修復庫不符的問題:

執行以下步驟來解決您的問題。在此過程中您會收到警告和錯誤。您將不得不多次循環執行這些步驟。每個循環將執行一些後續清理並提供有關如何繼續的資訊。

開始:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

如果您看到autoremove指令執行:

$ sudo apt-get autoremove

現在檢查是否需要重新啟動。運行這個:

$ [[ -f /var/run/reboot-required ]] && echo "Reboot Now"

如果需要重新啟動,請先重新啟動,然後再繼續。

現在修復有問題的應用程式:

$ sudo apt remove click --purge
$ sudo apt remove python3-click-package --purge
$ sudo apt autoremove
$ sudo apt install click
$ sudo apt remove python3-click-package
$ sudo apt autoremove

當允許系統自動執行更新和升級時,這些手動命令在正常操作期間是無縫的。在進行手動維護時,有些則顯得非常多餘。它們是必要的。

相關內容