Skip to content
LatchkeyLatchkey home

pacman -Syu: Sync and Upgrade Arch Safely

pacman -Syu refreshes the package database and upgrades every installed package in one step, the supported way to update Arch.

Arch is rolling-release, so mixing an old system with new packages (a partial upgrade) is unsupported. -Syu keeps the system consistent.

What it does

pacman -Syu syncs the package database (-y) and then upgrades all packages to the newest version (-u). Doing both together avoids partial upgrades, where a freshly synced database is used to install a package against an un-upgraded system.

Common usage

Terminal
pacman -Syu --noconfirm
# refresh keyring before a big upgrade in a stale image
pacman -Sy --noconfirm archlinux-keyring && pacman -Su --noconfirm

Options

FlagWhat it does
-SyuRefresh database and upgrade all packages
--noconfirmDo not prompt for confirmation
-SyyuForce-refresh the database, then upgrade
-uUpgrade installed packages (without a fresh sync)
-yRefresh the package database only

In CI

Never run pacman -Sy <pkg> to install a single package on a stale image; that is a partial upgrade and can pull in a library newer than the rest of the system. Use pacman -Syu to update fully, or pacman -S with a recently synced but not upgraded system only for short-lived containers.

Common errors in CI

"error: failed to commit transaction (invalid or corrupted package)" during upgrade usually means an outdated keyring; update archlinux-keyring first. "warning: <pkg>: local (X) is newer than core (Y)" indicates the mirror is behind. "unable to lock database" means a stale /var/lib/pacman/db.lck; delete it. A partial upgrade often surfaces later as a missing shared library.

Using this in CI

A runner shell is not a login shell. It does not read your dotfiles, it usually has no TTY, and by default it does not stop on the first error, so a failing command in the middle of a multi-line run block can leave the job green.

.github/workflows/ci.yml
# make the shell behave the way you assume it does
- name: Build
  shell: bash
  run: |
    set -euo pipefail    # exit on error, undefined vars, and pipeline failures
    ./do-the-thing | tee out.log

Frequently asked questions

pacman -Syu: Sync and Upgrade Arch Safely?
Arch is rolling-release, so mixing an old system with new packages (a partial upgrade) is unsupported. -Syu keeps the system consistent.
What it does?
pacman -Syu syncs the package database (-y) and then upgrades all packages to the newest version (-u). Doing both together avoids partial upgrades, where a freshly synced database is used to install a package against an un-upgraded system.
In CI?
Never run pacman -Sy <pkg> to install a single package on a stale image; that is a partial upgrade and can pull in a library newer than the rest of the system. Use pacman -Syu to update fully, or pacman -S with a recently synced but not upgraded system only for short-lived containers.
Common errors in CI?
"error: failed to commit transaction (invalid or corrupted package)" during upgrade usually means an outdated keyring; update archlinux-keyring first. "warning: <pkg>: local (X) is newer than core (Y)" indicates the mirror is behind. "unable to lock database" means a stale /var/lib/pacman/db.lck; delete it.

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card