清理旧内核不起作用

清理旧内核不起作用

我是一个新的 Ubuntu 用户,所以请耐心等待。

这一切都始于我的/root分区已满。它显然太小了,我必须调整大小。我尝试使用 Synaptic 和终端中的各种命令删除内核,但没有成功。这是最新的输出:

$ dpkg --list | grep linux-image
ii  linux-image-3.16.0-30-generic                               3.16.0-30.40~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-36-generic                               3.16.0-36.48~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-37-generic                               3.16.0-37.51~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-38-generic                               3.16.0-38.52~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-3.16.0-40-generic                               3.16.0-40.54~14.04.1                                amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-30-generic                         3.16.0-30.40~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-36-generic                         3.16.0-36.48~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-37-generic                         3.16.0-37.51~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
ii  linux-image-extra-3.16.0-38-generic                         3.16.0-38.52~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
iF  linux-image-extra-3.16.0-40-generic                         3.16.0-40.54~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
rH  linux-image-extra-3.16.0-41-generic                         3.16.0-41.55~14.04.1                                amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP

$ sudo apt-get purge linux-image-extra-3.16.0.30-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'linux-image-extra-3.16.0-30-generic' for regex 'linux-image-extra-3.16.0.30-generic'
The following packages were automatically installed and are no longer required:
  account-plugin-windows-live cabextract kde-l10n-engb libllvm3.4 libupstart1
  linux-headers-generic-lts-utopic smplayer-translations
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-extra-3.16.0-30-generic* linux-image-extra-3.16.0-41-generic
  linux-signed-image-3.16.0-30-generic*
0 upgraded, 0 newly installed, 3 to remove and 44 not upgraded.
3 not fully installed or removed.
After this operation, 313 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 371721 files and directories currently installed.)
Removing linux-image-extra-3.16.0-41-generic (3.16.0-41.55~14.04.1) ...
depmod: FATAL: could not load /boot/System.map-3.16.0-41-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0-41-generic /boot/vmlinuz-3.16.0-41-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0-41-generic /boot/vmlinuz-3.16.0-41-generic
update-initramfs: Generating /boot/initrd.img-3.16.0-41-generic
grep: /boot/config-3.16.0-41-generic: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_n4g54n/lib/modules/3.16.0-41-generic/modules.order: No such file or directory
depmod: WARNING: could not open /tmp/mkinitramfs_n4g54n/lib/modules/3.16.0-41-generic/modules.builtin: No such file or directory

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.16.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-3.16.0-41-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.16.0-41-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

当前使用的内核是3.16.0.40。

非常感谢您的帮助!

df -h 的结果是:

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-root  454G   53G  378G  13% /
none                         4,0K     0  4,0K   0% /sys/fs/cgroup
udev                         1,9G  4,0K  1,9G   1% /dev
tmpfs                        385M  1,2M  384M   1% /run
none                         5,0M     0  5,0M   0% /run/lock
none                         1,9G  268K  1,9G   1% /run/shm
none                         100M   36K  100M   1% /run/user
/dev/sda2                    237M  231M     0 100% /boot
/dev/sda1                    511M  3,4M  508M   1% /boot/efi
/home/danie/.Private         454G   53G  378G  13% /home/danie

答案1

作为删除过程的一部分,apt-get 会尝试解压文件以找出应该删除的具体文件。但是由于设备上没有任何空间,apt-get 无法执行此操作,也无法释放更多空间。

我建议您将一些大文件从根文件系统移动到另一个文件系统(或 USB 记忆棒或任何其他东西),sudo apt-get autoremove --purge然后尝试将这些大文件移回。

相关内容