Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 413223 - user.eclass: enewuser/group doesn't honor ROOT environment variable
Summary: user.eclass: enewuser/group doesn't honor ROOT environment variable
Status: RESOLVED DUPLICATE of bug 53269
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2012-04-23 08:12 UTC by Jaco Kroon
Modified: 2012-04-23 21:53 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
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 ***