How to clean up full /boot safely?


I have a full /boot. When I run the following command, I got the
following error. Does anybody know to fix this problem?

$ sudo apt-get -f autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
Suggested packages:
fdutils linux-doc-3.13.0 linux-source-3.13.0 linux-tools
The following packages will be REMOVED:
linux-headers-3.13.0-116 linux-headers-3.13.0-116-generic
linux-headers-3.13.0-117 linux-headers-3.13.0-117-generic
linux-headers-3.13.0-119 linux-headers-3.13.0-119-generic
linux-headers-3.13.0-121 linux-headers-3.13.0-121-generic
linux-headers-3.13.0-123 linux-headers-3.13.0-123-generic
linux-headers-3.13.0-128 linux-headers-3.13.0-128-generic
linux-image-3.13.0-116-generic linux-image-3.13.0-117-generic
linux-image-3.13.0-119-generic linux-image-3.13.0-121-generic
linux-image-3.13.0-123-generic linux-image-3.13.0-128-generic
linux-image-extra-3.13.0-116-generic linux-image-extra-3.13.0-117-generic
linux-image-extra-3.13.0-119-generic linux-image-extra-3.13.0-121-generic
linux-image-extra-3.13.0-123-generic linux-image-extra-3.13.0-128-generic
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 24 to remove and 22 not upgraded.
10 not fully installed or removed.
Need to get 0 B/15.5 MB of archives.
After this operation, 1,590 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 366682 files and directories currently installed.)
Removing linux-image-extra-3.13.0-128-generic (3.13.0-128.177) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal
3.13.0-128-generic /boot/vmlinuz-3.13.0-128-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools
3.13.0-128-generic /boot/vmlinuz-3.13.0-128-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-128-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.13.0-128-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-128-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.13.0-128-generic (3.13.0-128.177) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools
3.13.0-128-generic /boot/vmlinuz-3.13.0-128-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-128-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub
3.13.0-128-generic /boot/vmlinuz-3.13.0-128-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-126-generic
Found initrd image: /boot/initrd.img-3.13.0-126-generic
Found linux image: /boot/vmlinuz-3.13.0-125-generic
Found initrd image: /boot/initrd.img-3.13.0-125-generic
Found linux image: /boot/vmlinuz-3.13.0-123-generic
Found initrd image: /boot/initrd.img-3.13.0-123-generic
Found linux image: /boot/vmlinuz-3.13.0-121-generic
Found initrd image: /boot/initrd.img-3.13.0-121-generic
Found linux image: /boot/vmlinuz-3.13.0-119-generic
Found initrd image: /boot/initrd.img-3.13.0-119-generic
Found linux image: /boot/vmlinuz-3.13.0-117-generic
Found initrd image: /boot/initrd.img-3.13.0-117-generic
Found linux image: /boot/vmlinuz-3.13.0-116-generic
Found initrd image: /boot/initrd.img-3.13.0-116-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
The link /vmlinuz is a damaged link
Removing symbolic link vmlinuz
you may need to re-run your boot loader[grub]
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)


Re: How to clean up full /boot safely?

By Colin Watson at 02/09/2018 - 22:13

On Fri, Feb 09, 2018 at 08:47:20PM -0600, Peng Yu wrote:
To make room, you can safely manually remove some of the old files from
packages that are going to be removed anyway. In your case, I'd go for

sudo rm -f /boot/initrd.img-3.13.0-{116,117,119,121,123}-generic

(You may want to first check what "uname -r" reports as your running
kernel, and remove that from the list above if necessary.)

This should make enough working space for you to be able to do the