Recovering from a pacman crash on arch Linux

During a rolling upgrade of my arch system to the 6.7.1 kernel, pacman ended abruptly leaving its file lock around. Worse still, sudo no longer worked and I couldn't switch to another TTY to log in again. It may have been a bad decision, but I tried rebooting and arch would not boot.

(You may be interested in the distro-hopping journey that led me to arch.)

Booting successfully

After deleting the lock file, I followed the instructions Pacman crashes during an upgrade and mounted my main partition,/proc, /sys, and /dev:

# mount /dev/sda2 /mnt
# mount -t proc proc /mnt/proc; mount --rbind /sys /mnt/sys; mount --rbind /dev /mnt/dev

I then started a chroot of the main partition, mounted the boot partition, and reinstalled linux:

# arch-chroot /mnt
# mount /dev/sda1 /boot
# pacman -S linux --overwrite '*'`

After that arch booted ok, but startx failed with a stack trace and the message “Caught signal 7 (Bus error). Server aborting”.

Fixing startx

I reinstalled all the native packages as per tips and tricks:

# pacman -Qqn | pacman -S -

After another reboot, startx worked again.

Disabling the fallback image

I also wanted to avoid possible issues of the boot partition running out of space, so I followed the instructions in mkinitcpio Configuration, to disable the fallback image by changing a line in the .preset file in /etc/mkinitcpio.d/ from:

PRESETS=('default' 'fallback')

to:

 PRESETS=('default')

I also deleted the old fallback image from the boot partition.

After doing this, no fallback image was generated when installing or upgrading the linux package.

Belt and braces

I followed a suggestion and installed doas so I have another privilege escalation method if sudo stops working again in the future. However, I didn't follow the suggestion of installing pacman-static, since pacman itself continued to be operable in the above scenario, even if the state of installed packages needed fixing.

Conclusion

This is the second successive failure in a rolling upgrade in 6 months of successful rolling upgrades after switching to arch. I'm hoping it is a rare occurrence, but at least I'm better prepared next time I hit such a failure.

Update

Thankfully the next rolling update to the 6.7.2 kernel was as smooth as ever, so the current run of failures is over.

#ArchLinux

[ favicon | about | blogroll | contact | now | popular | subscribe | feed icon ]