Package Management (Apt/Dnf/Pacman Internals)
Stop cleaning up after your package manager like a janitor
🧩 The Challenge
You ever run an update and realize your boot partition is full of ancient kernels you don’t need? It drives me up a wall when a system update hits a wall because the bootloader can’t squeeze another config file in.
💡 The Fix
Debian-based systems keep old kernel packages around by default, but you can tell the autoremove logic to prune them without manual intervention. You just need to tweak the apt configuration to stop hoarding the past.
echo 'APT::Get::AutomaticRemove "true";' | sudo tee /etc/apt/apt.conf.d/01autoremove
echo 'APT::Get::Purge "true";' | sudo tee -a /etc/apt/apt.conf.d/01autoremove
⚙️ Why It Works
Setting these flags tells apt to treat old kernel versions as unnecessary dependencies, which triggers them for removal the next time you run your regular cleanup. It stops the slow accumulation of clutter before it hits a breaking point.
🚀 Pro-Tip: Run apt autoremove after every major upgrade and save yourself the headache of a read-only filesystem error during a reboot.
Linux Tips & Tricks | © ngelinux.com | 9/18/2026
