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

Armin K. krejzi at email.com
Sun Mar 5 22:40:56 UTC 2017

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 PKGBUILD's
> 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

More information about the pacman-dev mailing list