我有一个 12.04 版 ubuntu 系统,无法添加任何软件包。我们认为发生的事情是分区已满 100%,升级部分完成,现在软件包管理处于不良状态。
uname 的输出:
$ uname -a
Linux right 3.13.0-93-generic #140~precise1-Ubuntu SMP Tue Jul 19 19:55:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
当我添加包时,出现依赖性错误:
$ sudo apt-get install netperf
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:
linux-headers-generic-lts-trusty : Depends: linux-headers-3.13.0-93-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
安装依赖项失败:
$ sudo apt-get install linux-headers-3.13.0-93-generic
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:
linux-headers-3.13.0-93-generic : Depends: linux-headers-3.13.0-93 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
尝试安装 linux-headers-3.13.0-93 依赖项也失败:
$ sudo apt-get install linux-headers-3.13.0-93
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:
linux-headers-generic-lts-trusty : Depends: linux-headers-3.13.0-93-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
运行“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:
linux-headers-3.13.0-43 linux-tools-3.2.0-102 linux-headers-3.13.0-43-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-headers-generic-lts-trusty
The following packages will be upgraded:
linux-headers-generic-lts-trusty
1 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
2 not fully installed or removed.
Need to get 0 B/2,364 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: dependency problems prevent configuration of linux-headers-generic-lts-trusty:
linux-headers-generic-lts-trusty depends on linux-headers-3.13.0-93-generic; however:
Package linux-headers-3.13.0-93-generic is not installed.
dpkg: error processing linux-headers-generic-lts-trusty (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-trusty:
linux-generic-lts-trusty depends on linux-headers-generic-lts-trusty; however:
Package linux-headers-generic-lts-trusty is not configured yet.
dpkg: error processing linux-generic-lts-trusty (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-headers-generic-lts-trusty
linux-generic-lts-trusty
E: Sub-process /usr/bin/dpkg returned an error code (1)
命令:
sudo apt-get clean
sudo apt-get autoclean
...对问题没有影响。
尝试“dist-upgrade”也失败:
$ sudo apt-get -u dist-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:
linux-headers-generic-lts-trusty : Depends: linux-headers-3.13.0-93-generic but it is not installed
E: Unmet dependencies. Try using -f.
有人知道如何让事情顺利进行吗?
谢谢,斯图尔特
答案1
我可以通过下载软件包然后使用 dpkg 安装来解决这个问题。
sudo apt-get download linux-headers-3.13.0-93-generic
sudo apt-get download linux-headers-3.13.0-93
然后:
sudo dpkg -i linux-headers-3.13.0-93_3.13.0-93.140~precise1_all.deb
sudo dpkg -i linux-headers-3.13.0-93-generic_3.13.0-93.140~precise1_amd64.deb
此后,一切顺利。