Recovering from a broken pacman -Syu

arch / published / guide #46 / ≈ 4 min read

It happens. You ran sudo pacman -Syu, walked away, came back, and the system won't boot — or boots but key things are broken. This guide is the calm, ordered playbook: don't panic, work through these steps in order, and you'll be back in fifteen minutes.

This guide doesn't cover everything that could go wrong. It covers the four scenarios that account for the vast majority of "Arch broke" stories.

The triage tree

  1. Did pacman finish, or did it die mid-run? → "Interrupted upgrade" section.
  2. Does the system boot but a critical thing (network, X, sound) doesn't work? → "Broken after boot" section.
  3. Does it boot to GRUB then crash / kernel panic? → "Bad kernel / initramfs" section.
  4. Does it not boot at all (no GRUB menu, no anything)? → "Bootloader gone" section.

Scenario 1: pacman was interrupted

Power cut, you hit Ctrl-C, the laptop went to sleep — pacman didn't finish. You boot back up and the next pacman call complains: "unable to lock database: /var/lib/pacman/db.lck."

The lock file is a stale leftover. If pacman is genuinely not running anywhere, remove it:

ps aux | grep -i pacman      # make sure pacman isn't actually running
sudo rm /var/lib/pacman/db.lck

Then re-run the upgrade. Pacman is transactional — it'll either complete what was started or roll back.

sudo pacman -Syu

Scenario 2: it boots, but something specific is broken

The system's alive — you're reading this in a browser, probably — but a service won't start, or a program crashes, or sound is gone.

First check: the news

Every few months Arch publishes a "manual intervention required" notice. Go to archlinux.org/news and skim the last few items. If there's one matching your timing, it'll tell you exactly what to do.

Second check: what changed?

tail -50 /var/log/pacman.log

Every package install / upgrade / removal is logged here with timestamps. Find your last upgrade — the list of [ALPM] UPGRADE lines is what just happened.

Third check: pacnew files

When pacman would overwrite a config file you've edited, it saves the new one alongside with a .pacnew extension. Your old config keeps running; the program may not be using new features it depends on.

sudo find /etc -name "*.pacnew"

For each, open the file and its non-pacnew sibling side by side, merge changes by hand. Tool: pacdiff (from the pacman-contrib package) walks you through them:

sudo pacman -S pacman-contrib
sudo DIFFPROG=meld pacdiff           # or vimdiff, kdiff3, …

Fourth check: roll back the offending package

If you can identify which package broke things and you have paccache kept versions:

sudo pacman -U /var/cache/pacman/pkg/<the-old-version>.pkg.tar.zst

Pacman keeps cached copies until you run pacman -Sc. List them:

ls /var/cache/pacman/pkg/ | grep packagename

Scenario 3: kernel panic or "can't find root device"

You see GRUB, pick Arch, and within seconds you're staring at a kernel panic or "ALERT! UUID=… does not exist." The new kernel or initramfs is bad.

Fix A: boot the fallback kernel

Arch installs both initramfs-linux.img and initramfs-linux-fallback.img. GRUB's "Advanced options" submenu lists both. The fallback initramfs is a fat, generic one that includes basically every driver — slower to boot but almost always works.

Pick it, get into the system, then rebuild the main initramfs:

sudo mkinitcpio -P

Reboot, try the main entry.

Fix B: roll back the kernel

If even the fallback panics, the kernel itself is the problem.

Boot from an Arch live USB, mount your system, chroot in, downgrade:

mount /dev/sdaROOT /mnt
mount /dev/sdaESP  /mnt/boot
arch-chroot /mnt

ls /var/cache/pacman/pkg/ | grep ^linux-
pacman -U /var/cache/pacman/pkg/linux-OLDVERSION.pkg.tar.zst
mkinitcpio -P
exit
reboot

Scenario 4: bootloader is gone

You don't even see the GRUB menu. Black screen, or straight to firmware menu.

Boot live USB, chroot, reinstall the bootloader:

mount /dev/sdaROOT /mnt
mount /dev/sdaESP  /mnt/boot
arch-chroot /mnt

# UEFI + GRUB:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

# BIOS + GRUB:
grub-install --target=i386-pc /dev/sda          # NOT /dev/sda1
grub-mkconfig -o /boot/grub/grub.cfg

# systemd-boot:
bootctl install

exit
reboot

See the systemd-boot vs GRUB guide for which one your system uses.

The two preventive habits

  1. Keep paccache -rk2 running. Set up a systemd timer to keep the two most recent cached versions of each package. Then "roll back one" is always possible.
    sudo pacman -S pacman-contrib
    sudo systemctl enable --now paccache.timer
  2. Use snapshots. If you're on btrfs, snapper + snap-pac takes a snapshot before every pacman run. See the btrfs snapshots with snapper guide. With this in place, "this upgrade broke everything" is a 30-second rollback.

What to do in the moment

Read the error. Most "broken" systems are talking to you — they're telling you which file is wrong, which kernel can't find which UUID, which service failed. Take it slow, don't reflexively retry — the Arch news might already have your answer.

← back to index