Stop apt from keeping a graveyard of old kernel versions
Package Management (Apt/Dnf/Pacman Internals)
Stop apt from keeping a graveyard of old kernel versions
🧩 The Challenge
Dealing with a /boot partition that hits 100 percent because apt refuses to clean up after itself is the absolute worst. You end up staring at a system that won’t install security patches just because five versions of a kernel you don’t even use are sitting there taking up space.
💡 The Fix
Use the autoremove command with a flag that tells the package manager to stop being sentimental about kernels you aren’t currently running. It clears out the bloat and frees up that space instantly.
sudo apt-get autoremove --purge
⚙️ Why It Works
Setting the purge flag ensures that both the kernel images and their associated configuration files get tossed, rather than leaving orphan residues scattered across your file system. apt sees these as unused dependencies once you’ve upgraded to a newer version, so it’s finally time to let them go.
🚀 Pro-Tip: Run this after every major kernel update to keep your boot partition from hitting a wall.
Linux Tips & Tricks | © ngelinux.com | 8/6/2026
