Bug 7976

Summary: mkuser script fails with: user already exists with group nogroup
Product: buildroot Reporter: Tom Elliott <tommygunsster>
Component: OtherAssignee: Yann E. MORIN <yann.morin.1998>
Status: RESOLVED INVALID    
Severity: minor CC: buildroot, tommygunsster, yann.morin.1998
Priority: P5 Keywords: FIXME
Version: 2015.02   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: Enhance error messages
mkusers patch corrected
Patched Build Log Info.
mkusers patch corrected 2

Description Tom Elliott 2015-03-26 12:23:06 UTC
The file:

buildroot-2015.02/support/scripts/mkusers 

Lines: 170-173:
    # check the user does not already exist in another group
    if [ -n "${_ugroup}" -a "${_ugroup}" != "${group}" ]; then
        fail "user already exists with group '${_ugroup}'\n"
    fi

Issue causes a total failure to build if the user exists with the group already.  This shouldn't happen as it actually has less work to do right?

My work around was to comment the fail line and all seems to have continued to work properly.

I don't know what impacts this has but as it's not failing to a real "problem" and the mkusers script is new from what I can find, I doubt there will be any major issues.
Comment 1 Yann E. MORIN 2015-03-26 16:30:27 UTC
Created attachment 5956 [details]
Enhance error messages

Hello!

The only package we have that wants to add a user with group 'nogroup' is
the mysql package, and it builds just fine here.

Do you have a custom users table? Do you have a local package that wants
to add another user with group 'nogroup'?

In any case, care to apply the attached patch and report on the new error
message, please?  (note: this patch only expands the error message, and
does not attempt to provide a fix, since I can't reproduce).

Regards,
Yann E. MORIN.
Comment 2 Tom Elliott 2015-03-26 17:23:20 UTC
I'm not seeing anything that has the nogroup that I'm installing.  I am not installing the mysql package though.

I do have some customization's to add some of the packages we need for the initrd file.

Weirdly enough, i've uncommented the thing and deleted the rootfs.ext file(s) and i'm no longer able to replicate this either.

I'll do a make clean and have it run though the entire build process and upload the log I'm generating for this.  Hopefully we'll see the problem again.
Comment 3 Yann E. MORIN 2015-03-26 17:37:24 UTC
Hello,

Do not forget to apply the patch I attached, so that you can see
more details about the failure if it happens again; this will be
extra useful to help debug the issue.

Thanks!

Regards,
Yann E. MORIN.
Comment 4 Tom Elliott 2015-03-26 20:34:07 UTC
Created attachment 5961 [details]
mkusers patch corrected

found a typo in the patch you sent me.  Reuploaded just to help out.
Comment 5 Tom Elliott 2015-03-26 20:36:15 UTC
Created attachment 5966 [details]
Patched Build Log Info.

As requested, the information of this log shows the error.  It looks like it's coming from sshd
Comment 6 Tom Elliott 2015-03-26 21:11:34 UTC
Created attachment 5971 [details]
mkusers patch corrected 2

Found another issue in the patch and just corrected again.
Comment 7 Tom Elliott 2015-03-29 15:37:47 UTC
So while the patch is great to lead us to find the cause of the problem (in our case it looks like it's the openssh package I have building with it) is there anything I should look into further to help troubleshoot why this, seemingly, small issue is occurring and the first place?

Is there also anything wrong with commenting the fail part of this so the rootfs file can actually be built?
Comment 8 Yann E. MORIN 2015-03-29 17:18:57 UTC
Tom,

Could you attach your .config pleae, so I can try to reproduce here?

And yes, this check is here on purpose: we do not want two packages
to try to install the same user with different groups. For example,
the following is clearly wrong:

    define FOO_USERS
        foo_u - foo_g - * - - -
    endef

    define BAR_USERS
        foo_u - bar_g - * - - -
    endef

because the user 'foo_u' can have only one main group. And we want to
catch this.

Regards,
Yann E. MORIN.
Comment 9 Tom Elliott 2015-03-29 17:24:55 UTC
There's a few things have to be taken into consideration for this to work.

First, you need the structure laid out for the customizations we have.

Here's a breakdown of what I need to do.

I build on debian 7.8 x86_64 for now:

Download the structure we need from:

http://sourceforge.net/p/freeghost/code/HEAD/tree/trunk/src/buildroot/

Copy the files inside to your buildroot's extracted folder.

Copy the fog.buildroot.config.64 to .config

Then try building.

This is the simplest I can tell you for right now.  Hopefully it's helpful enough and if you need help I'm right here.
Comment 10 Yann E. MORIN 2015-03-29 18:04:16 UTC
Tom,

OK, I fond your issue.

In your Buildroot tree, you already have an sshd user in your passwd
file, see:
    http://sourceforge.net/p/freeghost/code/HEAD/tree/trunk/src/buildroot/system/skeleton/etc/passwd

And this sshd user is part of group 99, which is 'nobody'.

This is breakage on your side.

Regards,
Yann E. MORIN.
Comment 11 Tom Elliott 2015-03-29 18:09:21 UTC
I'm very sorry to have wasted your time then.  I should've known to look there.

Thank you very much for the assistance at any rate.