Ubuntu

Ubuntu Boot Partition Full

Ubuntu Boot Partition Full
In this article, I am going to talk about problems you may have with your boot partition getting full and how you remedy boot partition full errors on Ubuntu. Let's get started.

Importance of the Boot Partition:

On Ubuntu and other modern Linux distributions, all the files required to boot your computer is kept on different partition, called the Boot partition. The Boot partition is usually about 512MB or 256MB in size.

The Boot partition is mounted on a specific directory /boot. The GRUB bootloader configuration files, modules and other assets are kept in the /boot/grub2 directory. The GRUB configuration file can be found at /boot/grub2/grub.cfg. This file defines how GRUB boots into different operating systems and what kernels to use and many more.

Different versions of vmlinuz, initrd.img, System.map, abi, config etc. files for different versions of kernels are kept in the /boot directory as well.

From all this, you can tell how important the Boot Partition is and it's crucial for a fully functioning Linux system.

Causes of Boot Partition Full Errors:

As I stated earlier, the boot partition is a small partition of about 256MB or 512MB. Usually nobody makes it larger than that. So when you install a new version of kernel, it is placed in the /boot directory (this is where the boot partition is mounted) and the GRUB configuration file /boot/grub2/grub.cfg is updated. Installing a new kernel does not remove the old one automatically. So additional free space must be available for the new kernel files and for the updated GRUB configuration files.

What if there is not enough free space available in the boot partition (/boot) for the new kernel files? Well, that's when you get boot partition full errors. I will show you how to fix boot partition full errors in the later section of this article below.

Checking Available Free Space on the Boot Partition:

If you ever run into the boot partition full error, then the best way to be sure that the boot partition is full is to check how much free space is available in the boot partition (/boot).

You can run the following command to check the available free space on the boot partition (/boot):

$ df -h

As you can see, the boot partition of one of my Ubuntu virtual machine is about 472MB in size, and only 56MB is used. The available free space is about 393MB.

Avoiding Boot Partition Full Error:

At times, there will be no separate boot partition (/boot) on your Ubuntu operating system as the boot partition is not really mandatory. You can install everything on a single partition (the root partition /). So when you choose Erase Everything and Install Ubuntu option in the Ubuntu installer, most of the time, everything is installed in a single partition (the root partition /).

As you can see, everything was installed on a single partition in this Ubuntu virtual machine.

The advantage of doing so is that, you will not run into the boot partition full error as long as you have enough free space in your root partition (/). If you do happen to run into one, you can just delete some of your user files (from your login users $HOME directory) and it should be fixed easily.

Even though this way you can avoid boot partition full errors all together, I don't recommend it. You should always have a separate boot partition.

Freeing Up Disk Space to Fix Boot Partition Full Errors:

If you have everything installed on a single partition, then freeing up disk space is not a big issue. You can delete some of your user's files from the HOME directory, or move them into a USB drive or an external hard drive.

On Ubuntu, the APT package repository caches and other temporary files can be removed to free up disk space.

To remove APT caches and temporary files, run the following command:

$ sudo apt autoremove

Removing Old Unused Kernels to Free Up Disk Space:

If you have a separate boot partition, then you can remove all the old unused kernels from the /boot directory to free up disk space from the boot partition.

First, you have to check what kernel you're currently using with the following command:

$ uname -r

As you can see, the version of kernel currently being used is 4.15.0-34-generic.

Now run the following command to list all the installed kernel packages:

$ dpkg -l | grep linux-image

As you can see, I have 2 kernel images installed. I am currently using linux-image-4.15.0-34-generic kernel image. So the old one is linux-image-4.15.0-20-generic. This is the one we can remove and free up disk space from the boot partition.

If you list the files in the /boot directory, you should see abi, config, initrd.img, retpoline, System.map, vmlinuz files for different versions of the kernel.

$ ls -l /boot

I don't recommend you directly remove old kernel files from the /boot directory on Ubuntu. The best way to remove old kernel files on Ubuntu is to remove the old kernel package using the APT package manager.

For example, you can remove the old kernel package, let's say linux-image-4.15.0-20-generic with the APT package manager as follows:

$ sudo apt remove --purge linux-image-4.15.0-20-generic

Now press y and then press to continue.

The linux-image-4.15.0-20-generic package should be removed.

Now run the following command to clean up the dependencies of the old kernel package:

$ sudo apt autoremove --purge

Now press y and then press .

The old kernel dependency packages should be removed.

As you can see, the old kernel files are no longer available in the /boot directory.

Resizing Boot Directory:

If you have free space on your hard drive that you're not using, then you can solve boot partition full problem by resizing the boot partition. You can use gparted graphical application to do that easily.

You may also create a new bigger partition, format it, mount it on your filesystem, copy everything from the /boot directory to that new partition and then mount the new boot partition to the /boot directory using the /etc/fstab file. That should also work.

That's how you remedy boot partition full errors on Ubuntu. Thanks for reading this article.

5 parasta arcade-peliä Linuxille
Nykyään tietokoneet ovat vakavia koneita, joita käytetään pelaamiseen. Jos et pääse uusiin korkeisiin pisteisiin, tiedät mitä tarkoitan. Tässä viestis...
Battle For Wesnoth 1.13.6 Development Released
Battle For Wesnoth 1.13.6 released last month, is the sixth development release in the 1.13.x series and it delivers a number of improvements, most no...
League of Legendsin asentaminen Ubuntu 14 een.04
Jos olet League of Legendsin fani, tämä on sinulle mahdollisuus testata League of Legendsia. Huomaa, että PlayOnLinux tukee LOLia, jos olet linux-käyt...