he upgrade needs a total of 92.1 M free space on disk '/boot'. Please free at least an additional 27

时间:2022-10-24 17:52:07

当我们在ubuntu运行的时候,我们会遇到/boot目录空间不足的情况,这个时候,我们需要对内核进行一下清理,错误信息为:

he upgrade needs a total of 92.1 M free space on disk '/boot'. Please free at least an additional 27 MB....

这时,我们可以运行下面的命令:

cd /boot/
dpkg -l | grep linux-image
uname -a  #查看你当前的内核版本
sudo apt-get purge --remove linux-image-4.4.0-34-generic #换成你的一个不用的内核
就行了.

我的输出信息为:

eric@eric-Satellite-C850:~$ ls -s /boot/
total 99010
 1213 abi-4.4.0-34-generic           179 memtest86+.bin
 1218 abi-4.4.0-87-generic           181 memtest86+.elf
  186 config-4.4.0-34-generic        181 memtest86+_multiboot.bin
  186 config-4.4.0-87-generic       3777 System.map-4.4.0-34-generic
    1 grub                          3794 System.map-4.4.0-87-generic
36909 initrd.img-4.4.0-34-generic   6882 vmlinuz-4.4.0-34-generic
37361 initrd.img-4.4.0-87-generic   6930 vmlinuz-4.4.0-87-generic
   12 lost+found
eric@eric-Satellite-C850:~$ uname -a
Linux eric-Satellite-C850 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
eric@eric-Satellite-C850:~$ cd /boot/
eric@eric-Satellite-C850:/boot$ ls
abi-4.4.0-34-generic         memtest86+.bin
abi-4.4.0-87-generic         memtest86+.elf
config-4.4.0-34-generic      memtest86+_multiboot.bin
config-4.4.0-87-generic      System.map-4.4.0-34-generic
grub                         System.map-4.4.0-87-generic
initrd.img-4.4.0-34-generic  vmlinuz-4.4.0-34-generic
initrd.img-4.4.0-87-generic  vmlinuz-4.4.0-87-generic
lost+found
eric@eric-Satellite-C850:/boot$ dpkg -l | grep linux-image
ii  linux-image-4.4.0-34-generic                          4.4.0-34.53                                    amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-87-generic                          4.4.0-87.110                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-34-generic                    4.4.0-34.53                                    amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-87-generic                    4.4.0-87.110                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                                   4.4.0.87.93                                    amd64        Generic Linux kernel image
eric@eric-Satellite-C850:/boot$ uname -a
Linux eric-Satellite-C850 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
eric@eric-Satellite-C850:/boot$ sudo apt-get purge --remove linux-image-4.4.0-34-generic 
[sudo] password for eric: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.4.0-34-generic* linux-image-extra-4.4.0-34-generic*
0 upgraded, 0 newly installed, 2 to remove and 306 not upgraded.
After this operation, 218 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 293915 files and directories currently installed.)
Removing linux-image-extra-4.4.0-34-generic (4.4.0-34.53) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found Windows 10 (loader) on /dev/sda1
Found Windows 10 (loader) on /dev/sdb1
Found Ubuntu 14.04.1 LTS (14.04) on /dev/sdb7
done
Purging configuration files for linux-image-extra-4.4.0-34-generic (4.4.0-34.53) ...
Removing linux-image-4.4.0-34-generic (4.4.0-34.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-34-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-87-generic
Found initrd image: /boot/initrd.img-4.4.0-87-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found Windows 10 (loader) on /dev/sda1
Found Windows 10 (loader) on /dev/sdb1
Found Ubuntu 14.04.1 LTS (14.04) on /dev/sdb7
done
The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old 
 you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old 
 you may need to re-run your boot loader[grub]
Purging configuration files for linux-image-4.4.0-34-generic (4.4.0-34.53) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
eric@eric-Satellite-C850:/boot$ uname -a
Linux eric-Satellite-C850 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
eric@eric-Satellite-C850:/boot$ dpkg -l | grep linux-image
ii  linux-image-4.4.0-87-generic                          4.4.0-87.110                                   amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-87-generic                    4.4.0-87.110                                   amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-generic                                   4.4.0.87.93                                    amd64        Generic Linux kernel image


大功告成

参考文献

[1].Can't upgrade due to low disk space on /boot. https://askubuntu.com/questions/142926/cant-upgrade-due-to-low-disk-space-on-boot
[2].ubuntu升级“ /boot空间不足”解决方法. http://blog.csdn.net/xk_t9_98568/article/details/40624927