Oftentimes we are distracted by our computers with so much to do that we forget about seemingly trivial things like space allocation. It is only when we get the “Storage almost full” or “No storage left” warning that we need to sort out this virtual hitch. You can usually encounter this issue on a lot of systems. It may arise when you update your system to a newer version to ward off the clumsiness from the older versions or install a new game you have wanted to play or any utility in general. On modern Linux distributions like Ubuntu, the files need to boot up the system on a different partition. It is usually 256Mb to 512Mb but can exceed this limit mostly in the case of virtual machines. You can see this partition on a specific Directory called /boot. GRUB 2 is the default boot loader and manager in Ubuntu. All configuration files, modules, and assets are in the /boot/grub2 directory.  The file above defines booting procedures in different operating systems and what kernels use. The kernel version files are also in the boot directory. However, when we update the kernel, the older version is not replaced. This can end up eating most partition storage over time, making our systems sluggish in the process. Consequently, you may get a boot partition full of errors which can be horrendous for the functionality of our Linux system. To check the free space on the boot partition, we can run the following command that shows us the free space of our boot partition: If you can see that 45% of the boot partition is consumed in this case. A substantial amount of this consumed space is due to old files and Kernels, which hampers our experience and reduces the efficiency of our working device. So without further ado, let’s delve right into it!

1. Using Apt Autoremove.

This is an effortless approach to clear unwanted files on your system. With the help of this command, all unnecessary kernels will be removed, freeing up space. This command helps in removing all unnecessary kernels automatically. Let’s take a look at the steps involved: This simple, yet powerful command will not only remove the unwanted kernels, but also the dependencies and packages which are no longer required by any tools in your system.

2. Manually Removing Kernels.

In certain cases, the boot partition gets full in the middle of a system update which can be a serious bummer. This results in the error “No space left on device” and we’re forced to remove the older unused kernels using the same old apt method, manually one after the other. If the previous method doesn’t work for you, then worry not, as we will guide you on how to delete these external kernels manually. Before we begin, it is a need that you start by checking your kernel version. This is crucial, as deleting your current kernel version may result in a broken and unstable system. Consequently, your system might fail to boot up. Without further ado, let’s take a look at the steps: Our current kernel version is 4.15.0-142-generic. This is the only kernel in our boot directory. The older versions are irrelevant, so we may remove them. You can remove these kernels via the terminal or the GUI. Both of these methods are elaborated on below. 

3. Removing Older Kernels [Terminal].

The first and foremost step to follow is to list all available kernels. You can do this by typing the following command in the terminal window: This displays various packages and old kernels.  Now we simply have to delete the kernels other than our current version. For this purpose, we can use the “rm” command. This removes the specific kernels from the boot partition by typing the command with the path as follows: The above procedure can prove quite cumbersome for deleting multiple unwanted kernels at once. For this purpose, we use the following syntax. Suppose we have 3 unwanted kernels:

Vmlinuz-4.10.0-28-generic Vmlinuz-4.10.0-30-generic vmlinuz-4.10.0-33-generic

To remove all these in one go, we type the following command: This method is not generally recommended if you want to get rid of all the boot files of the respective kernel, which reside in the boot directory. The most efficient way to remove the old kernels manually is through the APT package manager. Consider, for instance, an old kernel package, linux-image-4.10.0-28-generic. So with the APT package manager, we type the following: You will be asked to confirm your action by pressing ‘y’ on your keyboard. This will remove the old kernel, and you will see a window as shown below: To clear the dependencies of the old kernel package along with additional boot files, implement the following instruction: With the steps followed correctly, the older kernels should no longer be present in the system. 

4. Removing Older Kernels [GUI].

Working with the terminal might leave you in a bind if you mess up the command in any way. If one wants to remove kernel packages without using a terminal, it’s possible to use GUI tools. This section will explain how you can remove older kernels by using the GUI. Just follow the steps and you will soon have your system in an immaculate condition. To ensure our system stays in mint condition and all applications run fluidly, it is vital to keep up with regular maintenance, including Operating system checkups, check and balance of old and new files, and space partitions. Luckily if you feel like your system might be clogged with unnecessary old kernels or irrelevant dependencies which are continually dragging your system down, you can always clear your system and start with a clean slate. We hope this guide helped you sort out any space management problems that you faced. If this guide helped you, please share it. 🙂

How to Free Up Space in boot Partition on Ubuntu Linux - 3How to Free Up Space in boot Partition on Ubuntu Linux - 47How to Free Up Space in boot Partition on Ubuntu Linux - 44How to Free Up Space in boot Partition on Ubuntu Linux - 58How to Free Up Space in boot Partition on Ubuntu Linux - 72How to Free Up Space in boot Partition on Ubuntu Linux - 74How to Free Up Space in boot Partition on Ubuntu Linux - 51How to Free Up Space in boot Partition on Ubuntu Linux - 41How to Free Up Space in boot Partition on Ubuntu Linux - 63