APT
Cheat sheet · https://pcornel.dk/topic.php?topic=2739
Answer
APT (apt, apt-get, apt-cache) downloads packages from repositories, resolves dependencies and calls dpkg to install them.
Remember
apt-mark showhold lists held packages. "Could not get lock" means another apt (often unattended-upgrades) is running — wait, don't delete the lock. Use apt -s to simulate.
First checks
dpkg --audit— half-installed or unconfigured packagesapt policy <pkg> / dnf info <pkg>— installed and candidate versionsdpkg -l <pkg> / rpm -q <pkg>— installed packageapt-cache depends <pkg> / dnf repoquery --requires <pkg>— dependenciesdpkg -S <file> / rpm -qf <file>— package owning a file
Verify in this order
apt reads indexes → resolves dependencies → downloads .debs → dpkg installs → triggers run
Where it usually breaks
First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2739