Fixing Arch boot after faulty package upgrade


I've been using a derivate of Arch Linux, Antergos, for over two years now, and while I am mostly satisfied, it does happen from time to time that a faulty package upgrade crashes my system and I can't boot. So here are some instructions on how to handle that case, especially if you did not prepare your bootloader for that case.

As mentioned, I am using Antergos, and with that, I have GRUB 2 as my bootloader.

GRUB boot loader main screen

So if you have been clever, you have already setup an entry in GRUB to boot into command line mode. If you have, you can skip this paragraph. If not, in the GRUB main screen (above), select the main boot entry and press E to edit it. Then find the line loading the Kernel, append systemd.unit=multi-user.target to it and press F10 to boot the modified script (it will not be saved). If you are outside the US, mind that the keyboard layout will not match yours. Find the US keyboard layout on Wikipedia if you need to look it up.

GRUB boot loader edit screen Antergos login screen

Now, login to your computer using your usual credentials. Mind that the keyboard layout is still US and this might bring difficulties to entering your password.

You now propably want three things. First, you want to fix that keyboard layout. Then you want to find the list of packages that have been upgraded and then you want to downgrade the faulty one. Here we go.

Change keyboard layout: sudo loadkeys de-latin

See man loadkeys for help. Note that this is not setxkbmap which does not work in command line only mode.

Check pacman log to find the list of upgraded packages: sudo tail /var/log/pacman.log -n 300 | less

Adjust the number if you get too many or too few entries. The entries have timestamps. You can use cat and grep instead to filter for a date if the upgrade was not recently.

Pacman logs

Now find the suspicious package. The log will show you the old and new version, you need this later. This time, I had a weird red screen when booting, and the only upgraded package that was somehow related to graphics was the Kernel, so I downgraded the Kernel. Other times, I got some error messages and had to look them up to see what packages might be related and usually I found one of the related packages in the list of upgraded ones.

Finally, sudo pacman -U /var/cache/pacman/pkg/name-of-package-1.9.tar.gz, with the name of the package from the log and also the version that was previously installed, will hopefully fix your problem. sudo shutdown -r now to reboot and good luck. :-)