OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
pacman-aur critical occasional DISPUTE

Recover a system left unbootable by an interrupted pacman upgrade

archomarchyendeavouroscachyosmanjarodesktoplaptopsystemd-bootgrub
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

Mostly sound: pacman-static, the chroot, and replaying the interrupted transaction from the log (the cut -d ' ' -f4 does land on the package name given pacman's log format) are all correct. Two problems. First, the fallback pacman --root=/mnt --cachedir=... -Syu omits --dbpath: whether that operates on /mnt's database or the live ISO's depends on whether DBPath is commented out in the ISO's pacman.conf, and if it resolves to the ISO's database pacman will make decisions from the wrong package set. Always pass --dbpath explicitly. Second, it says to rebuild 'initramfs and bootloader entries' but gives no bootloader command, which on an unbootable machine is the step that matters, and the root-run pacman-static should be signature-verified.

The cause above was not rewritten and may still contain the error described. The fix below is the corrected version.
RISK

Manually extracting package tarballs over / with tar is the last-resort option in the wiki and the wiki itself warns it is extremely easy to make things worse. Always use the w (interactive) flag and extract dependencies in order. Never symlink /var/cache/pacman/pkg. Use the CacheDir option in pacman.conf or a bind mount instead. Back up /var/lib/pacman before any repair attempt.

Symptom

Power was lost, the machine froze, or the terminal was killed in the middle of pacman -Syu. Now the system will not boot, or it boots but pacman itself is broken: pacman: command not found, or pacman: error while loading shared libraries: libalpm.so.16.

Cause

pacman was midway through replacing files. Half the transaction is on disk, the database is inconsistent, and if pacman's own libraries or binary were in flight, there is no working tool left to repair with. Symlinking /var/cache/pacman/pkg (which pacman recreates as a directory during self-upgrade) is a known way to trigger the pacman: command not found variant.

Fix

**If the system still boots:** pacman-static is statically linked and works with a broken library set. Verify it before running it as root:


curl -LO https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static
curl -LO https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static.sig
gpg --verify pacman-static.sig pacman-static
chmod +x pacman-static
sudo ./pacman-static -Syu pacman
sudo pacman -Syu

**If it does not boot:** boot the Arch install ISO, mount and chroot (arch-chroot, not --root):


lsblk -f
sudo mount /dev/nvme0n1p2 /mnt
sudo mount /dev/nvme0n1p1 /mnt/boot     # your ESP
sudo arch-chroot /mnt

Inside the chroot, replay the exact package set from the interrupted transaction so the right hooks and scriptlets run. Find the timestamp of the failed run and substitute it:


tail -50 /var/log/pacman.log
pacman -Syu $(grep "\[2026-08-20T09.*\] \[ALPM\] upgraded" /var/log/pacman.log | cut -d ' ' -f4 | tr '\n' ' ')

Then rebuild the initramfs **and** the bootloader before rebooting. Use the one your system actually has:


mkinitcpio -P
grub-mkconfig -o /boot/grub/grub.cfg     # GRUB
# systemd-boot:  bootctl update
# Omarchy/limine: limine-update
exit
sudo umount -R /mnt
reboot

Only if pacman cannot run inside the chroot at all, drive it from outside, and pass **both** --root and --dbpath, otherwise pacman may operate against the live ISO's database instead of the installed system's:


sudo pacman --root=/mnt --dbpath=/mnt/var/lib/pacman \
            --cachedir=/mnt/var/cache/pacman/pkg -Syu

Check for zero-length (truncated) libraries left behind and reinstall whatever owns them:


find /mnt/usr/lib -size 0

Verify

The system boots to a login/greeter, pacman -Syu reports nothing to do, and sudo pacman -Qkk $(pacman -Qsq) | grep -v ' 0 altered files' produces no library-related output.

Sources

interrupted-upgrade-unbootable-pacman-broken