Stop letting dpkg-divert hide your files during upgrades
Package Management (Apt/Dnf/Pacman Internals)
Stop letting dpkg-divert hide your files during upgrades
🧩 The Challenge
Sometimes you update a package and your custom config files just vanish, or worse, get overwritten by the default versions without a word. I spent way too long figuring out that a previous sysadmin had redirected the file path behind my back using a diversion I didn’t know existed.
💡 The Fix
Use the list command for dpkg-divert to see if your system is secretly pointing file requests to a backup location instead of the real destination. It’s a lifesaver when the package manager acts like it’s ignoring your edits.
dpkg-divert --list | grep your-config-filename
⚙️ Why It Works
This command queries the internal database where the package manager tracks files that have been intentionally moved aside to prevent them from being managed by standard installs. It effectively pulls back the curtain on why your config changes aren’t sticking.
🚀 Pro-Tip: If you find an old, crusty diversion that shouldn’t be there, use –remove to put the file back in its rightful place.
Linux Tips & Tricks | © ngelinux.com | 11/16/2026
