Purge old kernels

There is mention on some sites of purge-old-kernels program with ubuntu. Is there something equivalent for Ubuntu-Mate? Some sites have recommended the installation of "biyobu" as a way of removing all old kernels at the same time rather than one at a time. I have over 100 old kernels and my root is running out of space. Any help would be appreciated.

1 Like

Are you talking about something other than:

sudo apt autoremove

?

3 Likes

I, too, have had trouble with running out of /boot space when Software Updater runs. I have found that the easiest, most reliable, way of purging old kernels is to run Ubuntu Cleaner. It's a GUI app:

Check off a specific category in the left pane, check what you want to purge in the right pane, then click the Clean button. You can install it with these commands:

sudo apt update
sudo apt install ubuntu-cleaner

sudo apt autoremove does not seem to remove them from root. I did run it and they are still present but not functionimg (rc).

UM 22.04.2
What version of MATE are you running?

How many does this command show. Mine correctly shows 7

dpkg --list | grep -E -i --color 'linux-image|linux-headers' | wc -l

Thanks Dave. Just installed ubuntu-cleaner. It's a nice looking program unfortunately it only list kernels that begin 5.xx. Most of the ones I want to get rid of begin 4.xx and are not listed. The program can remove 5 old kernels but I:m still left with about 90 kernels that will not be removed.

Thanks Mendy. Hope this reaches you as I had some difficulty with "Reply". Mate 20.04 (Will upgrade soon). 95 kernels.

1 Like

Thanks Mendy. Hope this reaches you as I had some difficulty with "Reply". Mate 20.04 (Will upgrade soon). 95 kernels.

Thanks Dave. Just installed ubuntu-cleaner. It's a nice looking program unfortunately it only list kernels that begin 5.xx. Most of the ones I want to get rid of begin 4.xx and are not listed. The program can remove 5 old kernels but I:m still left with about 90 kernels that will not be removed.

Whoa, don't upgrade just based on this (upgrade is good). As far as I can find the autoremove command works the same in your version and doubt an upgrade would handle the 4.xx. if depending on method of upgrade it retained them.
Hopefully someone may chime in on this.

1 Like

There no universal standard, but the kernel is usually found in the /boot directory. - superuser.com
Are these kernels in /boot, or are you finding them in /root?

2 Likes

All 95 kernels in root.

Probably why apt-get, bleachbit and ubuntu cleaner aren't finding/removing them.
My /boot:

My /root with hidden files:

CAUTION:

I think you are going to have to open root as root (sudo) and delete all the old kernels. Before doing that make sure you have the two latest kernels in /boot. If you are not proficient with the terminal I recommend grub Customizer. Then delete the old kernels, pray and reboot.

I have no explanation how your kernels could have gotten into /root.
I would recommend you wait for someone like Pavlos with a lot more knowledge than myself before doing anything.

1 Like