Fixing Archlinux after pacman –force

Hey there,

Archlinux is an awesome Linux distro, but as everything, it can be put into inconsistent state by misuse of –force flag in Arch package manager, pacman.

Case

After trying to upgrade i received error, that some files were already existing in filesystem – it usually is a sign that your system has not been upgraded for quite a long time, since packages contents changed this much.

I thought I would be smarter than pacman and ran it with –force. After that some dependencies could not be resolved and whole system became unusable.

Solution

  1. Download ArchLinux ISO and write it to USB drive
  2. Boot Arch from pendrive
  3. (optional) If your root partition is encrypted, run:
    # cryptsetup luksOpen /dev/sda2 myroot
    Enter passphrase for /dev/sda2:  ********
  4. Mount your root partition
    # mount /dev/sda2 /mnt

    or, if your root partition is encrypted:

    # mount /dev/mapper/myroot /mnt
  5. Run pacman with switches:
    -r /mnt – to change root of Arch installation
    –cachedir /mnt/var/cache/pacman/pkg – to change folder, where packages will be downloaded
    -b /mnt/var/lib/pacman – to change pacman’s database location
    –force – well 😉

    # pacman -Syyu -r /mnt --cachedir /mnt/var/cache/pacman/pkg -b /mnt/var/lib/pacman --force

     

  6. Wait for pacman to complete and restart your PC