我似乎在更新软件时遇到了麻烦。我只会展示我的输入和输出,这样您就可以看到我遇到的问题。这是 Ubuntu 17.04,64 位,Intel i7 处理器。任何帮助都将不胜感激。
~$ sudo apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu zesty InRelease
(...)
Fetched 508 kB in 1s (479 kB/s)
Reading package lists... Done
~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-image-extra-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic but it is not installed
linux-image-generic : Depends: linux-image-4.10.0-28-generic but it is not installed
linux-signed-image-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic (= 4.10.0-28.32) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
好的。
~$ sudo apt --fix-broken 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:
linux-headers-4.10.0-21 linux-headers-4.10.0-21-generic linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-image-4.10.0-21-generic linux-image-4.10.0-28-generic
linux-image-extra-4.10.0-21-generic linux-image-extra-4.10.0-28-generic linux-signed-image-4.10.0-21-generic linux-signed-image-4.10.0-28-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
linux-generic linux-headers-4.10.0-29 linux-headers-4.10.0-29-generic linux-headers-generic linux-image-4.10.0-28-generic linux-image-4.10.0-29-generic linux-image-extra-4.10.0-29-generic
linux-image-generic linux-signed-generic linux-signed-image-4.10.0-29-generic linux-signed-image-generic
Suggested packages:
fdutils linux-doc-4.10.0 | linux-source-4.10.0 linux-tools
The following NEW packages will be installed:
linux-headers-4.10.0-29 linux-headers-4.10.0-29-generic linux-image-4.10.0-28-generic linux-image-4.10.0-29-generic linux-image-extra-4.10.0-29-generic linux-signed-image-4.10.0-29-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic linux-signed-generic linux-signed-image-generic
5 upgraded, 6 newly installed, 0 to remove and 75 not upgraded.
7 not fully installed or removed.
Need to get 0 B/82.7 MB of archives.
After this operation, 378 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package util-linux (--configure):
package util-linux is not ready for configuration
cannot configure (current status 'half-installed')
Errors were encountered while processing:
util-linux
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后我尝试重新安装 util-linux 包。
~$ sudo apt-get install --reinstall util-linux
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-image-extra-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-4.10.0-28-generic but it is not going to be installed
linux-signed-image-4.10.0-28-generic : Depends: linux-image-4.10.0-28-generic (= 4.10.0-28.32) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
~$ sudo apt-get install --reinstall linux-image-4.10.0-28-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.10.0-21 linux-headers-4.10.0-21-generic linux-image-4.10.0-21-generic linux-image-extra-4.10.0-21-generic linux-signed-image-4.10.0-21-generic
Use 'sudo apt autoremove' to remove them.
Suggested packages:
fdutils linux-doc-4.10.0 | linux-source-4.10.0 linux-tools
The following NEW packages will be installed:
linux-image-4.10.0-28-generic
0 upgraded, 1 newly installed, 0 to remove and 80 not upgraded.
7 not fully installed or removed.
Need to get 0 B/21.2 MB of archives.
After this operation, 70.4 MB of additional disk space will be used.
dpkg: error processing package util-linux (--configure):
package util-linux is not ready for configuration
cannot configure (current status 'half-installed')
Errors were encountered while processing:
util-linux
E: Sub-process /usr/bin/dpkg returned an error code (1)
所以现在我很困惑,因为我不确定依赖关系会如何发展。
最后,我将包含 dpgk --configure -a 的结果。
~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of linux-image-extra-4.10.0-28-generic:
linux-image-extra-4.10.0-28-generic depends on linux-image-4.10.0-28-generic; however:
Package linux-image-4.10.0-28-generic is not installed.
dpkg: error processing package linux-image-extra-4.10.0-28-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-generic:
linux-signed-image-generic depends on linux-image-extra-4.10.0-28-generic; however:
Package linux-image-extra-4.10.0-28-generic is not configured yet.
dpkg: error processing package linux-signed-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-4.10.0-28-generic:
linux-signed-image-4.10.0-28-generic depends on linux-image-4.10.0-28-generic (= 4.10.0-28.32); however:
Package linux-image-4.10.0-28-generic is not installed.
dpkg: error processing package linux-signed-image-4.10.0-28-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent processing triggers for systemd:
systemd depends on util-linux (>= 2.27.1); however:
Package util-linux is not installed.
dpkg: error processing package systemd (--configure):
dependency problems - leaving triggers unprocessed
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-4.10.0-28-generic; however:
Package linux-image-4.10.0-28-generic is not installed.
linux-image-generic depends on linux-image-extra-4.10.0-28-generic; however:
Package linux-image-extra-4.10.0-28-generic is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic:
linux-signed-generic depends on linux-signed-image-generic (= 4.10.0.28.29); however:
Package linux-signed-image-generic is not configured yet.
dpkg: error processing package linux-signed-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 4.10.0.28.29); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-extra-4.10.0-28-generic
linux-signed-image-generic
linux-signed-image-4.10.0-28-generic
systemd
linux-image-generic
linux-signed-generic
linux-generic
我不想强制删除 util-linux,因为它似乎是该软件的一个核心组件。Ubuntu 不乐意我尝试删除它。
答案1
我通过访问 Ubuntu 软件包网站并找到适用于我的发行版的 util-linux 软件包解决了这个问题。我下载了它,然后使用以下命令:
~$ sudo dpkg -i --force-overwrite /home/me/Downloads/util-linux_2.29-1ubuntu2_amd64.deb
这将重新安装 util-linux,之后我就能修复损坏的依赖关系。