TIP for Mirrorlist - This is better than Reflector

Reflector or Rate-Arch-Mirrors is not really necessary.

I manually edit the mirrorlist file when needed, which is basically never. Only have two or three mirrors in it.

The good quality mirrors, quick syncing and fast, never really change. I check the mirror status page periodically to make sure my main mirror is still healthy. It is.

https://archlinux.org/mirrors/status/

Choose mirrors in a “fast internet” country. Before updating connect to a VPN exit node close to the good mirror. Internet connection is always maxed out during pacman package downloads this way.

1 Like

Assuming that you use a VPN of course.
Ad to that it does happen that mirrors go down. Last week several mirrors died for me temporarely and I had to remove all Swedish mirrors to be able to do an update.

As for editing the mirror list… sure, but why when you can have a script do it for you.

I haven’t had to edit an Arch mirrorlist for a couple of years, neither on Manjaro before that.

That is the point.

Pick the right mirrors and you won’t have a need for reflector.

There are three strong mirrors in the mirrorlist file, very long odds that all of them go down at the same time.

I think the --save flag is not only useless, but counterproductive. It encourages users to run programs that do not need elevated privileges with sudo, just to write to a root owned file. There is absolutely no need to use sudo to rate mirrors (neither with reflector nor with rate-arch-mirrors).

Just use sudo tee, so that only the file-writing utility has elevated privileges, nothing more:

rate-arch-mirrors | sudo tee /etc/pacman.d/mirrorlist
4 Likes

This is just objectively wrong. It is literally the opposite of counterproductive since it simplifies things. Hence it is productive, not counterproductive.

I explained why it is counterproductive, as it encourages reckless use of sudo. Does a program that connects to remote servers really need root access on your machine?

It is you who is wrong.

3 Likes

:man_shrugging:
The use of the adjective counterproductive is still wrong.
As for the rest… you do you. I prefer to keep things neat and simplified. If you don’t trust a flag, don’t use it.

It’s not a matter of trust. It’s a matter of encouraging bad practices for users who do not know any better.

I’m not saying that reflector or rate-arch-mirrors are unsafe programs (far from it). Just that ranking mirrors does not need elevated privileges and therefore good software design should discourage users from using sudo. That’s all.

2 Likes

Thank you! That’s why I use the “tee” too.
And this is the reason why I haven’t added the option at the very beginning – because it doesn’t need root access for the “rate arch mirrors” part.

Now that you shared your thoughts on this, I again doubt about adding it :slight_smile:

5 Likes

That’s a shame, tho it’s just a matter of convenience.
Making an alias is simple after all.

All I know is that my mirror list was generated from Swedish and German mirrors. I could not download the updated packages unless I re-generated the mirror list without the Swedish mirrors in it.
The download literally stalled at < 1 byte / second.

IF --save gets added. it should THEN acquire the sudo password interactively - only for the file writing…

For example reflector-simple does this - presents the new (proposed) mirrrorlist, allows save to be selected (or not), THEN asks for sudo password for the write if requested… (good job @manuel)

The problem with that is there is no way to guarantee that a system has sudo installed.

It would basically make sudo a requirement for running rate-arch-mirrors. I know that we commonly think of sudo as the way to escalate privs for a command but in actuality there are many tools that do the same thing.

Would not a pkexec know what method to use? Or, perhaps, using an su -c instead? I understand I used an imprecise term for privilege escalation :grin: I meant it in the most generic way… really!

That is fundamentally the issue, there are a bunch of different ways to do it and if you must do it, you need to have a list and walk down it. Check if sudo is installed, if not try pkexec, if not try su -c. Of course, su and sudo use different passwords so it can end up confusing for the end user.

That is why I am more of a fan of letting the user handle it themselves. Unless it is a graphical application. In that case, I think it should use pkexec or gracefully fail if it isn’t available.

1 Like

Well…

ackchyually

the hypothetical

sudo rate-arch-mirrors --save /etc/pacman.d/mirrorlist

is objectively 3 whole characters more typing than

rate-arch-mirrors|sudo tee /etc/pacman.d/mirrorlist

so it’s not even simpler, since you have to type more with --save :frog:

4 Likes

Fine,
I still find it easier to remember.

That is a fair point, after all (pure) Arch is one of very very few distros which does not have sudo installed by default. And since this is written for pacman, it is written for pure Arch.

1 Like

I update the mirrors every month or two. I use fish so by the time I get to refl. . . . The rest of the command is already recalled and I hit enter once or twice. And then it’s updated. No alias. No remembering anything.

I love this computer stuff. It’s so fun.

3 Likes

off topic - re: fish & autocompletion
jic you want to try something else:

  • zsh
  • zprezto
  • fzf

two benefits:

  • ctrl+r triggers fzf to fuzzy-search you history
  • zsh is compatible with bash, no need to rewrite