Re: Deleted /usr directory entirely. How to salvage system?
Reply #2 –
Not that bad, I've done worse. Boot your live USB and mount the root partition to, say, /mnt.
Then reinstall all packages to your damaged filesystem, by instructing pacman to look into /mnt/var/lib/pacman/db:
# pacman -Sy -b /mnt/var/lib/pacman
# pacman -S $(pacman -Qqe -b /mnt/var/lib/pacman) -b /mnt/var/lib/pacman -r /mnt --cachedir /mnt/var/cache/pacman/pkg
# pacman -S --asdeps $(pacman -Qqd -b /mnt/var/lib/pacman) -b /mnt/var/lib/pacman -r /mnt --cachedir /mnt/var/cache/pacman/pkg
This will preserve the installation cause of your packages, i.e. first fix explicitly installed and second dependency packages. You may want to add --noconfirm and/or --overwrite='*' to the commands. The latter is untested, better run it without, it'll just take a little longer waiting for your confirmation.