"usermod -aG group user" not accepted

Hello,

I am trying to append the following to my .bb Image file:

inherit extrausers  
EXTRA_USERS_PARAMS = " \  
    usermod -P password root; \    
    useradd -P pass2 misa; \   
    usermod -aG wheel misa;"

but the result is an error with:

ERROR: console-misa-image-2.7.3-r0 do_rootfs: console-misa-image: usermod command did not succeed.
ERROR: console-misa-image-2.7.3-r0 do_rootfs: Function failed: set_user_group (log file is located at /work/apalis/oe-core-misa/build/tmp-glibc/work/apalis_imx6_misa-angstrom-linux-gnueabi/console-misa-image/2.7.3-r0/temp/log.do_rootfs.24442)

If I remove the last “usermod -aG wheel misa” the build is fine.

I tried all combinations:

“usermod -a -G wheel misa” and also
“usermod -aG wheel misa”

with no success.

If I put :

EXTRA_USERS_PARAMS = " \  
    usermod -P password root; \    
    useradd -P pass2 misa; \  
    usermod -G wheel misa;"

the build is also ok.

Any ideas why I can’t use “usermod -aG wheel misa” ?

Thanks.

Nicola

Ok, the problem is due to the group wheel not existing at the time.

So, when is the group wheel created during the build of the Image ? I tried to look in meta-toradex-* and openembedded-core, but there is no obvious answer.

Hi

I guess that systemd creates whatever user/group is missing from its ‘usr/lib/sysusers.d/basic.conf’ list during boot.

As you already found out for your use case you likely only need to create the wheel group additionally.

Max

Another solution might be to add another file in the sysusers.d directory to let systemd create the additional users as well. The syntax of the file is documented here.