3

When I try to do sudo pacman -Syu, it gives me error: config file /etc/pacman.d/mirrorlist could not be read: No such file or directory.

What should I do?

2 Answers 2

4

Restore a valid mirrorlist file from the original source:

$ sudo bash
# mkdir -p /etc/pacman.d
# curl -s "https://www.archlinux.org/mirrorlist/?country=US&country=GB&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' > /etc/pacman.d/mirrorlist
# pacman -S archlinux-keyring
# pacman -Syu
# exit
$

The list you are getting is for some specific countries; here, US and GB are used. Feel free to enter your own country or countries close to you.

The commandline above is adapted from the original documentation at the Archlinux Wiki page on Mirrors. I have entered interactive mode in sudo to have correct rights for redirection and I have removed the sorting by mirror speeds because you may or may not have the script for sorting.

EDIT: If you get errors about non-existing mirror servers you can edit the file /etc/pacman.d/mirrorlist and comment out those that do not work, e.g.

$ sudo nano /etc/pacman.d/mirrorlist
===>
# comment out whole lines by hash like this:
#  Server = https://mirror.0x.sg/archlinux/$repo/os/$arch
Server = https://mirror.netweaver.uk/archlinux/$repo/os/$arch
# Server = https://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
(...)

You can also create Server entries for that file by hand at the Archlinux Pacman Mirrorlist Generator. Enable the "Use mirror status:" checkmark [X].

8
  • I followed this and when i run pacman -Syu, it gives me the error error: could not register 'archlinuxcn' database (database already registered) Commented Jun 22, 2020 at 15:45
  • and error: failed retrieving file 'archlinuxcn.db' from mirror.0x.sg : The requested URL returned error: 404 Commented Jun 22, 2020 at 15:45
  • OK, please try US and GB as above, that ought to work.
    – Ned64
    Commented Jun 22, 2020 at 15:46
  • and error: failed to update archlinuxcn (failed to retrieve some files) with error: failed to synchronize all databases too, four errors Commented Jun 22, 2020 at 15:46
  • oh ok i'll try it Commented Jun 22, 2020 at 15:47
0

I got this issue on the MSYS2 for the clang64 mirror list :

mkdir clang64_repair && cd clang64_repair 

wget https://packages.msys2.org/package/pacman-mirrors?repo=msys&variant=x86_64
tar -I zstd -xvf ./pacman-mirrors-*.pkg.tar.zst
cp ./etc/pacman.d/mirrorlist.clang64 /etc/pacman.d/.
pacman -Syy

cd .. && rm -r clang64_repair

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .