Skip to the content
pacman-master.com

pacman -Syu: updating Arch Linux

To update Arch Linux, run sudo pacman -Syu. That single command is the supported way to upgrade, and running it is one transaction: the databases are refreshed and the packages are upgraded together.

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 every package database, then upgrade every installed package that is out of date, in one transaction.

Watch out. Arch expects the whole system to move together: upgrading one package without the rest is the failure mode this command exists to avoid.

Step by step

  1. Refresh and upgrade in one command

    Run the whole upgrade as a single transaction rather than refreshing first and upgrading later.

    routinesudo pacman -Syu
  2. Read the list before you answer

    pacman prints the packages it will install, remove or replace, along with the download and installed size, and waits for an answer. This is the moment to notice a package being removed that you did not expect.

  3. Reboot if the kernel package changed

    Kernel modules are stored per kernel version, so once the kernel package has been replaced the running kernel no longer has matching modules on disk. Anything that loads a module after that point fails until the machine has rebooted.

What each letter does

Three characters, three separate jobs, and they act in three different places:

How a pacman upgrade moves between three placesThree stacked boxes. The mirrors at the top hold the repository databases and the package files. An arrow marked -Sy copies those databases into /var/lib/pacman/sync on this machine. A second arrow marked -Su brings the installed packages recorded in /var/lib/pacman/local up to what that copy says. A line down the right marked -Syu joins both arrows into one command. At the foot, sudo pacman -Syu is set against sudo pacman -Sy firefox, each with the level the explainer gives it.the mirrorsrepository databases and the package files-Sycopy the databases down/var/lib/pacman/syncthis machine's copy of those databases-Subring the packages up to it/var/lib/pacman/localthe record of what is installed-Syuone step,then the othersudo pacman -Syuroutinesudo pacman -Sy firefoxriskyagainst
The refresh and the upgrade are two different steps. Writing -Sy takes the first one and stops there.
PartLong formWhat it does on its own
-S--syncThe synchronise operation: work against the repositories
y--refreshDownload the package databases again from the mirrors
u--sysupgradeUpgrade every installed package that is older than the repository version

Only u upgrades anything. y on its own downloads a newer description of what the repositories contain and stops there, which is exactly where the trouble starts.

Why a bare -Sy is the famous trap

This is the single most repeated warning about pacman, and the partial upgrade page takes it apart in full.

A partial upgrade is a system where the package databases describe new versions but most installed packages are still at their old versions, so a package installed afterwards is built against libraries the machine does not have.

After -Sy, the next -S <package> installs the new version of a package, which expects the new versions of its dependencies — and those are still sitting at the old version on disk. The installed program then fails to start, usually complaining about a missing library file.

Do not refresh without upgrading. sudo pacman -Sy <package> is the shortest way to a partial upgrade. If you want one package, run sudo pacman -Syu <package> and take the whole upgrade with it.

When a doubled letter is needed

Repeating a letter changes it, and two of those repeats show up in real upgrades:

CommandWhat the repeat addsWhen it is needed
sudo pacman -SyyuRefresh the databases even when they look up to date alreadyAfter changing the mirrorlist, because the new mirror's database can be older than the one already on disk and would otherwise be skipped
sudo pacman -SyuuAllow a package to be replaced by an older version from the repositoryWhen a package on the machine is newer than anything the repositories carry, for example after a repository was disabled

-Syuu moves packages backwards. Going backwards is not an upgrade path the distribution supports, and it can leave two packages expecting different versions of the same library.

Holding a package back

Excluding a package from an upgrade is possible, and worth knowing mostly so that you recognise what it costs. The holding a package back page covers the standing form of it in pacman.conf:

cautionsudo pacman -Syu --ignore <package>

Everything else moves forward and the named package does not, which is a partial upgrade you have chosen deliberately.

Common questions

How do I update Arch Linux?

Run sudo pacman -Syu. That refreshes the package databases from the mirrors and upgrades every installed package that is out of date, in one transaction.

What does pacman -Syu do?

-S is the synchronise operation, y refreshes the package databases from the mirrors, and u upgrades every installed package that is older than the version the refreshed databases describe.

Is pacman -Sy safe?

On its own it only rewrites the package databases, but it leaves the machine describing new versions while still running old ones. Anything installed after that point pulls in a new package against old dependencies, which is the partial upgrade that breaks programs. Use -Syu instead.

What is the difference between -Syu and -Syyu?

The doubled y forces the databases to be downloaded again even when pacman considers them current. It is needed after switching mirrors, because the new mirror may carry a database that is older than the one already on disk.

How to check this page

Two commands on your own machine: pacman -<operation> --help lists the modifiers that operation accepts, and man pacman opens the pacman(8) manual page these descriptions are written from. Where the descriptions come from, and what this site is not, is set out on the about page.

This page was last edited on .