User:Earnest/top

From ArchWiki

The goal of this document is to demonstrate a practical and directed approach to understanding pacman using common tasks and issues as a vehicle for its explanation.

Pacman Flight Rules

Flight Rules are the hard-earned body of knowledge recorded in manuals that list, step-by-step, what to do if X occurs, and why. Essentially, they are extremely detailed, scenario-specific standard operating procedures.
NASA has been capturing our missteps, disasters and solutions since the early 1960s, when Mercury-era ground teams first started gathering "lessons learned" into a compendium that now lists thousands of problematic situations, from engine failure to busted hatch handles to computer glitches, and their solutions.
— Chris Hadfield, An Astronaut's Guide to Life

Theory of Operation

There are three important relationships to keep in mind when understanding pacman, and package managers in general.

The first represents the real files on some filesystem, this is what I call our source of truth.

The second is the package managers understanding of the real filesystem, or the truth.

Lastly is the pool of files (contained in packages) that the package manager can draw upon to satisfy the users request.

Given the second point it is important to understand the relationship between what the package manager knows about and what actually exists on the filesystem because any subversion here can confound the package manager, typically resulting in errors involving some nature of files existing where the package manager wants to place them.

A suitably smart package manager could notice that if the file it's trying to overwrite is identical it can safely assume that it may overwrite it but pacman does not afford this ability.

Removal, cascading and recursive

Modal nature of pacman

Better Defaults

Make sure to uncomment VerbosePkgLists in pacman.conf to enable a more detailed view of the transaction pacman is about to undertake.

In this mode the version changes are clearly visible, whether or not they are incremental package releases or a new versions suggesting potential API or ABI changes.

Moreover any new packages or dependencies will be indicated which allows us to investigate them more directly.

Overall this output format is far more useful to those who wish to make understanding the state of a transaction.

Package (2)       Old Version  New Version  Net Change  Download Size

community/cmark                0.25.2-1       0.59 MiB       0.12 MiB
community/pandoc  1.17.0.3-1   1.17.0.3-2    -0.19 MiB       5.76 MiB

Total Download Size:    5.88 MiB
Total Installed Size:  46.65 MiB
Net Upgrade Size:       0.40 MiB

:: Proceed with installation? [Y/n]

Here we can see cmark is a new dependency as it has no Old Version. Because this format is clear we can, for example, easily inspect this new package is by using pacman -Si cmark in another terminal before agreeing to the transaction.

Rules

Unknown Trust

# pacman -Sy archlinux-keyring && pacman -Su

Invalid Signatures

"When I try to update my system or install new packages I am told that for some packages the maintainer's signatures are invalid preventing the installational from continuing. How can I check the validity and correct this situation?" — Chaerephon

Corrupted packages, change mirror

Unrecognized Databases

"Whenever I try to update my system or install new packages I am told the various sync databases are of an unrecognized archive format. What is going on?" — Alexamenus of Teos
error: could not open file /var/lib/pacman/sync/core: unrecognized archive format
$ file /var/lib/pacman/sync/core.db
core.db: HTML document, ASCII text, with very long lines

Interrupted Download

"Pacman was busy downloading the packages I had agreed to be installed but it was interrupted, what is the relationship between my local and sync databases and is it safe to restart the process?" — Aeschines of Sphettus

Interrupted Installation

"Pacman was installing files when I lost power and now my local database is in contradiction with my filesystem. How do I recover my system?" — Simon the Shoemaker

--dbonly, -Su, no -Sy

Kernel Version Remains the Same

"I have updated my Linux kernel but even after rebooting the version I end up remains the same. What is causing this?" — Phaedo of Elis

/boot not mounted during update

Ghost Files

https://bugs.archlinux.org/task/47908

Unable to Remove Package Groups

-Rdds

Exists in Filesystem

-Qo, -Qm

Notes

Explain nature of sync, download and installation in relation to partial upgrades and other important implementation details

See Also