Linux Admin

Linux Package Management Errors: apt, dpkg, yum, dnf

Part of pathway: Linux Troubleshooting: 150 Common Errors

Package Management Errors

Package managers are the most-touched admin tool, and their error messages are inconsistent across apt, yum, dnf, and friends. Most failures fall into a few categories: lock contention, missing dependencies, signature/GPG issues, and broken repository state. The ten errors below are what you’ll see on Debian/Ubuntu and RHEL-family servers.

#051 Could not get lock /var/lib/dpkg/lock

Description: Another apt/dpkg process is running.

Solution: ps aux | grep -E "apt|dpkg" — if a real process, wait. If stale: rm /var/lib/apt/lists/lock /var/lib/dpkg/lock-frontend and retry. Common cause: unattended-upgrades running while you’re trying to install.

#052 Unmet dependencies

Solution: apt --fix-broken install; or dpkg --configure -a; for yum: yum-complete-transaction or dnf shell.

#053 NO_PUBKEY (GPG signature)

Solution: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys KEYID; modern Debian: drop the key in /etc/apt/trusted.gpg.d/; then apt update.

#054 Hash sum mismatch

Solution: Mirror is out of sync or local cache is corrupt. apt clean && apt update; or wait for mirror refresh.

#055 Held broken packages

Solution: apt-get -f install attempts repair. apt-mark showhold shows held packages; apt-mark unhold pkg to release.

#056 dpkg: error processing package

Solution: Run with --debug to see what failed; often a postinst script. Manual: dpkg --remove --force-remove-reinstreq pkg then reinstall.

#057 Repository unreachable

Solution: curl http://archive.ubuntu.com/... — can you reach it? DNS, proxy, firewall? Edit /etc/apt/sources.list; for corporate environments, set Acquire::http::Proxy in /etc/apt/apt.conf.d/.

#058 Insufficient disk space (during install)

Solution: apt clean, journalctl --vacuum-size=500M, remove old kernels (apt autoremove --purge), check /var/cache.

#059 GPG error: signing key has expired

Solution: Update keyring package (apt install ubuntu-keyring); or manually fetch new key from project site.

#060 Conflict with another package

Solution: apt remove conflicting-package first, or use apt install --no-install-recommends to limit deps. Don’t use --force-overwrite unless you understand the consequence.

Conclusion

Five habits:

  1. apt update before any install — cached metadata is the source of half of all package errors.
  2. If a transaction fails partway: dpkg --configure -a on Debian, yum-complete-transaction on RHEL.
  3. Disable unattended-upgrades before manual maintenance to avoid lock contention.
  4. Pin keyring updates separately so signing keys don’t expire under you.
  5. Don’t mix package sources (Debian + Ubuntu, two PPAs with the same package) — conflicts come from upstream not from your config.

Related Linux Admin articles

Leave a Reply