我刚刚将 Ubuntu 更新到 16.04 版本,当我启动时,grub 显示来自以前 Ubuntu 版本的内核。我该如何删除它们?(不仅在 grub 列表中,而且实际上释放磁盘中的空间)。
请注意,这不是重复的如何删除旧内核版本来清理启动菜单?当您更改 Ubuntu 版本时,那里的答案不起作用。dpkg
不是解决方案!
系统:Dell Studio 1557,[电子邮件保护]、4 GB RAM。传统启动。
当我这样做时,sudo update-grub
我得到:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found linux image: /boot/vmlinuz-3.13.0-86-generic
Found initrd image: /boot/initrd.img-3.13.0-86-generic
Found linux image: /boot/vmlinuz-3.13.0-85-generic
Found initrd image: /boot/initrd.img-3.13.0-85-generic
Found linux image: /boot/vmlinuz-3.13.0-83-generic
Found initrd image: /boot/initrd.img-3.13.0-83-generic
Found linux image: /boot/vmlinuz-3.13.0-79-generic
Found initrd image: /boot/initrd.img-3.13.0-79-generic
Found linux image: /boot/vmlinuz-3.13.0-77-generic
Found initrd image: /boot/initrd.img-3.13.0-77-generic
Found linux image: /boot/vmlinuz-3.13.0-76-generic
Found initrd image: /boot/initrd.img-3.13.0-76-generic
Found linux image: /boot/vmlinuz-3.13.0-74-generic
Found initrd image: /boot/initrd.img-3.13.0-74-generic
Found linux image: /boot/vmlinuz-3.13.0-73-generic
Found initrd image: /boot/initrd.img-3.13.0-73-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.11.0-24-generic
Found initrd image: /boot/initrd.img-3.11.0-24-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 7 (loader) on /dev/sda3
done
但当我这样做时,dpkg -l | grep linux-image
我只得到:
ii linux-image-4.4.0-21-generic 4.4.0-21.37 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-4.4.0-22-generic 4.4.0-22.39 amd64 Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-21-generic 4.4.0-21.37 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-extra-4.4.0-22-generic 4.4.0-22.39 amd64 Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii linux-image-generic 4.4.0.22.23 amd64 Generic Linux kernel image
并且我在其他线程中找到的所有解决此问题所需的单行代码都依赖于 dpkg,但它们不起作用。
boot的内容为:
abi-3.11.0-24-generic
abi-3.11.0-26-generic
abi-3.13.0-73-generic
abi-3.13.0-74-generic
abi-3.13.0-76-generic
abi-3.13.0-77-generic
abi-3.13.0-79-generic
abi-3.13.0-83-generic
abi-3.13.0-85-generic
abi-3.13.0-86-generic
abi-4.4.0-21-generic
abi-4.4.0-22-generic
config-3.11.0-24-generic
config-3.11.0-26-generic
config-3.13.0-73-generic
config-3.13.0-74-generic
config-3.13.0-76-generic
config-3.13.0-77-generic
config-3.13.0-79-generic
config-3.13.0-83-generic
config-3.13.0-85-generic
config-3.13.0-86-generic
config-4.4.0-21-generic
config-4.4.0-22-generic
grub
initrd.img-3.11.0-24-generic
initrd.img-3.11.0-26-generic
initrd.img-3.13.0-73-generic
initrd.img-3.13.0-74-generic
initrd.img-3.13.0-76-generic
initrd.img-3.13.0-77-generic
initrd.img-3.13.0-79-generic
initrd.img-3.13.0-83-generic
initrd.img-3.13.0-85-generic
initrd.img-3.13.0-86-generic
initrd.img-4.4.0-21-generic
initrd.img-4.4.0-22-generic
memtest86+.bin
memtest86+.elf
memtest86+_multiboot.bin
System.map-3.11.0-24-generic
System.map-3.11.0-26-generic
System.map-3.13.0-73-generic
System.map-3.13.0-74-generic
System.map-3.13.0-76-generic
System.map-3.13.0-77-generic
System.map-3.13.0-79-generic
System.map-3.13.0-83-generic
System.map-3.13.0-85-generic
System.map-3.13.0-86-generic
System.map-4.4.0-21-generic
System.map-4.4.0-22-generic
vmlinuz-3.11.0-24-generic
vmlinuz-3.11.0-26-generic
vmlinuz-3.13.0-73-generic
vmlinuz-3.13.0-74-generic
vmlinuz-3.13.0-76-generic
vmlinuz-3.13.0-77-generic
vmlinuz-3.13.0-79-generic
vmlinuz-3.13.0-83-generic
vmlinuz-3.13.0-85-generic
vmlinuz-3.13.0-86-generic
vmlinuz-4.4.0-21-generic
vmlinuz-4.4.0-22-generic
但是旧内核不会出现在 Synaptic 中,所以请不要建议这样做,并且使用旧内核启动不会使它们出现在 Synaptic 中或可供使用dpkg
。
sudo apt-get autoremove
也不执行任何操作:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
同样适用于sudo apt-get autoremove linux-headers-3.11.0-24-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-headers-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-headers-3.11.0-24-generic'
sudo apt-get remove linux-image-3.11.0-24-generic
也不执行任何操作:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-image-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-image-3.11.0-24-generic'
sudo apt-get purge linux-image-3.11.0-24-generic
也不执行任何操作:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-3.11.0-24-generic
E: Couldn't find any package by glob 'linux-image-3.11.0-24-generic'
E: Couldn't find any package by regex 'linux-image-3.11.0-24-generic'
请不要建议我使用“ubuntu-tweak”,该链接会将您带到一个奇怪的中文网站。
sudo apt-get autoclean
并且sudo apt-get clean
什么也不做。
正如您所见,我并不是专家,我尝试了所有能找到的方法,我应该立即删除这些文件吗?我还应该删除其他内容吗?旧内核不会显示在/lib/firmware/
或中/lib/modules/
。
答案1
由于没有内核被识别为已安装,apt/dpkg
您可以安全地删除它们,如@oldfred 所述。如果您还没有这样做,请发出:
mount /boot && cd /boot
rm -v abi-* && rm -v config-* && rm -v initrd* && rm -v System* && rm -v vmlinuz*
sudo apt-get install linux-image
sudo update-grub
- 重启