Skip to content

32 comments

Make sure the resulting /etc/pacman.d/mirrorlist does not contain entries that you consider untrustworthy before syncing or updating with pacman.

That’s quite the warning for a service that is documented for unattended runs.

36 points

What is your takeaway from that comment? What mirrors should be considered untrustworthy?

9 points

I was under the impression that you didn't need to trust Arch mirrors (hence http is ok) because the maintainers sign their packages.

22 points

Nice, but I think I keep my custom Pacman hook which also removes the mirrorlist.pacnew file.

12 points

That's still an option, although I'd recommend updating your hook to use the new service as specified in the wiki. Also of note is that the timer will auto-update your mirrorlist at a set interval, whereas the hook will only update it when pacman-mirrorlist is upgraded.

12 points

I'd recommend updating your hook to use the new service

I already thought about that.

Also of note is that the timer will auto-update your mirrorlist at a set interval, whereas the hook will only update it when pacman-mirrorlist is upgraded.

I am aware of that. I always thought that the mirrors won't change much if there is no update of the package?

3 points

Alternatively you could use the NoExtract option in /etc/pacman.conf, so you don't have to deal with a .pacnew at all:

NoExtract etc/pacman.d/mirrorlist
7 points

Thanks! This is exactly what I was looking for. The main point in favor of the hook was to remove the .pacnew file automatically. Didn't knew about the NoExtract option. Maybe this should also be added to the reflector wiki entry.

1 points

I don't know why, but I've had multiple occurrences this year of stale mirrors that don't get updates for weeks. My pacman hook does nothing for that.

Personally, I'm using both. Best of worlds.

6 points

Why is config file put in /etc/xdg/reflector and not simply /etc/reflector.conf? Just like pacman conf is in /etc/pacman.conf

8 points

Maybe obvious but you never know... If you have reflector-timer installed you should remove it before updating, pacman won't do it for you and the update will fail otherwise.

5 points

I had been using Reflector for a long time but recently switched to a script presented in the Arch Forum which I modified a bit.I prefer it over Reflector because it's simpler.

My current version is:

#!/bin/sh
    
# Exit immediately if a command exits with a non-zero exit status.
set -e

# Colors
NR='\033[0m'
N3='\033[0;32m'
N1='\033[0;31m'

# Fail-check: make sure you have root permissions.
if [ ! -w /etc/pacman.d/mirrorlist ]; then
   printf '%b\n' "$N1::$N3 Error:$N1 missing required root permissions.$NR"
   exit 1
fi

echo -e "$N3 Download the mirrorlist status from the last 24 hours.$NR"
URL='https://www.archlinux.org/mirrors/status/json/'
echo
echo "--> Done!"
echo
echo -e "$N3 Return only secure mirrors from selected countries.$NR"
FILTER='.urls | [.[] | select(.protocol == "https")]
              | [.[] | select(.country_code == "DE",
                              .country_code == "SE",
                              .country_code == "CZ",
                              .country_code == "NL",
                              .country_code == "DK",
                              .country_code == "CH")]
              | [.[] | select(.completion_pct == 1.0)]
              | [.[] | select(.score < 1.0)]
              | .[] | "## \(.country)\nServer = \(.url)$repo/os/$arch"'
              
echo
echo -e "$N3 Fetch and filter the mirrors, then rank them by connection and opening speed.$NR"
curl -qs "$URL" | jq -r "$FILTER" | rankmirrors -v - > /tmp/mirrorlist
echo
echo "--> Done!"
echo

# Backup previous mirrorlist and move over the new one if /tmp/mirrorlist is NOT empty
if [ -s /tmp/mirrorlist ]
then 
     mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.previous
     mv /tmp/mirrorlist /etc/pacman.d/mirrorlist
     echo -e "$N3 Ready - mirrorlist successfully updated $NR"
else
      echo -e "$N1 Something went wrong: /tmp/mirrorlist is empty - keep PREVIOUS mirrorlist$NR"
fi

# Remove mirrorlist.pacnew created during pacman-mirrorlist upgrade.
[ -f /etc/pacman.d/mirrorlist.pacnew ] && rm /etc/pacman.d/mirrorlist.pacnew

exit 0
2 points
unknown author

Deleted before we saved it.

1 points
unknown author

Deleted before we saved it.

1 points

Interesting project, but i was wondering if it really is helpful to update your mirror list automatically?
Are the speed differences worth it?

And also how am i supposed to trust a mirror before adding it if they are added automatically?

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.