How to fix error: failed to synchronize all databases on Manjaro

Normally I update my system when there is a notification about updates. But for some time I did not get any notification. Firefox was stuck at 105 version and so was KDE plasma at 5.25.x. I was curious and ran sudo pacman -Syu and got an error, error: failed to synchronize all databases. If you have the encountered the same error, read on how to fix it easily on your Manjaro system.

Before running some commands, let me share the exact error message.

error: failed to synchronize all databases (no servers configured for repository)

Manjaro-pacman-update-command

Upon investigating, I found that my mirrors file is empty. It was Strange.

cat /etc/pacman.d/mirrorlist
Manjaro-mirrors-list-before

To fix that, it is recommended to run the following command 1st.

sudo pacman-mirrors -f

This will filter all the mirrors and update /etc/pacman.d/mirrorlist based on the ping to the server, which could be also the nearest zone to you.

Now check again if the mirrors are updated.

cat /etc/pacman.d/mirrorlist
Manjaro-mirrors-list-after

Now you can safely run the update command.

sudo pacman -Syu

Clear cache?

That’s not required, but if you would like to do that. Run the following command.

sudo pacman -Scc

Dependency issue?

If you get a dependency issue for a package, you can remove that package and install it later on.

sudo pacman -R PACKAGE_NAME

If you are still stuck somewhere, checkout the Manjaro forum.