Need Help: How to Add Custom Mirror Server Url Correctly in Arch Install
I have created a pacman local cache according to https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#Read-only_cache. I use Nginx to host the cache. Then I add my custom server url (e.g. Server = http://192.168.13.xx:8080/ )to the /etc/pacman.d/mirrorlist of some other Arch machine in the LAN. It works very well.
But when I try to add the custom mirror following: Mirrors Custom mirrors Add a custom mirror Enter name (leave blank to skip) Enter url ......
The server url and other info are added to the pacman.conf. For example:
[Home]
SigLevel = Optional TrustAll
Server = http://192.168.13.xx:8080
But shouldn't the mirror be added to /etc/pacman.d/mirrorlist?
From the code, I find the below function add_custom_mirrors:
https://github.com/archlinux/archinstall/blob/f107104103b74ac065a56bd94a0878f0d263e177/archinstall/lib/mirrors.py#L276
It operates on /etc/pacman.conf
However, another function use_mirrors:
https://github.com/archlinux/archinstall/blob/f107104103b74ac065a56bd94a0878f0d263e177/archinstall/lib/mirrors.py#L290C1-L290C1
operates on /etc/pacman.d/mirrorlist
Another _add_custom_mirror here: https://github.com/archlinux/archinstall/blob/f107104103b74ac065a56bd94a0878f0d263e177/archinstall/lib/mirrors.py#L141
The code gives me the feeling that it is trying to add a custom repository, but the name from the menu says Add a custom mirror.
It is really confusing.
https://github.com/svartkanin/archinstall/blob/16132e6fc9d54f237f260227f99dad5b639891db/archinstall/lib/mirrors.py#L276
- Is used to set the mirror in the ISO (or host system), it takes a list of custom mirrors
https://github.com/svartkanin/archinstall/blob/16132e6fc9d54f237f260227f99dad5b639891db/archinstall/lib/mirrors.py#L141
- Is part of the
CustomMirrorListclass which is the visual menu where custom mirrors can be configured
https://github.com/svartkanin/archinstall/blob/16132e6fc9d54f237f260227f99dad5b639891db/archinstall/lib/mirrors.py#L290
- Is setting the mirror list on the device where arch is going to be installed
According to the code:
pacman.confis written on the installation targetmirrorlistis written on the localhost
So adding the configuration only to pacman.conf does not work for you?
Looking at the man https://archlinux.org/pacman/pacman.conf.5.html I cannot see a refernce to the mirorlist that indicates it would be necessary to add it there
Sorry if I didn't make it clear.
I mean, according to the man page you linked, repositories are added to the pacman.conf. For each repository, a server url can be added.
The example given in the man page is the following:
[core]
# use this server first
Server = ftp://ftp.archlinux.org/$repo/os/$arch
# next use servers as defined in the mirrorlist below
Include = {sysconfdir}/pacman.d/mirrorlist
Aim: Utilize the pacman package cache hosted on a local server and speed up the installation.
My thoughts on possible ways to do it:
- specify a
server urlfor each repository, as in the man page example or - add the
server urldirectly to the/etc/pacman.d/mirrorlist.
What archinstall do
using the Add a custom mirror menu, request a name, a server url, and write to /etc/pacman.conf like:
[name_requested]
SigLevel = Optional TrustAll
Server = url_requested
Problem it caused
pacman tries to download a name_requested.db file, treating name_requested as a repository.
What confuses me is, there is a option to Add a custom mirror, that does similar things as adding a custom repository.
IMHO, one way is to do this:
/etc/pacman.conf
[core]
# use this server first
Server = URL_PROVIDED_BY_USER
# next use servers as defined in the mirrorlist below
Include = {sysconfdir}/pacman.d/mirrorlist
Another way is to add
/etc/pacman.d/mirrorlist
Server = URL_PROVIDED_BY_USER
I have raised a PR with some changes to write the provided url to the mirrorlist. You can give that one a go https://github.com/archlinux/archinstall/pull/2350