How To Cleanup Boot Partition Ubuntu / Debian

In this article you will learn How To Cleanup Boot Partition Ubuntu Linux.

Linux boot partition can be filled with old unused kernels.

In first step we need find out current Linux kernel version and unused kernels. After it remove old kernels.

We will apt package management system and this method will work if your /boot partition not 100% full.

Check Current Kernel Version

$ sudo uname -r

Example output:

As you see on image in my case – 5.4.0-64-generic is current kernel. Other older kernel versions can be deleted.

List Old Kernels

To get the list of old installed kernel images type:

$ sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`

Your output will something like:

Uninstall Old Kernels

To cleanup boot partition in Ubuntu uninstall old kernels with apt command one by one:

$ sudo apt-get purge linux-image-5.4.0-39-generic
$ sudo apt-get purge linux-image-5.4.0-42-generic
$ sudo apt-get purge linux-image-5.4.0-54-generic

Remove no longer used dependencies

After old kernel images remove we need to remove no longer used dependencies:

$ sudo apt-get autoremove

Update GRUB

To update grub run this command in terminal:

$ sudo update-grub

Conclusion

We just learn how to free up space in /boot partition in 5 easy steps with using apt utility.

How To Cleanup Boot Partition Ubuntu (Remove Old Kernels). By steps

  1. Check Current Kernel Version

    $ sudo uname -r

  2. List Old Kernels

  3. Uninstall Old Kernels

    $ sudo apt-get purge Kernel_Image_Name

  4. Remove no longer used dependencies

    $ sudo apt-get autoremove

  5. Update GRUB

    $ sudo update-grub

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee
Summary
How To Cleanup Boot Partition Ubuntu / Debian
Article Name
How To Cleanup Boot Partition Ubuntu / Debian
Description
How To Cleanup Boot Partition Ubuntu / Debian. In first step we need find out current Linux kernel version and unused kernels
Author
Publisher Name
ARSTECH
Publisher Logo

arstech

Leave a Reply

Your email address will not be published. Required fields are marked *