The production server I'm using has a /boot partition of 400MB. And every once in a while if I want to install something from repositories, it tells me that it cannot do that because there is No space left on device
I cannot change the server configuration, because I'm not the owner.
I have seen some tutorials (like this one) on how to delete the old kernel packages. However, they all seem sketchy. I don't want to endup having a non-bootable system.
uname -r
shows me:
4.15.0-30-generic
and
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'
shows me:
linux-headers-4.13.0-36 linux-headers-4.13.0-36-generic
linux-headers-4.13.0-39 linux-headers-4.13.0-39-generic
linux-headers-4.13.0-41 linux-headers-4.13.0-41-generic
linux-headers-4.13.0-43 linux-headers-4.13.0-43-generic
linux-headers-4.13.0-45 linux-headers-4.13.0-45-generic
linux-headers-4.15.0-24 linux-headers-4.15.0-24-generic
linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic
linux-headers-4.15.0-65 linux-headers-4.15.0-65-generic
linux-headers-generic-hwe-16.04 linux-image-4.13.0-36-generic
linux-image-4.13.0-39-generic linux-image-4.13.0-41-generic
linux-image-4.13.0-43-generic linux-image-4.13.0-45-generic
linux-image-4.15.0-24-generic linux-image-4.15.0-29-generic
linux-image-extra-4.13.0-36-generic
linux-image-extra-4.13.0-39-generic
linux-image-extra-4.13.0-41-generic
linux-image-extra-4.13.0-43-generic
linux-image-extra-4.13.0-45-generic linux-libc-dev:amd64
linux-modules-4.15.0-24-generic linux-modules-4.15.0-29-generic
What is the best way to delete old kernel packages to free up /boot space?
Later edit:
- Any
apt-get
will NOT work. It will report the same error
sudo apt autoremove
? – Soren A Oct 03 '19 at 10:24/boot
has no space. ubuntu does fill up the/boot
every ~3 months with kernels. – machineaddict Oct 04 '19 at 07:56apt-mark showhold
) so old kernels aren't removed; or check changes to your setup. The best tool issudo apt autoremove
from comment 1 but it cannot override holds. – guiverc Oct 04 '19 at 07:59apt-mark showhold
shows nothing. the server is from Hetzner and this is their default setup. – machineaddict Oct 04 '19 at 08:11