How to choose a particular mirror by URL?

The output of my sudo pacman-mirrors --fasttrack 5 looks like this:

[luna@jar-m ~]$ sudo pacman-mirrors --fasttrack 5
[sudo] password for luna: 
::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool:
::INFO => Mirror status:
::INFO Using default mirror file
::INFO Querying mirrors - This may take some time
  1.430 United_States  :
  3.745 Brazil         :
  0.253 Global         :
  2.600 Turkey         :
  ..... Brazil         :
::INFO Writing mirror list
::Global          :
::United_States   :
::Turkey          :
::Brazil          :
::Brazil          :
::INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
[luna@jar-m ~]$ 

That means the “3.745 Brazil” item is the fastest?

At this point, what is the command for

  1. Choosing 3.745 Brazil
  2. Confirming that “choosing 3.745 Brazil” worked and that I am now set to use 3.745 Brazil when I do sudo pacman -Syu?

Thanks. (I did a reasonable amount of search through the forum and Internet and could not find the answer.)

Please do not provide screenshots of text. Copy paste the text and use the code formatting option in the topic editor </>

man pacman-mirrors
  1. The one-off method is to use the –api --url arguments. When the pamac-mirrorlist.timer triggers - the mirrorlist is reset.

  2. You can create a custom mirrorpool with only one mirror using the -i/–interactive argument, then select the desired mirror. The choice will never change - unless you reset the custom mirrorpool.

  3. Finally you can become your own mirror provider by setting a static mirror in pacman-mirrors.conf.

Each method has pro’s and con’s - you will have to weigh the options an decide what serves your system best.

1 Like

When I did that, this site truncated the URL to some kind of shorthand, the same for all 5 URLs.

Thank you for the three options. I will study them.

when posting the output of pacman-mirrors inside a code block (the set of 2x3 backticks) it looks like

 $ sudo pacman-mirrors -c de
::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool:
::INFO => Mirror status:
::INFO User generated mirror list
::INFO Custom mirror file saved: /var/lib/pacman-mirrors/custom-mirrors.json
::INFO Using custom mirror file
::INFO Querying mirrors - This may take some time
  0.172 Germany        :
  0.121 Germany        :
::INFO Writing mirror list
::Germany         :$repo/$arch
::Germany         :$repo/$arch
::INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
::INFO To reset custom mirrorlist 'sudo pacman-mirrors -id'
::INFO To remove custom config run  'sudo pacman-mirrors -c all'

There is more to it - please see the documentation - to learn how pacman-mirrors can use arguments and filters to create a mirrorpool and subsequently the mirrorlist.

Sorry. I used the block quote (>). ‘Preformatted text’ is of course something else. I’ll keep that in mind.

1 Like

You can also setup the mirrorlist manunally.

And then add /stable/$repo/$arch/.

Here is my mirrorlist:

## Manjaro Linux default mirrorlist
## Generated on 2023-05-22 16:47
## Please use 'pacman-mirrors -f [NUMBER] [NUMBER]' to modify mirrorlist
## (Use 0 for all mirrors)

#Country : Germany
Server =$repo/$arch

## Country : Germany
Server =$repo/$arch

That means that Germany was the fastest only when you performed that command. That can change at any time, and another mirror might then be the fastest next time you use the command.

Choosing a specific mirror will not necessarily be the best course of action.

Just something to consider. Cheers.

For example, like this?

  1. Run sudo pacman-mirrors --fasttrack > choose the fastest 4 or 5
  2. Run sudo nano /etc/pacman.d/mirrorlist > populate the list with the chosen 4 or 5

Or how else would you do it “manually”?

Manually editing the mirrorlist is possible - but next time the pamac-mirrorlist.timer trigger - the list is rewritten.

Your topic title How to choose a particular mirror by URL is implying your are using pacman-mirrors.

The documentation states

  • I want to choose my mirrors

    sudo pacman-mirrors --interactive
  • I have a custom mirror list and I want to create a new custom mirror list?

    sudo pacman-mirrors --interactive --default
  • I have a custom mirror list - can I reset it?

    sudo pacman-mirrors --country all

data/docs/ · master · Applications / pacman-mirrors · GitLab

So a command like this - will provide a tool window with selection list of URLs for servers in Germany

sudo pacman-mirrors -c Germany -i

Tick the box for the server(s) and apply the changes.

If you rather select the mirrors in terminal - you add the -fc argument to above

sudo pacman-mirrors -c Germany -i -fc

Thank you again. That’s very convenient. Some questions.

Does that statement not apply to a mirrorlist compiled by the command with -interactive? I.e. does a list so created persist?

  1. When I choose from a popup list, should I just go for the largest number?

  2. If my mirrorlist has 5 servers listed, how does a particular update session choose which of the five?

The mirrorlist is parsed from top to bottom

Is just as volatile as any mirrorlist.

The command creates a custom mirror pool - limited to the servers selected - but pamac-mirrorlist.timer will still shuffle the pool and write a new list when triggered.

  • a mirror pool is not the same as a mirror list

The mirror list contains elements from the pool depending on the sync status for the system branch.

The mirror list may be identical to the pool if the pool only contains one mirror.

When or by what does it get triggered?

If I once compile a mirrorlist and run no command other than pacman-mirrors itself (i.e. no options), will I avoid triggering it?

The ultimate aim here is to compile a good list and keep it. Thanks.

systemctl list-timers

Locate a mirror which provides reliable timely sync and use that single mirror.


There is other methods - I won’t recommend using those unless you have read the pacman manual and documentation.

You are the system admin - and thus realize your fellow forum mebers cannot help you when you run into issues - as a suggestion to refresh the mirrorlist will have no effect when you change the default configuration in such manner.

Part of /etc/pacman.conf

#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.

Include = /etc/pacman.d/mirrorlist

The comments indicates that you can provide a specific mirrorlist e.g. /etc/pacman.d/my-mirrorlist.

#Include = /etc/pacman.d/mirrorlist
Include = /etc/pacman.d/my-mirrorlist

The last time I checked it was every Thursday. It’s a systemd timer.

No, but you can disable it:

sudo systemctl disable --now pamac-mirrorlist.timer

That’s good to know. Thank you.

But if it runs every Thursday by default, wouldn’t that be for a reason?

What is the downside to disabling it?

If the downside is significant, I could simply restore an archived copy of /etc/pacman.d/mirrorlist (the one with the mirrors I chose for myself) just before each Manjaro update?

Get a specific mirror from here:

E.g.: own country or nearby and copy the mirror URL.

And then add /stable/$repo/$arch/ to the mirror URL.

pacman (alpm library) parses the mirrorlist from top to bottom.

This is a thought experiment - which assumes you are lazy an do not update your metadata.

Then you want to sync foo which is registered in your metadata as version 1.1-1.

pacman will attempt to download package foo-1.1-1.pkg.tar.zst from the first mirror in the list.

The first mirror in your list no longer provide foo-1.1-1.pkg.tar.zst because 10m ago it synced with the master repo and now provides foo-1.2-1.pkg.tar.zst thus you will receive a 404 File not found.

pacman moves on to the next mirror in the list until a mirror provides the requested package.

This behaviour causes a lot of noise on the forum when some does not update metadata before sync.

It is higly recommended to understand how requests for packages are processed by the system and unless you are very knowledgeable - and that includes how the system behaves when you are not in sync with your mirrors metadata.

So be very careful with you experiment with mirrorlists and mirrorpools - be very careful.

If you cannot recover from your experiment be sure to mention how your experiemented - as that alone may be the clue to recovery.

1 Like

It’s to try to prevent people having to do it manually (and asking how to do it). It actually only needs to be done now and again, I have it disabled and I’ve refreshed my mirrrorlist twice in 6+ months.

I’ve ended up with worse mirrors at least once (they were already slow, after a refresh even slower, another refresh fixed it), so doing it every week is not only unnecessary but on rare occasions it can also be counterproductive.

The downside is that you may have to refresh your mirrorlist manually (using pacman-mirrrors) now and again. When they’re slow, or if a mirror stops being a mirror, etc.

Anyway you were talking about having a static mirrorlist, so not refreshing the mirrorlist at all. Or you can instead use a custom mirror pool, so that pacman-mirrors will only use the mirrors from that.


This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.