[yocto] Setting root password

Daniel. danielhilst at gmail.com
Thu Sep 24 07:16:42 PDT 2015


My image .class file has includes a lot of recipes that I wrote for
specific reasons so it will not work as it is for you without that recipes,
instead here is the minimal you may need to get this working. I use a class
file because I have lot of images differing in little things, like which
kernel modules are auto loaded. So for your case I think this simple recipe
would suffice. If you want you can save this as .class file and import from
other images as I do.

http://pastebin.com/raw.php?i=1qds5hKF

Regards,
- dhs

2015-09-24 10:59 GMT-03:00 Andy Pont <andy.pont at sdcsystems.com>:

> Hi Daniel,
>
> > I didn't know about this EXTRA_USERS_PARAMS. What I do is adding this
> function to
> > my image.
> > # This function sets the password for root based on ROOT_PASSWD variable
> > set_root_password () {
> >         local p=$(openssl passwd -1 -salt "My salt" "${ROOT_PASSWD}")
> >        sed -e "s/root:[^:]*:/root:${p}:/" -i ${IMAGE_ROOTFS}/etc/shadow
> > }
> > And append it to ROOTFS_POSTPROCESS_COMMAND:
> > ROOTFS_POSTPROCESS_COMMAND += "set_root_password; "
> > I did all this in a class file which I import on all my images,
>
> As your method works and the EXTRA_USERS_PARAMS appears not to be doing
> could you send me your class file to save me having to reinvent the wheel?
>
> > About your problem, can you get the "usermod" error from log.do_rootfs
>
> The end of the log.do_roots file just contains the following:
>
> NOTE: Executing set_user_group ...
> DEBUG: Executing shell function set_user_group
> NOTE: Performing usermod with [-R
> XXXXX/build/tmp/work/intel_core2_32-poky-linux/core-image-minimal-initramfs/1.0-r0/rootfs
> -P Hkw6rBJlcfhvM root] and 1 times of retry
> Server refused shutdown.  Remaining client fds: 2
> Client pids: 3878 16245
> Server will shut down after all clients exit.
> WARNING: usermod command did not succeed. Retrying...
> ERROR: Tried running usermod command 1 times without success, giving up
> WARNING:
> XXXXX/build/tmp/work/intel_core2_32-poky-linux/core-image-minimal-initramfs/1.0-r0/temp/run.set_user_group.3878:1
> exit 1 from
>   exit 1
> DEBUG: Python function do_rootfs finished
>
> Thanks,
>
> Andy.
>
>


-- 
*"Do or do not. There is no try"*
  *Yoda Master*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20150924/be79225d/attachment.html>


More information about the yocto mailing list