Project

General

Profile

Feature Request #623

[librechroot] Don't set the pacman mirror

alfplayer - over 9 years ago - . Updated over 5 years ago.

Status:
info needed
Priority:
wish
Category:
-
Assignee:
-
% Done:

0%


Description

librechroot sets the chroot mirror to the mirror used by the host pacman.conf, even if a different pacman.conf file was specified by librechroot -C.

/usr/lib/libretools/chroot/arch-nspawn (from package "libretools"):

host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')

...

echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist" 

pacman.conf file used by librechroot (possibly passed with -C) could reference a mirrorlist file (or multiple mirrorlist files for different repos) itself pointing to a mirror which is not the host's configured mirror. This is also unsupported.

I believe separating the host and chroot mirrors is a reasonable need. I found this issue trying to write a dual-arch librechroot wrapper supporting snapshot URLs like http://alfplayer.com/.


Files

mirrorlist-hack.patch (1.72 KB) mirrorlist-hack.patch alfplayer, 2014-12-29 08:50 PM

Related issues

Related to libretools - Bug #256: Document or remove how/why the tools mangle configuration filesfixed2012-11-29

Actions

History

#1

Updated by alfplayer over 9 years ago

  • Related to Bug #256: Document or remove how/why the tools mangle configuration files added
#2

Updated by lukeshu over 9 years ago

I'm honestly not sure why it does this, the behavior was inherited from Arch's devtools.

Perhaps we should ask the list (FYI: the email will be rejected unless the Subject starts with the name of a valid project in brackets, ie "[devtools]").

#3

Updated by alfplayer over 9 years ago

I can guess Arch does this partly because devtools provides one archbuild wrapper per repo (and a pacman.conf file for each repo/wrapper) so they can set -C inside the wrappers. This issue is more confusing for libretools users compared to devtools users because libretools doesn't provide these wrappers. Using the [extra] mirror is arbitrary for both Parabola and Arch packagers.

I didn't find additional information on Arch's devtools.git. The command mkarchroot had a -n option (NOCOPY variable) preventing the copy of host configuration files until this commit: https://projects.archlinux.org/devtools.git/commit/?id=453558c4bb44b4bff43fcd22f96d4cfe1dbcf6f1

wrappers: https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot#Convenience_Way
-C option: https://projects.archlinux.org/devtools.git/tree/archbuild.in?id=b58fb33482bdce19163eb23ea79bb1a2f74b1719#n66 (HEAD version)
pacman.conf files: https://projects.archlinux.org/devtools.git/tree/

#4

Updated by alfplayer over 9 years ago

The attached patch enables fetching pacman sync DBs and packages inside chroots (master chroot and other chroots) using a non-default mirrorlist file referenced by the the pacman.conf file passed to librechroot option -C.

Without this patch, these mirrorlist paths point to mirrorlist files which do not exist inside any chroot because libretools does not copy or create these paths.

To create the master copy, librechroot calls mkarchroot which calls pacstrap. Librechroot does not support copying a mirrorlist file from a non-default mirrorlist path because pacstrap does not support it.

The attached file patches libretools to copy the mirrorlist file to the same path as the host (hard-coded to /etc/libretools/mirrorlist) to the master chroot after the master chroot is created by pacstrap. Then, the mirrorlist file is preserved at the same path in non-master copies created by libretools.

#5

Updated by alfplayer over 9 years ago

As an alternative, passing librechroot -C to a pacman.conf file using Server options for each repo allows to specify a single mirror for each repo without any of these hacks and without using mirrorlist files in any chroot. Example assuming Include options are set to default values in original pacman.conf:

cp /etc/pacman.conf{,.libretools}

sed -i 's|\(Include = /etc/pacman\.d/mirrorlist\)$|Server = http://alfplayer.com/parabola/$repo/os/$arch|' /etc/pacman.conf.libretools
#6

Updated by lukeshu about 8 years ago

  • Priority changed from feature to wish
  • Status changed from open to info needed
  • Subject changed from librechroot uses arch-nspawn to forcefully set the host mirror with hard-coded paths to [librechroot] Don't set the pacman mirror

I'm not comfortable undoing this without a better understanding of why Arch does it.

#7

Updated by lukeshu over 5 years ago

  • Tracker changed from Bug to Feature Request

Also available in: Atom PDF