0
df -h

gives:

Filesystem                         Size  Used Avail Use% Mounted on

udev                               3.9G     0  3.9G   0% /dev
tmpfs                              799M   81M  718M  11% /run
/dev/mapper/buildingbase--vg-root  287G   27G  246G  10% /
tmpfs                              3.9G     0  3.9G   0% /dev/shm
tmpfs                              5.0M     0  5.0M   0% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/vda1                          472M  466M     0 100% /boot
/dev/vdb1                          2.0T  647G  1.4T  32% /mnt/bigstorage
tmpfs                              799M     0  799M   0% /run/user/1000

my kernel

uname -r 
4.4.0-72-generic

And than my installed kernels...

dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+'

as you can see NO OLDER KERNELS :-{

ii  linux-image-4.4.0-72-generic       4.4.0-72.93                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-75-generic       4.4.0-75.96                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-78-generic       4.4.0-78.99                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-79-generic       4.4.0-79.100                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-81-generic       4.4.0-81.104                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-83-generic       4.4.0-83.106                               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-4.4.0-89-generic       4.4.0-89.112                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-91-generic       4.4.0-91.114                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-92-generic       4.4.0-92.115                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP

How can I clean up /boot?

Of course

sudo apt-get autoremove

is not working... not enough space

  • 1
    why are you using the oldest installed kernel? Are you not able to reboot this machine? – Zanna Nov 14 '17 at 13:50
  • 1
    why do you have all those newer kernel if not using them? Your space issue is too many kernels installed for the size of your boot partition. If you manually delete the system map for the unused kernels, that should give enough room the apt to remove kernels. – ravery Nov 14 '17 at 13:51
  • 2
    You need to use sudo apt autoremove more often. – user692175 Nov 14 '17 at 15:26
  • Title says is all - again… /boot full You made /boot too small and you do not seem to do routine maintenance . Perhaps you should put the kernel on hold =) – Panther Nov 14 '17 at 15:33
2

Apt's auto-removal logic assumes that you want newer kernels, and won't mark newer kernels as eligible for auto-removal

You are booted into the oldest kernel. Apt's auto-removal logic won't remove anything newer.

Your uptime must be impressive!

  1. Uninstall the kernels you are not using this will clean up your /boot:

    sudo dpkg --remove linux-image-4.4.0-{75,78,79,81,83,87,89,91,92}-generic linux-image-extra-4.4.0-{75,78,79,81,83,87,89,91,92}-generic
    

Now you must make a choice: Do you wish to resume upgrading your kernel regularly? Or do you wish stay on your current kernel for the life of your release? (It's not a permanent choice, you can always change.)

If you desire to get off the kernel-upgrade train entirely, use apt-hold to prevent newer kernels from being downloaded and installed. Then you can stop here and ignore the rest of this answer. This is not the recommended option for new or unskilled users. [thanks to @panther]

If you desire to continue upgrading kernels, then continue with the following steps. This is the recommended option for new or unskilled users.

  1. Update the kernel metapackages so they pull in the correct newest kernel

    sudo apt clean linux-image-generic linux-image-extra-generic
    sudo apt install --reinstall linux-image-generic linux-image-extra-generic
    
  2. Upgrade your system, which will pull in the latest kernel (-98) as well as test your package manager for proper function

    sudo apt update
    sudo apt upgrade
    
  3. Reboot into the new kernel. Rebooting monthly or even quarterly will prevent the problem from occurring again...or if you are a script guru, you can modify apt's auto-removal logic (it's just a script) to remove intermediate newer kernels.

    Alternately, if you dislike rebooting, try Ksplice. Ksplice is an update service that automatically applies patches to the Linux kernel without requiring a reboot of the computer. [thanks to @panther]

  • Very nice answer – Panther Nov 15 '17 at 1:52
  • Wowwwww, This is an answer right to the point, no b.s. around. To many times you see an "almost" answer. This is great!! thanks man. – Niurbe Nov 15 '17 at 7:51
0
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Use the above script. I have not used it in a while but it should work. This would remove all the kernel versions except for the one currently in use.

  • A piece of your answer "This would remove all the previous kernel versions....". In the question I metioned the fact that I have no previous kernel. Dit you missed this or is you command still working in my case? greets, Ed. – Niurbe Nov 14 '17 at 14:00
  • this command likely will not work until you have enough free space for apt to run. However, it should remove all but the currently used kernel. – ravery Nov 14 '17 at 14:02
  • It should work, I used it every time my /boot got full. Run the command dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')" first. This will show you what all packages would be removed. The kernel that you are using would not be in it (check with uname -r). – Legolas Nov 14 '17 at 14:05
  • @ebruin Part of the ongoing question is why you are booting into an older kernel - is this be design, or is it accidental? – Charles Green Nov 14 '17 at 16:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.