[pacman-dev] Non-existing user/group ownership and chroot

Armin K. krejzi at email.com
Sun Mar 5 23:04:58 UTC 2017

On 06.03.2017 00:00, Allan McRae wrote:
> On 06/03/17 08:40, Armin K. wrote:
>> On 05.03.2017 23:38, Armin K. wrote:
>>> Hi all.
>>> I'm using pacman for my LFS install, and as part of that, I also use
>>> hooks
>>> used by Arch for, say, systemd-sysusers, systemd-tmpfiles, etc.
>>> Some packages require that certain files/directories are owned by a
>>> certain
>>> user/group after install. This is somehow hard to achieve with
>>> .install file
>>> when systemd-sysuser hook is used (see [1] for an example).
>>> Since this is a LFS, it's "bootstrapped" from an already existing
>>> linux distro
>>> (doesn't have to be arch, it has its own temporary pacman). I use
>>> pacman -U -r
>>> /path/to/lfs to install packages from the host system.
>>> The issue I'm having is when an user isn't created and chown is ran in
>>> with statically assigned id's (ie, chown 20:20, where 20 will be an
>>> UID for the
>>> created user), pacman chowns those files/directories to something else
>>> entirely.
>>> I did however notice that on my host (Arch, of course), those
>>> missleading uids/gids
>>> correspond to the uids/gids of the users that are going to be created
>>> in LFS.
>>> So, if I have user/group named:named with uid:gid 20:20, and host
>>> system (Arch)
>>> has same user:group, with with uid:gid 40:40, the files that I
>>> explicitly chowned
>>> to 20:20 in PKGBUILD will be chown-ed to 40:40 instead when pacman -U
>>> -r ...
>>> is ran.
>>> So, how do I solve this problem? I suppose it's an issue in pacman -U
>>> with -r
>>> option. I can use chown 20:20 in .install file (before the user:groups
>>> have been created), and the file will be created with proper ownership.
>>> Thanks in advance.
>>> [1] https://bugs.archlinux.org/task/52680
>> Oh, and I'm using stock pacman-5.0.1, no additional patches (besides
>> minor makepkg hacks to set CC/CXX and different debug/nondebug
>> .
> You can either create the groups in the install file and chown the
> needed files, or have the same group IDs across systems.
> A
Entries are alright in .MTREE (correct gid's). I don't suppose pacman
does something odd there? Why doesn't it use those uid's/gid's?

If you could point me to the part in the pacman code which does the
extraction, I might be able to find a solution (at least for myself).


More information about the pacman-dev mailing list