无法升级或安装/删除任何软件包

无法升级或安装/删除任何软件包

我正在使用 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).

我尝试安装在 Google 上找到的每个命令,但是可惜 :(

请指导我如何解决此错误

答案1

您无意中尝试在 Ubuntu 14.04 上安装包含与您安装的版本不兼容的库的软件包。您必须删除有问题的软件包并安装适合您的 Ubuntu 版本的软件包。

您的错误表明您的clickpython3-click-package至少需要0.4.45.1+16.10.20160916-0~619~ubuntu14.04.1python3-click-package.Ubuntu 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

当允许系统自动执行更新和升级时,这些手动命令在正常操作期间是无缝的。在执行手动维护时,虽然有些命令看起来非常多余,但它们是必要的。

相关内容