Pacman fails to update system or install a package

Did you get a fresh mirrorlist?
If so, try:

sudo pacman-db-upgrade

sudo rm -r /var/lib/pacman/sync/

sudo pacman -Scc

sudo pacman -Syyu

In case of failure, have a look at this solved thread with similar issue and see if there are other suggestions to try: