have busybox prompt for password in initramfs boot


Embedded 1
 

when I boot my initramfs and run init=/bin/sh I'm not prompted for a password. How can I require a password before entering the shell?

This is my initramfs recipe

IMAGE_FEATURES = ""
EXTRA_IMAGE_FEATURES = ""

export IMAGE_BASENAME = "test-initramfs"
IMAGE_LINGUAS = ""

PACKAGE_INSTALL = "\
  base-files \
  base-passwd \
  busybox \
"

IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"

inherit core-image

inherit extrausers
EXTRA_USERS_PARAMS = "usermod -p $(openssl passwd test) root;"



Michael Opdenacker
 

Hello

On 4/23/22 22:56, Embedded 1 wrote:
when I boot my initramfs and run init=/bin/sh I'm not prompted for a
password. How can I require a password before entering the shell?

That's what you get when you use /bin/sh as the init process. Instead,
you could use the normal init program built in your image (which one it
is, Systemd or BusyBox init?), and get it to run the getty program
instead to get a login prompt.

Cheers
Michael.

--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Embedded 1
 

On 4/23/22 22:56, Embedded 1 wrote:
when I boot my initramfs and run init=/bin/sh I'm not prompted for a
password. How can I require a password before entering the shell?

That's what you get when you use /bin/sh as the init process. Instead,
you could use the normal init program built in your image (which one it
is, Systemd or BusyBox init?), and get it to run the getty program
instead to get a login prompt.
oh, I see. thanks!