Trying to cross build sys-fs/udev as normal user fails with: * http://wiki.gentoo.org/wiki/Udev/upgrade * Adding group 'input' to your system ... * - Groupid: next available groupadd: Permission denied. groupadd: cannot lock /etc/group; try again later. * ERROR: sys-fs/udev-215::gentoo failed (postinst phase): * (no error message) * * Call stack: * ebuild.sh, line 93: Called pkg_postinst * environment, line 4350: Called enewgroup 'input' * environment, line 1802: Called die * The specific snippet of code: * groupadd -r ${opts} "${egroup}" || die * * If you need support, post the output of `emerge --info '=sys-fs/udev-215::gentoo'`, * the complete build log and the output of `emerge -pqv '=sys-fs/udev-215::gentoo'`. * The complete build log is located at '/usr/x86_64-tm-linux-gnu/tmp/portage/sys-fs/udev-215/temp/build.log'. * The ebuild environment file is located at '/usr/x86_64-tm-linux-gnu/tmp/portage/sys-fs/udev-215/temp/environment'. * Working directory: '/usr/local/src/portage/pym' * S: '/usr/x86_64-tm-linux-gnu/tmp/portage/sys-fs/udev-215/work/systemd-215' !!! FAILED postinst: 1 This could probably be resolved by adding --root $ROOT to groupadd in enewgroup
The same goes for useradd which also has a --root option
hmm, just did a test with --root option and it turns out that groupadd really tries to do a chroot so it will fail again.
Got an idea, use sys-apps/proot to bind mount $ROOT/etc over /etc and then run group add: proot -0 --bind=${ROOT}/etc:/etc /usr/sbin/groupadd -r ${opts} "${egroup}" || die This actually works! Should be usable for all group/user related tasks. What do you think of using proot in user.eclass?
proot is only avaliaable on x86/amd64 so that won't work well. Wrapping the groupadd call in: if [[ ${ROOT} == / ]] ; then .. fi would be apropiate though, with some msg that groupadd has been skipped. same for enewuser etc. No comment so far, anyone home ?
*** This bug has been marked as a duplicate of bug 53269 ***