由于安装了太多内核,我的空间不够了/boot
。因此我尝试删除旧内核版本,但出现错误:
$ sudo apt-get purge linux-headers-3.13.0-86
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-3.13.0-86* linux-headers-3.13.0-86-generic*
0 upgraded, 0 newly installed, 2 to remove and 10 not upgraded.
2 not fully installed or removed.
After this operation, 76.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 435504 files and directories currently installed.)
Removing linux-headers-3.13.0-86-generic (3.13.0-86.131) ...
dpkg: warning: while removing linux-headers-3.13.0-86-generic, directory '/lib/modules/3.13.0-86-generic' not empty so not removed
Removing linux-headers-3.13.0-86 (3.13.0-86.131) ...
Setting up initramfs-tools (0.103ubuntu4.3) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-extra-4.2.0-41-generic (4.2.0-41.48~14.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic
Error! Module version v4.0.2_9000.20130911 for 8192cu.ko
is not newer than what is already found in kernel 4.2.0-41-generic (v4.0.2_9000.20130911).
You may override by specifying --force.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.2.0-41-generic /boot/vmlinuz-4.2.0-41-generic
update-initramfs: Generating /boot/initrd.img-4.2.0-41-generic
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.2.0-41-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.2.0-41-generic (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for initramfs-tools (0.103ubuntu4.3) ...
update-initramfs: Generating /boot/initrd.img-4.2.0-42-generic
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.2.0-42-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.2.0-41-generic
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
这是什么问题?
更新:有些奇怪。按照说明这里我做到了kernelver=$(uname -r | sed -r 's/-[a-z]+//'); dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver
,并且得到了
linux-headers-3.13.0-87
linux-headers-3.13.0-87-generic
linux-headers-3.13.0-91
linux-headers-3.13.0-91-generic
linux-headers-3.13.0-92
linux-headers-3.13.0-92-generic
linux-headers-4.2.0-27
linux-headers-4.2.0-27-generic
linux-headers-4.2.0-34
linux-headers-4.2.0-34-generic
linux-headers-4.2.0-36
linux-headers-4.2.0-36-generic
linux-headers-4.2.0-41
linux-headers-4.2.0-41-generic
linux-headers-4.2.0-42
linux-headers-4.2.0-42-generic
linux-image-4.2.0-36-generic
linux-image-4.2.0-41-generic
linux-image-4.2.0-42-generic
但ls /boot
显示
abi-4.2.0-35-generic lost+found
abi-4.2.0-36-generic memtest86+.bin
abi-4.2.0-41-generic memtest86+.elf
abi-4.2.0-42-generic memtest86+_multiboot.bin
config-4.2.0-35-generic System.map-4.2.0-35-generic
config-4.2.0-36-generic System.map-4.2.0-36-generic
config-4.2.0-41-generic System.map-4.2.0-41-generic
config-4.2.0-42-generic System.map-4.2.0-42-generic
efi vmlinuz-4.2.0-35-generic
grub vmlinuz-4.2.0-35-generic.efi.signed
initrd.img-4.2.0-35-generic vmlinuz-4.2.0-36-generic
initrd.img-4.2.0-35-generic.old-dkms vmlinuz-4.2.0-36-generic.efi.signed
initrd.img-4.2.0-36-generic vmlinuz-4.2.0-41-generic
initrd.img-4.2.0-41-generic vmlinuz-4.2.0-41-generic.efi.signed
initrd.img-4.2.0-41-generic.old-dkms vmlinuz-4.2.0-42-generic
initrd.img-4.2.0-42-generic vmlinuz-4.2.0-42-generic.efi.signed
initrd.img-4.2.0-42-generic.old-dkms
这就是为什么我尝试删除 linux-headers-3.13.0-87 但似乎它不存在。我做错了什么?
答案1
软件包linux-headers-3.13.0-86
和linux-headers-3.13.0-86-generic
已被删除。但它们都不包含任何文件,/boot/
因此删除它们在这里没有帮助。
删除这两个软件包之后,apt 尝试继续进行待安装的软件包linux-image-extra-4.2.0-41-generic
,但initramfs-tools
由于 上仍然没有剩余空间,因此失败了/boot/
。
您需要删除一些旧的linux-image-*
软件包而不是linux-headers-*
。