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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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].
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