我正在使用 Ubuntu 12.04。我无法安装或升级我拥有的任何软件包:
apt-get install traceroute
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-generic : Depends: linux-headers-generic (= 3.2.0.76.90) but 3.2.0.77.91 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
如果我尝试-f
,我会被告知/boot
已满:
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.2.0-74 linux-image-3.2.0-74-generic linux-headers-3.2.0-74-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-generic linux-headers-generic linux-image-3.2.0-121-generic linux-image-generic
Suggested packages:
fdutils linux-doc-3.2.0 linux-source-3.2.0 linux-tools
The following NEW packages will be installed:
linux-image-3.2.0-121-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic
3 upgraded, 1 newly installed, 0 to remove and 203 not upgraded.
10 not fully installed or removed.
Need to get 0 B/38.8 MB of archives.
After this operation, 151 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
........
dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-121-generic_3.2.0-121.164_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.2.0-121-generic': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-121-generic /boot/vmlinuz-3.2.0-121-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-121-generic /boot/vmlinuz-3.2.0-121-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.2.0-121-generic_3.2.0-121.164_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我的/boot
尺寸:
/dev/sda1 92M 85M 1.9M 98% /boot
ls -ll
total 76775
-rw------- 1 root root 2884358 Apr 11 2012 System.map-3.2.0-23-generic
-rw------- 1 root root 2897962 Dec 9 2014 System.map-3.2.0-74-generic
-rw------- 1 root root 2898003 Dec 16 2014 System.map-3.2.0-75-generic
-rw------- 1 root root 2898466 Jan 13 2015 System.map-3.2.0-76-generic
-rw-r--r-- 1 root root 791023 Apr 11 2012 abi-3.2.0-23-generic
-rw-r--r-- 1 root root 796535 Dec 9 2014 abi-3.2.0-74-generic
-rw-r--r-- 1 root root 796535 Dec 16 2014 abi-3.2.0-75-generic
-rw-r--r-- 1 root root 796597 Jan 13 2015 abi-3.2.0-76-generic
-rw-r--r-- 1 root root 140279 Apr 11 2012 config-3.2.0-23-generic
-rw-r--r-- 1 root root 140790 Dec 9 2014 config-3.2.0-74-generic
-rw-r--r-- 1 root root 140790 Dec 16 2014 config-3.2.0-75-generic
-rw-r--r-- 1 root root 140790 Jan 13 2015 config-3.2.0-76-generic
drwxr-xr-x 3 root root 7168 Feb 1 2015 grub
-rw-r--r-- 1 root root 14177627 Apr 9 2014 initrd.img-3.2.0-23-generic
-rw-r--r-- 1 root root 14232258 Dec 11 2014 initrd.img-3.2.0-74-generic
-rw-r--r-- 1 root root 14233553 Feb 1 2015 initrd.img-3.2.0-75-generic
drwx------ 2 root root 12288 Nov 21 2013 lost+found
-rw-r--r-- 1 root root 176764 Nov 27 2011 memtest86+.bin
-rw-r--r-- 1 root root 178944 Nov 27 2011 memtest86+_multiboot.bin
-rw------- 1 root root 4965840 Apr 11 2012 vmlinuz-3.2.0-23-generic
-rw------- 1 root root 4990768 Dec 9 2014 vmlinuz-3.2.0-74-generic
-rw------- 1 root root 4991088 Dec 16 2014 vmlinuz-3.2.0-75-generic
-rw------- 1 root root 4991856 Jan 13 2015 vmlinuz-3.2.0-76-generic
我尝试过解决方案这里和其他清除旧内核的解决方案,但是我收到以下错误:
$ uname -r
3.2.0-75-generic
$dpkg --list 'linux-image*' | grep ^ii
ii linux-image-3.2.0-23-generic 3.2.0-23.36 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-74-generic 3.2.0-74.109 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-75-generic 3.2.0-75.110 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
$ apt-get remove linux-image-3.2.0-74-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-generic : Depends: linux-headers-generic (= 3.2.0.76.90) but 3.2.0.77.91 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
请问有什么帮助吗?
编辑:
我尝试过解决方案这里并手动删除了旧内核,但现在我遇到了不同的依赖问题:
apt-get install -f
......
Generating grub.cfg ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.2.0-121-generic
Found initrd image: /boot/initrd.img-3.2.0-121-generic
Found linux image: /boot/vmlinuz-3.2.0-76-generic
Found initrd image: /boot/initrd.img-3.2.0-76-generic
Found linux image: /boot/vmlinuz-3.2.0-75-generic
Found initrd image: /boot/initrd.img-3.2.0-75-generic
Found memtest86+ image: /memtest86+.bin
done
Setting up linux-image-generic (3.2.0.121.136) ...
Setting up linux-headers-generic (3.2.0.121.136) ...
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 3.2.0.76.90); however:
Version of linux-image-generic on system is 3.2.0.121.136.
linux-generic depends on linux-headers-generic (= 3.2.0.76.90); however:
Version of linux-headers-generic on system is 3.2.0.121.136.
dpkg: error processing linux-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
当前内核仍为“3.2.0-75-generic”
答案1
我用过这个问题由于内核升级不当导致缺少依赖项而无法安装任何软件包,而且我的系统/boot
几乎已满,所以我不得不手动删除旧的内核版本并保留最后一个:
rm vmlinuz-3.2.0-xx-generic abi-3.2.0-xx-generic config-3.2.0-xx-generic initrd.img-3.2.0-xx-generic System.map-3.2.0-xx-generic
手动删除文件不是最佳实践解决方案,但我无法使用 APT 或dpkg
。
然后我运行apt-get install -f
修复缺少的依赖项并完全安装新内核,但是我收到了错误:
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 3.2.0.76.90); however:
Version of linux-image-generic on system is 3.2.0.121.136.
linux-generic depends on linux-headers-generic (= 3.2.0.76.90); however:
Version of linux-headers-generic on system is 3.2.0.121.136.
dpkg: error processing linux-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后我就换了这个问题有同样的问题并尝试重新安装内核:
apt-get install --reinstall linux-generic=3.2.0.121.136 -f
但我也遇到了同样的问题,
所以我尝试使用dpkg
:
# ls /var/cache/apt/archives/linux-generic*
/var/cache/apt/archives/linux-generic_3.2.0.121.136_amd64.deb
# dpkg --install /var/cache/apt/archives/linux-generic_3.2.0.121.136_amd64.deb
(Reading database ... 860860 files and directories currently installed.)
Preparing to replace linux-generic 3.2.0.121.136 (using .../linux-generic_3.2.0.121.136_amd64.deb) ...
Unpacking replacement linux-generic ...
Setting up linux-generic (3.2.0.121.136) ...
# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
一切正常,
感谢每一条评论,它们让我将所有这些帖子结合起来解决了我的问题@Pilot6、@muru 和@user535733