Fixing Mirror List Error in Arch and Manjaro

Linux TLDR
Last Updated:
Reading time: 3 minutes
πŸš€
Quick Overview

If you’re in a rush and want to fix this problem quickly, just run the below command:

$ sudo pacman-mirrors --continent
$ sudo pacman -Sy

However, I recommend you read the entire article to understand the main reason for this issue and become an informed Linux user.

Are you experiencing SSL certificate issues when trying to retrieve β€œcore.dbβ€œ, β€œextra.dbβ€œ, and β€œcommunity.db” from the mirror list in your Arch or Manjaro-based distribution?

mirror list error in arch

Before providing the solution, allow me to explain the root cause of the issue you encountered.

  • Internet connection and DNS issues
  • Faulty or slow mirrors

While there could be various factors at play, these two stand out as the most prevalent. Among them, the second issue (faulty or sluggish mirrors) is the primary culprit in almost all cases.

The Arch or Manjaro-based distributions maintain a mirror list, typically located at β€œ/etc/pacman.d/mirrorlistβ€œ, which serves as a source for fetching package information.

You can conveniently access and read this file using the cat command.

$ cat /etc/pacman.d/mirrorlist

Output:

Arch and manjaro mirror list

In the image above, you’ll immediately spot three mirrors stored in my β€œmirrorlist” file, all added by default.

While the mirror list generally functions seamlessly, it’s important to note that due to the rolling distribution nature of Arch and Manjaro, unexpected interruptions in the mirror list can occur.

If you’re a Linux user who is facing this issue, take immediate action by following these methods to effectively resolve the problem.

Solution 1: Updating the Mirror List

The most straightforward solution to address this error is by executing one of the following commands, which updates your system mirror list:

#Add almost all the mirrors closest to your location
$ sudo pacman-mirrors --continent

#OR

#Add the three fastest mirrors closest to your location
$ sudo pacman -f3

Output:

Updating the arch and manjaro mirror list

When you are done, execute the following command to ensure the issue is resolved:

$ sudo pacman -Sy

Output:

Executing the pacman update command

You can verify and inspect the newly added mirrors by examining your β€œmirrorlist” file.

$ pacman-mirrors

#OR

$ cat /etc/pacman.d/mirrorlist

Output:

checking the newly added mirror list using single command

Solution 2: Manually Updating the Mirror List

In the previous solution, the β€œpacman-mirrors” command automated most of the work, but it can also be performed manually.

To manually update the mirror list, follow these steps one-by-one:

1. Before proceeding, it’s a good idea to create a backup of your existing mirror list:

$ sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

Output:

Backup the mirrorlist before any manual modification

2. Visit the official β€œPacman Mirrorlist Generator” page to obtain your preferred mirrors.

Manually generating mirrors list from pacman site

3. After choosing your country, protocol, and clicking β€œGenerate List”, you’ll be redirected to a page that looks like the one below.

Gathering the mirror list

4. Finally, open your β€œmirrorlist” file with your preferred text editor, delete the current mirrors, and replace them with the copied ones above. Remember to remove β€œ#” in front of mirrors and choose your favorite one to paste instead of using all of them.

$ sudo vim /etc/pacman.d/mirrorlist

Output:

Manually updating the arch mirrorlist with custom location

5. Save, close the β€œmirrorlist” file, then ensure everything is working perfectly by running:

$ sudo pacman -Sy

Output:

Updating the system package to ensure mirrorlist functionality

Solution 3: Updating the Mirror List via Reflector

Reflector is a handy tool in Arch and Manjaro-based Linux distributions that can help you easily find the fastest and most up-to-date mirrors for your system.

To install and configure it on your system, simply follow the below steps.

1. Open your terminal and run the following command to install β€œreflectorβ€œ:

πŸ“
During installation, if you have an existing β€œpacman-mirrors” installation, you may be prompted to remove it to prevent conflicts. Just type β€œy” for yes when prompted or forcefully remove it using the β€œsudo pacman -Rdd --noconfirm pacman-mirrors” command (not recommended).
$ sudo pacman -S reflector

Output:

Installing reflector on arch list

2. Before proceeding, it’s a good idea to create a backup of your existing mirror list:

$ sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

Output:

Backup the mirrorlist before any modification

3. After installing the β€œreflectorβ€œ, you can easily generate a new mirror list, sorted by download speed, and save it to your β€œmirrorlist” file. Here’s an illustrative example:

πŸ“
During execution, you may encounter a warning. Simply ignore it. If any errors arise, simply reboot your system.
$ sudo reflector --latest 10 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

Output:

Updating the arch mirror list using reflector

The above command breakdown is:

  • The β€œ--latest 10” will fetch the 10 recently synchronized servers.
  • The β€œ--protocol https” will retrieve HTTPS-enabled mirrors.
  • The β€œ--sort rate” will sort them by download speed.
  • Lastly, the result will be saved to β€œ--save /etc/pacman.d/mirrorlistβ€œ.

4. To verify the new mirrors are added to your β€œmirrorlist” file, run:

$ cat /etc/pacman.d/mirrorlist

Output:

Checking the mirrorlist file after updating it using reflector

5. Finally, update the mirror database to start using the new mirrors:

$ sudo pacman -Sy

Output:

Updating the pacman database

Final Word

I hope you find this article useful. If you have any questions or are stuck somewhere, then do let us know via the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.