如何删除 12.x 机器中不需要的内核
sudo update-grub
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.13.0-96-generic
Found initrd image: /boot/initrd.img-3.13.0-96-generic
Found linux image: /boot/vmlinuz-3.13.0-93-generic
Found initrd image: /boot/initrd.img-3.13.0-93-generic
Found linux image: /boot/vmlinuz-3.13.0-35-generic
Found initrd image: /boot/initrd.img-3.13.0-35-generic
Found linux image: /boot/vmlinuz-3.11.0-26-generic
Found initrd image: /boot/initrd.img-3.11.0-26-generic
Found linux image: /boot/vmlinuz-3.8.0-44-generic
Found initrd image: /boot/initrd.img-3.8.0-44-generic
Found linux image: /boot/vmlinuz-3.5.0-61-generic
Found initrd image: /boot/initrd.img-3.5.0-61-generic
Found linux image: /boot/vmlinuz-3.5.0-18-generic
Found initrd image: /boot/initrd.img-3.5.0-18-generic
Found linux image: /boot/vmlinuz-3.2.0-68-generic
Found initrd image: /boot/initrd.img-3.2.0-68-generic
Found linux image: /boot/vmlinuz-3.13.0-96-generic
Found initrd image: /boot/initrd.img-3.13.0-96-generic
Found linux image: /boot/vmlinuz-3.13.0-93-generic
Found initrd image: /boot/initrd.img-3.13.0-93-generic
Found linux image: /boot/vmlinuz-3.13.0-35-generic
Found initrd image: /boot/initrd.img-3.13.0-35-generic
Found linux image: /boot/vmlinuz-3.11.0-26-generic
Found initrd image: /boot/initrd.img-3.11.0-26-generic
Found linux image: /boot/vmlinuz-3.8.0-44-generic
Found initrd image: /boot/initrd.img-3.8.0-44-generic
Found linux image: /boot/vmlinuz-3.5.0-61-generic
Found initrd image: /boot/initrd.img-3.5.0-61-generic
Found linux image: /boot/vmlinuz-3.5.0-18-generic
Found initrd image: /boot/initrd.img-3.5.0-18-generic
Found linux image: /boot/vmlinuz-3.2.0-68-generic
Found initrd image: /boot/initrd.img-3.2.0-68-generic
Found memtest86+ image: /boot/memtest86+.bin
done
答案1
维基百科上有关于此问题的文档,请参见: https://help.ubuntu.com/community/RemoveOldKernels
如果“apt-get autoremove”没有删除它们,那么最好的选择可能是从其 PPA 安装 byobu 包,如该页面所述,以获取“purge-old-kernels”命令。
另请注意,Ubuntu 12.04 (Precise) 将于下个月 4 月停止支持,现已停用。请考虑升级到 14.04 (trusty) 或最好是 16.04 (xenial)。
答案2
要删除旧内核,首先您可能需要使用,sudo apt-get autoremove
因为此命令是工具提供的默认方法,apt
用于删除那些为满足其他软件包的依赖关系而自动安装但现在不再需要的软件包。
如果你想自己做,那就做吧。然而,有一件重要的事情要注意,切勿删除当前使用的内核!。这样做了,你就一定成功了。
(要检查当前内核映像,请uname -r
在终端上运行)
为了更安全的替代方案,请考虑尝试一个名为的命令,purge-old-kernels
该命令可用于清除多余的内核。默认情况下,它将保留 2 个最新内核和当前内核。该脚本在 Byobu 包中维护,因此请安装它们:
sudo apt-get install byobu
后面跟着purge-old-kernels
命令:
sudo purge-old-kernels