问题
I am new in yocto project and I simply want to disable root login in yocto build image? I do not want my final image to ask me for login. Simply I need to flash my yocto image on sdcard and no login prompt shows.
Any help is appreciated.
回答1:
If you are using systemd, in the file meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service change the ExecStart in the service to this :
ExecStart=-/sbin/agetty -a USERNAME -8 -L %I @BAUDRATE@ $TERM
change USERNAME to root or other.
回答2:
iF YOU ARE USING SYSTEM V Add below lines in build/conf/local.conf file.
EXTRA_IMAGE_FEATURES = "debug-tweaks "
IMAGE_INSTALL_append = " mingetty "
Now the below recipe provide the serial inittab open file and look at the do_install function
poky/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
./poky/meta/recipes-core/sysvinit/sysvinit-inittab/inittab
#1:2345:respawn:/sbin/getty 38400 tty1 #comment this line in bb file
1:2345:respawn:/sbin/mingetty --autologin root tty1 # add this line
回答3:
When you create your image, add debug-tweaks to EXTRA_IMAGE_FEATURES, this will allow no password to root. and add mingetty.
EXTRA_IMAGE_FEATURES = "debug-tweaks "
IMAGE_INSTALL_append = " mingetty "
After that, edit /etc/inittab, comment out the previous line and use mingetty for autologin;
#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/sbin/mingetty --autologin root tty1
来源:https://stackoverflow.com/questions/43780096/disable-root-login-in-yocto-build