FS#38641 - [devtools] arch-nspawn - don't modify pacman.conf
Attached to Project:
Arch Linux
Opened by Andrwe (Andrwe) - Friday, 24 January 2014, 12:57 GMT
Last edited by Kristian (klausenbusk) - Saturday, 03 June 2023, 18:03 GMT
Opened by Andrwe (Andrwe) - Friday, 24 January 2014, 12:57 GMT
Last edited by Kristian (klausenbusk) - Saturday, 03 June 2023, 18:03 GMT
|
Details
Description:
Currently arch-nspawn alway replaces the pacman option 'Cache Dirs' within the chroot with the values of pacman.conf outside the chroot. This behaviour is bad for following reasons: 1. it breaks the intended feature of providing an own pacman.conf 2. it breaks the 'Cache Dir' feature of pacman for the chroot 3. it breaks an intentionaly modified pacman.conf within the chroot 3. it causes confusion because this behaviour isn't documented and can't be overruled Additional info: * 20131107-1 Steps to reproduce: - create a arch-chroot - change the value of 'Cache Dir' in /etc/pacman.conf within the chroot - run 'arch-nspawn -D $chroot-dir' - check /etc/pacman.conf <- it is changed |
This task depends upon
Closed by Kristian (klausenbusk)
Saturday, 03 June 2023, 18:03 GMT
Reason for closing: Upstream
Additional comments about closing: Please report upstream if still relevant: https://gitlab.archlinux.org/archlinux/d evtools.
Saturday, 03 June 2023, 18:03 GMT
Reason for closing: Upstream
Additional comments about closing: Please report upstream if still relevant: https://gitlab.archlinux.org/archlinux/d evtools.
a quick fix until the next update is to comment line 309 of /usr/bin/arch-nspawn.
I think the intention of this sed-command is to use the same cache-dir in the chroot as the system by default.
Therefore a real fix without removing this intent could be:
1. check if 'Cache Dir' != default value
2. check if other values of chroot:/etc/pacman.conf differ from systems:/etc/pacman.conf (after running copy_hostconf)
3. if ( 1. == true && 2. == false ) then run the replacement command
Regards,
Andrwe
while implementing a the fix attached I found that the mentioned way is not good enough.
The fix now uses the following procedure:
1. get current value of chroot:/etc/pacman.conf
2. check if system:/etc/pacman.conf != default(/var/cache/pacman/pkg/)
3. check if 1. == default(/var/cache/pacman/pkg/)
4. if ( 2. == true && 3. == true ) then run replacement command
Regards,
Andrwe
after some testing I found that with my first patch the chroot-dirs weren't mounted thus they were created within the chroot.
This patch now first runs some check to find the correct cache-dir, runs build_mount_args and replaces 'CacheDir' in the chroot:/etc/pacman.conf with the found value.
Although always running the replacement command is an overhead it produces the most consistent behaviour.
Regards,
Andrwe
FS#27544is a related problem, we should have an option to not mess with the container's configuration at all.