Search code examples
yoctobitbakeopenembedded

Yocto Warrior Cannot Set Password for root or other users


I am using the meta-tegra warrior branch layer to build an sd card image for the Nvidia Jetson Nano. The image completes and the board boots, but I cannot log in if I try to set any kind of password in Yocto. I've tried creating users other than root and setting their passwords, but the same problem occurs where I cannot log in.

If I leave "debug-tweaks" enabled, and do not attempt to modify the root password at all, I can successfully log in without a password.

I am using warrior branch for OE and haven't modified other layers. How can I set a password for root?

Here are my local.conf password related lines:

# Password Stuff
INHERIT += "extrausers"
#EXTRA_IMAGE_FEATURES = "debug-tweaks"
EXTRA_USERS_PARAMS = "usermod -P mypassword123 root; "
EXTRA_USERS_PARAMS = " useradd testing; \
                       useradd mts; \
                       usermod  -p 'testing12345' testing; \
                       usermod  -p 'comp12345' comp; \

Solution

  • usermod with -p (minus p) needs a hash generated from openssl passwd command so you need to set Yocto variable as following:

    EXTRA_USERS_PARAMS = "usermod -p $(openssl passwd <some_password>) root;"

    If you want to append something to bitbake variable, you need to use _append or += operators, ie:

    EXTRA_USERS_PARAMS_append = " useradd testing;"
    EXTRA_USERS_PARAMS_append = " useradd mts;"
    ...