Partial upgrades: what a bare -Sy leaves behind
A partial upgrade is not a command you can run. It is a state: the package databases on the machine describe one set of versions and the packages on disk are at another, so anything installed next is fitted to a system that is not there.
sudo pacman -Syu
-S- --sync — install packages from the repositories and upgrade the system
-y- --refresh — refresh the package databases from the mirrors
-u- --sysupgrade — upgrade every installed package that is out of date
Needs root.
What it does. Refresh the databases and upgrade the packages in the same transaction, which is what keeps the two descriptions of the system in step.
Watch out. A machine already in a partial state is repaired by the same command, as long as the mirror it reads carries the versions the databases name.
How the two descriptions come apart
pacman keeps two separate records. The synchronised databases under
/var/lib/pacman/sync describe what the repositories currently carry.
The local database under /var/lib/pacman/local records what is
actually installed. -Sy refreshes the first. -Su moves the second up to it. They
are different jobs, and -Syu is the spelling that does both.
Four ways to end up in one
| What was run | Why it leaves a gap | Level |
|---|---|---|
sudo pacman -Sy <package> | The databases move forward, the packages do not, and the package that arrives is the new one | risky |
sudo pacman -Syu --ignore <package> | Everything else moves and the named package stays behind, linked against libraries that have just been replaced | caution |
sudo pacman -S <package> long after the last upgrade | The databases were refreshed by something else at some point, so an install pulls in dependencies newer than the rest of the machine | routine |
| An interrupted upgrade | Part of the transaction was written and the rest was not, so the two records disagree about the packages that did not finish | routine |
The third row is the one that catches people who install a package after weeks without an upgrade. The install itself is ordinary; what makes it a partial upgrade is that its dependencies are resolved against a database describing a system nobody has moved to yet.
What it looks like when it bites
The usual shape is a program that stops starting and names a library file it cannot find, or names a version of one. Another shape is pacman itself refusing to prepare a transaction because a dependency cannot be satisfied. Both are the same thing said twice: something on disk was built against a version that is not on disk.
error: failed to prepare transaction (could not satisfy dependencies)The shape of the message, not a transcript. The line after it names the package that breaks and the version it wants.
Getting out of one
The repair is the upgrade that was skipped. Run it in full:
sudo pacman -SyuIf a mirror is behind and does not yet carry the versions the databases name, force the databases to be fetched again so that both come from the same place:
sudo pacman -SyyuThe doubled y downloads the databases again even when pacman considers them current, which is what gets past a database cached from a stale mirror.
A machine that cannot reach a mirror is a different problem; the mirrorlist page covers that. A machine where the signature check refuses the downloaded packages is covered on the keyring page, and that one has a twist: the usual advice for it starts with a command this reference marks as risky.
Staying out of one
- Type
-Syu, not-Sy. The habit is the whole defence. - Take the upgrade before the install, not after:
sudo pacman -Syu <package>puts both in one transaction. - Treat holding a package back as a partial upgrade you chose, and keep the list short and temporary.
- If an upgrade is interrupted, finish it before installing anything else.
Common questions
What is a partial upgrade on Arch Linux?
It is a machine whose package databases describe newer versions than the packages installed on disk. Anything installed in that state is resolved against versions the machine does not have, so it can start against a library that is not there.
Is pacman -Sy dangerous on its own?
It rewrites the package databases and nothing else, so on its own nothing breaks. The damage comes from the next install, which is fitted to the versions those refreshed databases describe rather than to the ones on disk.
How do I fix a partial upgrade?
Run sudo pacman -Syu, which is the upgrade that was skipped. If a mirror is behind and does not carry the versions the databases name, run sudo pacman -Syyu so that the databases are fetched again rather than reused.
Can I install one package without upgrading the system?
Not without leaving the machine in a partial state. Writing sudo pacman -Syu followed by the package name puts the upgrade and the install in one transaction, which is the supported way to get that one package.