6

In /boot there are a lot of vmlinuz.* files going back 4 years. Is it safe to remove some of these?

Edit: Most seem to have congig-3.* and System.map.* files to go with them. I would probably want to be rid of those too? Or instead?

2 Answers2

5

They will be removed automatically if you run the following:

sudo apt-get autoremove

Update: I found a VM where I haven't run those commands in a few weeks. Here is the output, showing that autoremove cleans up files in /boot, going from 127M in size down to 96M in size:

stephane@steph-dev-vm ~> du -hs /boot/
127M    /boot/

stephane@steph-dev-vm ~> sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.16.0-30 linux-headers-3.16.0-30-generic linux-image-3.16.0-30-generic
  linux-image-extra-3.16.0-30-generic
Use 'apt-get autoremove' to remove them.

stephane@steph-dev-vm ~> sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-3.16.0-30 linux-headers-3.16.0-30-generic linux-image-3.16.0-30-generic
  linux-image-extra-3.16.0-30-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 281 MB disk space will be freed.
Do you want to continue? [Y/n] y
...
Found linux image: /boot/vmlinuz-3.16.0-31-generic
Found initrd image: /boot/initrd.img-3.16.0-31-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

stephane@steph-dev-vm ~> du -hs /boot/
96M /boot/
A.B.
  • 92,125
Stéphane
  • 2,536
0

The answer appears to be that there are lots of kernels installed and I should remove them.

I removed the oldest using sudo apt-get uninstall and a wild card. Risky if you get it wrong but otherwise effective.