All of lore.kernel.org
 help / color / mirror / Atom feed
* issue adding the user with the yocto kirkstone
@ 2024-04-25 18:47 Mahendra Sondagar
  2024-04-25 18:57 ` [yocto] " Daniel
  0 siblings, 1 reply; 4+ messages in thread
From: Mahendra Sondagar @ 2024-04-25 18:47 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 1621 bytes --]

Hi.. There

I'm dealing with the yocto kirkstone with the Ubuntu 20.04 LTS host

At present, i have created my custom image by adding the layer meta-custom

Initially, the basic image building were successful and I'm able to boot the custom image

However, my intention is to add the root password and user with the image. That's how i have added the EXTRA_USER_PARAMS variable

Unfortunately, This time the image won't be successfully building

This is what I'm getting as and error logs during the building of the image

DEBUG: Executing shell function empty_var_volatile DEBUG: Shell function empty_var_volatile finished NOTE: Executing set_user_group ... DEBUG: Executing shell function set_user_group NOTE: custom-image: Performing usermod with [-R /home/mahendra/Documents/MyWorkSpace/my-git/Yocto-stm32mp1/build-mp1/tmp/work/stm32mp1-poky-linux-gnueabi/custom-image/1.0-r0/rootfs -P mahi root] usermod: prefix must be an absolute path ERROR: custom-image: usermod command did not succeed. WARNING: exit code 1 from a shell command. DEBUG: Python function do_rootfs finished

Here I have attached the custom-image.bb file

SUMMARY = "Minimal custom image for STM32MP1-DK1 board" AUTHOR= "Mahendra Sondagar | mahendrasondagar08@gmail.com" IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}" IMAGE_LINGUAS = " " LICENSE = "MIT" inherit core-image inherit extrausers # Set rootfs to 200 MiB by default IMAGE_OVERHEAD_FACTOR ?= "1.2" IMAGE_ROOTFS_SIZE ?= "204800" EXTRA_USERS_PARAMS = " \ usermod -P mahi root; \ "

Can anyone help me here to fix the issue ?

Thanks

Mahendra

[-- Attachment #2: Type: text/html, Size: 1850 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] issue adding the user with the yocto kirkstone
  2024-04-25 18:47 issue adding the user with the yocto kirkstone Mahendra Sondagar
@ 2024-04-25 18:57 ` Daniel
  2024-04-26 17:49   ` Mahendra Sondagar
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel @ 2024-04-25 18:57 UTC (permalink / raw)
  To: Mahendra Sondagar, yocto

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

Hi, Mahendra

Try using `useradd` instead of `usermod` for creating your user with the EXTRA_USER_PARAMS feature. Something like this:

EXTRA_USERS_PARAMS : append = "\
useradd -m -s /bin /bash -P 'mahi' root; \
"

[-- Attachment #2: Type: text/html, Size: 902 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] issue adding the user with the yocto kirkstone
  2024-04-25 18:57 ` [yocto] " Daniel
@ 2024-04-26 17:49   ` Mahendra Sondagar
  2024-04-26 19:22     ` Daniel
  0 siblings, 1 reply; 4+ messages in thread
From: Mahendra Sondagar @ 2024-04-26 17:49 UTC (permalink / raw)
  To: Daniel, yocto

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

hi.. @Daniel

Many Thanks for the support

This resolve the issue

EXTRA_USERS_PARAMS += " useradd -m -s /bin/bash -P 'mahi' root;"

however,  when i build the image and try to login with the board then I can't

it's always returning as an incorrect password!

here is the logs .....

stm32mp1 login: root
Password:
Login incorrect

What's wrong with it ?

Thanks

[-- Attachment #2: Type: text/html, Size: 532 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [yocto] issue adding the user with the yocto kirkstone
  2024-04-26 17:49   ` Mahendra Sondagar
@ 2024-04-26 19:22     ` Daniel
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel @ 2024-04-26 19:22 UTC (permalink / raw)
  To: Mahendra Sondagar, yocto

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

You might want to check the "useradd/usermod" options with the "useradd/usermod --help" command. If you want to add a password the flag would be "-p", and this argument expects the password to be encrypted. You can generate this encrypted password with the command: " openssl passwd -1 <password_to_hash_encrypt> ", for example.

Now, I've just noticed that we are referring to the 'root' user, which already exists! In this case, you just need to change its password, and you can use the 'usermod' command with the '-p' flag. Here are the two scenarios:

# Case for adding a new user with password
EXTRA_USERS_PARAMS : append = "\

useradd -m -s /bin /bash -p '<encrypted password>' <new_user>; \
"

# Case for adding a password to an existent user like root
EXTRA_USERS_PARAMS : append = "\
usermod -p '<encrypted password>' root; \
"

Note. Remember to escape characters from the encrypted password. For example, if there are any dollars in your string, escape them with the backslash. For instance:

- '$7abc.$8'
+ '\$7abc.\$8'

—Daniel

[-- Attachment #2: Type: text/html, Size: 2128 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-26 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 18:47 issue adding the user with the yocto kirkstone Mahendra Sondagar
2024-04-25 18:57 ` [yocto] " Daniel
2024-04-26 17:49   ` Mahendra Sondagar
2024-04-26 19:22     ` Daniel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.