2

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?

3

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].

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.