Pacman: Reinstall All Script

If your Arch Linux (or any other Linux using the package manager pacman) has some serious issues and you cannot find the cause, or it would be tedious to find it you can simply reinstall each and every package. This helped me several times recovering from otherwise very annoying problems. One of these situations was my computer freezing while running an update.

So here’s the script (download link in the sidebar) and don’t forget chmod +x ./reinstallAll.sh before using it:

pacman -Q | awk '{ print $1 }' > installed.tmp
for i in $(pacman -Qm | awk '{ print $1 }'); do
    cat installed.tmp | sed "s/^$i\$//;" > installed.tmp.1
    mv installed.tmp.1 installed.tmp
done
pacman -S --noconfirm `cat installed.tmp` --force
rm installed.tmp

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove, that you are human! *