Ubuntu: free up space in / boot

During an Ubuntu upgrade, for upgrade to a higher version, here is the tutorial, the do-release-upgrade wizard checks that there is enough space left in the / boot partition. Indeed, the update process will add an additional kernel and it is necessary to have at least 50MB of free space in “boot” to be able to perform the upgrade operation.

In summary, updating Ubuntu is not possible because there is not enough space available in the / boot partition of the hard drive. This tutorial explains how free up disk space in / boot to be able to update the Ubuntu system.

A preventive backup is obviously recommended to go back in case of improper handling or error during the maintenance operation.

Error message

“The upgrade requires xx M total free space on the / boot disk. Please free at least xx M of disk space on / boot. Empty your trash and remove temporary packages from previous installations using sudo apt-get clean »

See used disk space in / boot

Use the following command to see the free space of the boot partition:

df -h

Ubuntu disk df boot tutorial

Or “df -aTh” for all the information on the partitions.

Automatic solution

To clean up in / boot, we can ask the operating system to remove obsolete Ubuntu kernels.

1. This command will automatically erase the old kernels and leave only the two most recent versions:

sudo apt-get autoremove

Ubuntu kernel autoremove tutorial

2. Check the space available in / boot to see if it meets the minimum required by the upgrade process.

df -h

Ubuntu disk df boot tutorial

Manual solution

If the automatic method does not work or does not free enough disk space, do the operation manually.

1. See what is the current version of the Ubuntu kernel:

uname -r

Ubuntu uname r kernel version tutorial

2. List the available kernels:

dpkg -l | grep -Ei "linux-headers|linux-image"

Ubuntu tutorial linux kernel list header image

Each kernel version matches linux-headers-xxx-x, linux-image-xxx-x (and linux-image-extra-xxx-x lines but not every time).

3. To delete a version of the kernel, use the following command, adapting the version numbers:

sudo apt-get remove --purge linux-headers-3.5.0-51-generic linux-image-3.5.0-51-generic linux-image-extra-3.5.0-51-generic

4. Confirm with ” o ” (Yes).

Ubuntu tutorial remove kernel

5. Repeat for as many cores to remove. Keep at least the two most recent versions (the highest numbers) and make sure you don’t touch the current kernel.

You can also do everything on a single command line by indicating each time the kernel number to be deleted, so everything is deleted at once:

Ubuntu tutorial remove kernel

6. Watch the free disk space in / boot to have enough availability to update or upgrade the Ubuntu system.

df -h

Ubuntu disk df boot tutorial

7. Redo a backup of the server or the VM.

Leave a Comment