Use it when apt or dnf fails.
Package Problems
Package problems are failed installs or upgrades: dependency errors, broken or half-configured packages, repository or signature errors, and locks.
1. Exact error text?
2. Repos: apt update / dnf makecache clean?
3. Broken state: dpkg --audit / rpm -Va --nofiles --nodigest.
4. Repair: dpkg --configure -a, apt -f install / dnf distro-sync.
5. History: /var/log/apt/history.log / dnf history.
repos healthy → dependencies resolvable → transaction runs → packages configured
For Linux Troubleshooting → Package Problems, continue with the first unproven Topic check: Capture package manager command, repositories/origins, metadata age and exact error before cleanup. If that boundary is healthy, advance to the adjacent check: Inspect candidate/version, dependency/conflict/held state, locks and dpkg/RPM transaction/database consistency. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
Healthy evidence: the intended package/version/origin is resolved and installed with consistent package database state, scripts complete, and the dependent service/workload passes acceptance.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Capture package manager command, repositories/origins, metadata age and exact error before cleanup.
- Inspect candidate/version, dependency/conflict/held state, locks and dpkg/RPM transaction/database consistency.
- Review maintainer-script and filesystem/service failures separately from solver/download success.
- Repair the first failed package boundary, complete/verify transaction, then repeat the original application/service acceptance test.
Step 3 Commands Verify boundary
apt -f install
dpkg --audit
dnf history
rpm -Va | head
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: cache cleanup is used as a universal fix, repositories are changed before origin is captured, installed status is accepted without service verification, or interrupted transactions are retried blindly.
Step 5 Common mistakes Narrow the fault
- Forcing installs with
--force/--nodeps.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Read the exact error. Fix repositories first (apt update / dnf makecache). Don't force; repair with dpkg --configure -a/apt -f install or dnf distro-sync. Check the package history for what changed.
journalctl -b -p err— errors this bootsystemctl --failed— failed unitsdf -h; df -i— space and inodesss -tulpn— listening socketsdmesg -T | tail— recent kernel messages
ReferenceWhat it is1 section · depth on demand
Core model
Identify the exact package operation and distribution/repositories. Separate metadata freshness, origin/pinning/module stream, solver plan, transaction locks, package database state and scripts/config changes; preserve the failed transaction evidence before retrying.
ReferenceImportant terms & boundaries4 sections · depth on demand
What this shows and what it does not
Package Problems owns cross-layer package fault isolation; Package Management owns APT/DNF/RPM semantics and service/application branches own post-install behavior.
In depth
Debian / Ubuntu: diagnose before forcing
$ sudo apt-get check
$ sudo apt-get -s install nginx # simulate: shows what would change, changes nothing
$ sudo apt-get -f install # attempt to fix broken dependencies
$ sudo dpkg --audit # half-installed / unconfigured packages
$ sudo dpkg --configure -a # finish interrupted configuration
The apt-get manual describes check as a diagnostic that updates the cache and checks for broken dependencies, -s/--simulate as a run that changes nothing, and -f/--fix-broken as an attempt to correct broken dependencies in place.
| Error | Cause | Fix |
|---|---|---|
Could not get lock /var/lib/dpkg/lock-frontend | Another apt/dpkg process (often unattended-upgrades) | Wait; ps aux \| grep -E 'apt\|dpkg' — never delete lock files while a process runs |
dpkg was interrupted | Previous run killed | dpkg --configure -a |
unmet dependencies / held packages | Mixed repositories or pinned versions | apt-cache policy <pkg>, apt-mark showhold |
NO_PUBKEY / signature errors | Repository key missing or expired | Install the vendor keyring into /etc/apt/keyrings and reference it with signed-by= |
Hash Sum mismatch | Proxy/mirror serving stale files | apt-get clean, retry or switch mirror |
RHEL family equivalents
| Task | Command |
|---|---|
| Simulate | dnf install --assumeno nginx |
| History and undo | dnf history, dnf history undo <id> |
| Problems in the RPM database | rpm -Va (verify files), rpm --rebuilddb (last resort) |
| Duplicate packages after interruption | dnf remove --duplicates |
| Which repo provides a file | dnf provides /usr/bin/xyz |
Find what changed
/var/log/apt/history.log and /var/log/dpkg.log (Debian) or dnf history info <id> (RHEL) show exactly which packages changed and when — the first place to look when "it stopped working after updates".
Avoid making it worse
Do not mix distribution releases (adding a newer release's repository "for one package"), do not force-remove with dpkg --force-all on production systems, and snapshot or back up before large upgrades.
*The APT and dpkg commands illustrate package recovery checks; no executed package transaction is supplied.*
How it works at runtime
Package Problems is part of Linux Troubleshooting → Package Problems. Package Problems isolates repository metadata/trust, candidate selection, dependency/conflict resolution, download/integrity, dpkg/RPM database, maintainer scripts and post-install service/workload effects.
Topic-specific state model. Package Problems isolates repository metadata/trust, candidate selection, dependency/conflict resolution, download/integrity, dpkg/RPM database, maintainer scripts and post-install service/workload effects.
Interpretation rule. - Repository reachable ≠ metadata/trust/candidate is correct.
- Solver produces a plan ≠ installation scripts will succeed.
- Package database says installed ≠ files/config/service are operational.
- Repeated apt/dnf retry ≠ interrupted database or dependency state is repaired.
Method
Package manager problems:
| Symptom | Fix |
|---|---|
Could not get lock /var/lib/dpkg/lock | Another apt/unattended-upgrades running — wait, check ps |
dpkg was interrupted | dpkg --configure -a |
| Broken dependencies (apt) | apt -f install, check mixed repos/pinning |
| GPG key errors | Repository key rotated — import new key (signed-by keyring) |
dnf conflicts | dnf history, dnf distro-sync, module streams |
| RPM database corruption | rpm --rebuilddb |
| Repo metadata errors | dnf clean all / apt clean, proxy, mirror |
apt-cache policy nginx; apt list --upgradable
dnf repolist -v; dnf history info last
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Package Problems owns cross-layer package fault isolation; Package Management owns APT/DNF/RPM semantics and service/application branches own post-install behavior.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Linux Troubleshooting → Package Problems. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Package Problems operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Package Problems.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Package Problems isolates repository metadata/trust, candidate selection, dependency/conflict resolution, download/integrity, dpkg/RPM database, maintainer scripts and post-install service/workload effects. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin symptom + exact time + host/boot/user → define scope + expected baseline → preserve original failing test → collect targeted kernel/process/service/storage/network/security/log evidence → identify first divergent boundary → make one minimal reversible change → repeat original test → verify adjacent regressions and retain before/after evidence. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Package Problems troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux troubleshooting evidence can establish this proof path: symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host, boot, process/user, dependency, time or workload scope. Package Problems troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: reproduce the exact original failure, collect the owning subsystem evidence at the same time, change only the proven cause or prerequisite, then repeat the original workload and regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
Package Problems · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Package Problems |
|---|---|
| Topic path | Linux Troubleshooting → Package Problems |
| Runtime state | Package Problems isolates repository metadata/trust, candidate selection, dependency/conflict resolution, download/integrity, dpkg/RPM database, maintainer scripts and post-install service/workload effects. |
| Fast checks | - Capture package manager command, repositories/origins, metadata age and exact error before cleanup. - Inspect candidate/version, dependency/conflict/held state, locks and dpkg/RPM transaction/database consistency. - Review maintainer-script and filesystem/service failures separately from solver/download success. - Repair the first failed package boundary, complete/verify transaction, then repeat the original application/service acceptance test. |
| Verification chain | symptom + exact time → scope + baseline → reproduce original failure → collect first-party evidence → identify first failed boundary → minimal controlled change → repeat original test → regression/posture check Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | Package Problems troubleshooting is complete only when evidence localizes the first failed Linux boundary and the original failing workload passes after the smallest justified change; intermediate command success is not final proof. Boundary chain: repository/metadata → dependency resolution → artifact/signature → package database/file install → scriptlets → service/process reload → effective binary/config → workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |