ubuntu boot partition full

LVM and encrypted installs use a separate /boot partition that’s typically between 100 – 512 MB in size. New kernels are installed to this partition, but there’s only enough space for a few kernels at most.

As the available space decreases, you’ll encounter errors in the form of interrupted system upgrades. Apt might even completely stop working if there’s no free space remaining on the partition.

As you only really need the latest two kernel versions, you can remove the older unused kernels to free up space on the boot partition.

Autoremove Kernels with apt

Autoremove removes orphaned packages that were automatically installed as dependencies. In the case of old unused kernels, autoremove will remove the ones that are marked as automatically installed.

sudo apt autoremove

Remove Specific Kernels with apt

Autoremove is convenient, but it doesn’t remove manually installed kernels. There are also situations where you may want to remove specific kernels only. In such scenarios, check your current kernel release first so that you don’t accidentally remove it.

uname -r

List the installed kernels with the list option.

dpkg -l | grep linux-image

Then, purge the unwanted kernels by specifying the full image name as shown below. Take care not to remove the latest two kernels for fallback purposes.

sudo apt purge linux-image-5.19.0-32-generic

Once you’ve removed the kernel images, use autoremove to clean up any lingering dependencies. 

sudo apt autoremove

Manually Remove Old Kernels

If your boot partition is completely full, you probably won’t be able to remove packages with apt. In this case, you can manually delete files from the /boot partition.

First, list the kernels present in the boot partition.

ls -l /boot

You can delete the files marked .old as shown below. Like earlier, make sure you don’t remove the latest two kernels.

sudo rm /boot/initrd.img-5.19.0-45-generic
sudo rm /boot/vmlinuz-5.19.0-45-generic
Anup Thapa

Senior Writer

Anup Thapa is a Linux enthusiast with an extensive background in computer hardware and networking. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys reading up on a range of topics, traveling, working out, and MOBAs.