Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 413223

Summary: user.eclass: enewuser/group doesn't honor ROOT environment variable
Product: Gentoo Linux Reporter: Jaco Kroon <jaco>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kevin
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jaco Kroon 2012-04-23 08:12:14 UTC
I've used ROOT=/home/pxe/root emerge -1av openssh to install openssh into a PXE boot environment.  It seems that this is working quite nicely except that the sshd user+group doesn't actually get created in /home/pxe/root/etc/passwd as per pkg_preinst() in the openssh ebuild.

Not sure if this can even be fixed.

Reproducible: Always
Comment 1 Jaco Kroon 2012-04-23 08:21:25 UTC
Actually, turns out this may be an issue with the user eclass.  Can't see if there is an easy fix though ... perhaps using chroot "${ROOT}" getent (for example) ... but can one rely on getent always functioning within the chroot?

What about the case where the user needs to also exist during compile/install phase and not only during runtime?
Comment 2 Zac Medico gentoo-dev 2012-04-23 16:14:30 UTC
Bug 53269, comment #49 suggests that shadow's new --root option might help.
Comment 3 Jaco Kroon 2012-04-23 18:42:53 UTC
Indeed, that looks useful!  Negates the need for having shadow merged inside the ROOT environment (even though in all probability it is very likely to be merged already).

Perhaps a two-stage fix (and I think based on the info I might be willing to attempt a patch now):

1.  Check if the non-ROOT env has a shadow supporting --root, if it has, use it.
2.  If the above fails, try chroot "${ROOT}" useradd ... hack ...

If that fails, enew{user,group} fails.

If anybody can give me go-ahead in principle, I'll see what I can do re cooking up a patch implementing the above.
Comment 4 SpanKY gentoo-dev 2012-04-23 21:53:25 UTC

*** This bug has been marked as a duplicate of bug 53269 ***