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
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Levente Polyak (anthraxx)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

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.
Comment by Andrwe (Andrwe) - Friday, 24 January 2014, 13:23 GMT
Hi,

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
Comment by Andrwe (Andrwe) - Friday, 24 January 2014, 14:08 GMT
Hi,

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
Comment by Andrwe (Andrwe) - Friday, 24 January 2014, 15:19 GMT
Hi,

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
Comment by Doug Newgard (Scimmia) - Wednesday, 13 May 2015, 20:11 GMT
Andrwe, patches are best sent to the arch-projects mailing list; although there is a chance they won't be seen there, either.
Comment by Alad Wenter (Alad) - Friday, 24 March 2017, 16:07 GMT
That logic looks horrible. Why not just add some option to (not) copy over the cachedirs (cf. pacstrap)?
Comment by Eli Schwartz (eschwartz) - Tuesday, 01 August 2017, 22:10 GMT
 FS#27544  is a related problem, we should have an option to not mess with the container's configuration at all.

Loading...