Technical Anshu
Tutorials Blog

Ask Ubuntu threads on this problem all open with the same two lines: /boot is full and a kernel update fails with No space left on device. It happens on systems with a separate, small /boot partition - a very common Ubuntu install layout, especially with encryption or LVM. Every kernel update adds a new kernel image to /boot but the old ones stay behind, and after enough updates the partition fills completely. Half-finished kernel installs then block dpkg itself, so ordinary updates fail too. The fix is not to delete files by hand. Ubuntu already knows which kernels are old, and apt can purge them cleanly while keeping the kernel you are running and the newest one. This is an Ubuntu and Debian family pattern: Fedora keeps only 3 kernels by default and Arch does not build up /boot this way, so the steps below are written for apt systems.

Terminal  .  df -h and apt during a kernel update
/boot is at 100 percent. The new kernel has nowhere to go.

df -h shows /boot at 100%

gzip: stdout: No space left on device

E: Sub-process /usr/bin/dpkg returned an error code (1) while configuring linux-image

X apt and dpkg fail while configuring a linux-image package, not while downloading it

X df -h /boot shows the /boot partition full or nearly full

X The main disk still has free space - only the small /boot partition is full

/BOOT FULL  Old kernels are taking the space, not your files - remove them through apt so the package database stays consistent.

The fingerprint of this problem: the error appears during a kernel update, and only /boot - not the whole disk - is out of space.

1

Confirm /boot Is Full and List the Installed Kernels

Confirm the diagnosis before removing anything. Two quick checks prove that /boot really is the full partition and show you how many kernel versions are installed and taking space in it.

  1. Run df -h /boot and check the Use percent for /boot. At or near 100 percent with a kernel update failing confirms this problem. Also glance at the root filesystem line so you know the rest of the disk is not full as well.
  2. List the installed kernel packages with dpkg -l | grep linux-image. On a long-running system you will usually see many versions listed - each one is a kernel image sitting in /boot.
  3. Check which kernel you are actually running right now with uname -r and note that exact version. You will need it in the next fix: the running kernel must never be removed.
  4. Do not start deleting anything yet, and do not reboot into a half-configured kernel update if you can avoid it. First free the space in Fix 2, then finish the stuck update in Fix 3.
2

Remove Old Kernels Safely with apt autoremove --purge ⭐

This is the fix that works, and the safety comes from letting apt decide. Apt knows the running kernel and the newest kernel and keeps both; it purges the older versions properly, updating the bootloader entries and the package database as it goes - none of which happens if you delete files by hand.

  1. Run sudo apt autoremove --purge and read the list it proposes before confirming. It should list old linux-image and related kernel packages, and it must not list the version shown by uname -r.
  2. If the running kernel version appears in the removal list, stop and do not confirm. That should not happen with autoremove, and the running kernel is the one your live system is using right now.
  3. Confirm and let it finish completely without closing the terminal. Purging also removes the old config files for those kernels, which is why --purge is used here instead of a plain remove.
  4. Run df -h /boot again afterwards. /boot should now have clear free space for the pending kernel, and dpkg -l | grep linux-image should show a short list: the running kernel and the newest one.
3

Finish the Stuck Kernel Update

Freeing space does not by itself finish the update that failed halfway. The interrupted kernel package is still sitting half-configured in dpkg, so complete that work now while /boot has room.

  1. Run sudo dpkg --configure -a to configure every package that was left pending by the failed update, including the linux-image package that ran out of space.
  2. Then run sudo apt --fix-broken install to repair any dependency left incomplete by the interruption. Let both commands finish without errors before going further.
  3. Run your normal update once more so the newest kernel installs cleanly into the space you freed, then reboot so the system starts on a fully installed, fully configured kernel.
  4. After the reboot, run uname -r again and df -h /boot one last time: you should be on the new kernel with /boot comfortably below full.
4

Keep /boot From Filling Again

Once it has happened once, it will happen again on a small /boot partition if old kernels are left to accumulate. A short routine after major updates keeps the partition healthy without any risk to the running system.

  1. After a kernel update and a successful reboot onto the new kernel, run sudo apt autoremove --purge again as routine housekeeping. Right after a reboot is the safest moment: the previous kernel is no longer the running one, so apt can purge it normally.
  2. Check df -h /boot whenever an update mentions a new linux-image. Thirty seconds of checking is cheaper than another round of No space left errors mid-update.
  3. Never remove kernels by deleting files inside /boot by hand. Hand deletion leaves the package database, initramfs entries and bootloader config out of step with the files on disk, which turns a space problem into a boot problem.
  4. Remember the scope: this pile-up is an Ubuntu and Debian pattern. Fedora limits kept kernels to 3 by default through installonly_limit in /etc/dnf/dnf.conf, and Arch does not accumulate /boot in this way - so do not go looking for this exact fix on those systems.
5

Software Needed

No extra software is needed. The whole fix uses tools already on every Ubuntu and Debian system: df to confirm the full partition, dpkg to list kernels and finish the stuck configuration, uname to identify the running kernel you must keep, and apt with autoremove --purge to remove the old kernels safely. No file manager deletion, no third-party cleaner and no downloaded script is needed - and none of them would keep the package database consistent the way apt does.

Know your layout: this problem needs a separate /boot partition to bite this hard. If your Ubuntu install has no separate /boot - df -h /boot will show it as part of the root filesystem - a full disk is a different problem with a different cleanup. Check the df output first and only follow this guide when /boot itself is the partition at 100 percent.
What NOT to do: never delete kernel files from /boot by hand, and never remove the running kernel shown by uname -r. If the running kernel is purged or its files are deleted manually, the machine can fail to boot and a simple space cleanup becomes a rescue job. Let apt autoremove --purge choose the old kernels, verify the running version is not in its list, and only then confirm.

More PC Fixes on Technical Anshu

Every week: Windows problems, hidden tools and full setup guides, explained step by step.

Subscribe on YouTube

Frequently Asked Questions

Why does /boot fill up on Ubuntu?

On Ubuntu installs with a separate small /boot partition, every kernel update installs a new kernel image into /boot while the old versions stay installed. After enough updates those old kernels use the whole partition, so the next linux-image package fails with No space left on device while dpkg is configuring it.

What is the safe way to remove old kernels?

Use sudo apt autoremove --purge. Apt removes all but the running kernel and the newest kernel, and it updates the package database and bootloader entries as it goes. Never delete kernel files from /boot by hand - manual deletion leaves dpkg and the bootloader pointing at files that no longer exist.

How do I make sure I do not remove the running kernel?

Run uname -r before you start and note the exact version. Then read the removal list shown by sudo apt autoremove --purge before confirming: the running version must not be in it. Autoremove keeps the running kernel by design, but checking takes seconds and removes any doubt.

The space is free but updates still fail. What next?

The failed kernel package is still half-configured. Run sudo dpkg --configure -a to finish configuring pending packages, then sudo apt --fix-broken install to repair anything left incomplete. After both finish cleanly, run the update again and reboot onto the properly installed kernel.

Does this problem also happen on Fedora and Arch?

Not in this form. Fedora keeps only 3 kernels by default, controlled by installonly_limit in /etc/dnf/dnf.conf, so /boot does not pile up the same way. Arch does not have this separate /boot-full pattern either. This guide and the apt autoremove fix apply to the Ubuntu and Debian family.

Guide by Technical Anshu · Problem collected from real user reports on Ask Ubuntu (/boot is full, kernel update fails, no space left on device) and verified against the safe apt route - dpkg listing, uname -r protection for the running kernel, apt autoremove --purge, then dpkg --configure -a to finish the stuck update. No video exists yet for this topic on the channel, so this topic is saved as a fresh video topic. No Shorts are linked in this blog.