Re: [gentoo-dev] user.eclass ignores ROOT/SYSROOT

2020-05-05 Thread Bertrand Jacquin

On 2020-05-05 21:22, Peter Stuge wrote:

Hi,

I'm trying something out over here and I'm surprised to find that
acct-group/* do not work with ROOT+SYSROOT != "/".

Should I file yet another bug about this


Correct, https://bugs.gentoo.org/show_bug.cgi?id=541406 is tracking this 
and has some background into it.


--
Bertrand



Re: [gentoo-dev] user.eclass ignores ROOT/SYSROOT

2020-05-05 Thread David Michael
On Tue, May 5, 2020 at 4:22 PM Peter Stuge  wrote:
> Hi,
>
> I'm trying something out over here and I'm surprised to find that
> acct-group/* do not work with ROOT+SYSROOT != "/".
>
> Should I file yet another bug about this?
>
> I suppose the limitation is in user.eclass, but what about the 11 bugs
> already filed about exactly this problem?
>
> They are easy to see in the dup bug list at https://bugs.gentoo.org/53269
>
> Unfortunately mgorny closed 53269 WONTFIX because GLEP-27 is Deferred,
> causing all dup and dep bugs to be forgotten. Sad panda.
>
> --8<-- reproduce
> # export r=$(mktemp -d)
> # ROOT=$r SYSROOT=$r strace -fe execve emerge baselayout acct-group/ftp 2>&1 
> | grep groupadd
> [pid 13269] execve("/usr/sbin/groupadd", ["groupadd", "-r", "-g", "21", 
> "ftp"], 0x5d7e299e2340 /* 227 vars */) = 0
> groupadd: cannot lock /etc/group; try again later.
>  *   groupadd -r ${opts} "${egroup}" || die
>  *   groupadd -r ${opts} "${egroup}" || die
> -->8--
>
> In my particular case -R $r would work just fine, but as can be seen
> in several of those 11 dup bugs it is not a general solution.
>
> Any ideas on how to solve this?

I know it's not a general fix, but my solution for building a separate
systemd root was to use sysusers.  You could try the eclass patch(es)
at https://bugs.gentoo.org/702624 if you're using at least systemd
245.  (Older versions work if you apply the upstream commit linked in
the bug.)  If you're running a systemd host with a non-systemd target,
you can still probably run "systemd-sysusers --root=$ROOT" after
emerge to generate the accounts that way.

Thanks.

David