The doc says[1]: "SERIAL_CONSOLES_CHECK - no longer necessary because all consoles listed in SERIAL_CONSOLES are checked for their existence before a getty is started." [1]https://docs.yoctoproject.org/dev/singleindex.html#removed-variables I do have the following in my machine configuration for a rootfs, which up to now was able to run on different boards with different serial consoles. SERIAL_CONSOLES ?= "115200;ttyPS0 115200;ttyO0 115200;ttymxc1 115200;ttymxc0 115200;ttyS0 115200;ttyS2 115200;ttySTM0" apparently those are not available on a single board, but ... with the new version the rootfs created includes a /etc/inittab which contains this: # Normally not reached, but fallthrough in case of emergency. z6:6:respawn:/sbin/sulogin PS0:12345:respawn:/usr/sbin/ttyrun ttyPS0 /sbin/getty 115200 ttyPS0 vt102 O0:12345:respawn:/usr/sbin/ttyrun ttyO0 /sbin/getty 115200 ttyO0 vt102 mxc1:12345:respawn:/usr/sbin/ttyrun ttymxc1 /sbin/getty 115200 ttymxc1 vt102 mxc0:12345:respawn:/usr/sbin/ttyrun ttymxc0 /sbin/getty 115200 ttymxc0 vt102 S0:12345:respawn:/usr/sbin/ttyrun ttyS0 /sbin/getty 115200 ttyS0 vt102 S2:12345:respawn:/usr/sbin/ttyrun ttyS2 /sbin/getty 115200 ttyS2 vt102 STM0:12345:respawn:/usr/sbin/ttyrun ttySTM0 /sbin/getty 115200 ttySTM0 vt102 Which is wrong, I would say, and leads e.g. to: INIT: Id "S0" respawning too fast: disabled for 5 minutes INIT: Id "S2" respawning too fast: disabled for 5 minutes root@multi-v7-ml:~# ls -lah /dev/ttyS* crw-rw---- 1 root dialout 4, 64 Jan 1 2000 /dev/ttyS0 crw-rw---- 1 root dialout 4, 65 Jan 1 2000 /dev/ttyS1 crw-rw---- 1 root dialout 4, 66 Jan 1 2000 /dev/ttyS2 crw-rw---- 1 root dialout 4, 67 Jan 1 2000 /dev/ttyS3 crw-rw---- 1 root dialout 4, 68 Jan 1 2000 /dev/ttyS4 root@multi-v7-ml:~# ls -lah /dev/ttymxc* crw------- 1 root tty 207, 17 Jan 6 15:01 /dev/ttymxc1 crw-rw---- 1 root dialout 207, 18 Jan 1 2000 /dev/ttymxc2 root@multi-v7-ml:~# In older versions, with SERIAL_CONSOLES_CHECK present and sysvinit on first boot consoles listed in SERIAL_CONSOLES were checked for their existence and only those present were added to /etc/inittab. In older versions the inittab entry looked like this: # Normally not reached, but fallthrough in case of emergency. z6:6:respawn:/sbin/sulogin mxc1:12345:respawn:/sbin/getty 115200 ttymxc1 vt102 root@multi-v7-ml:~# ls -lah /dev/ttyS* crw-rw---- 1 root dialout 4, 64 Dec 8 18:44 /dev/ttyS0 crw-rw---- 1 root dialout 4, 65 Dec 8 18:44 /dev/ttyS1 crw-rw---- 1 root dialout 4, 66 Dec 8 18:44 /dev/ttyS2 crw-rw---- 1 root dialout 4, 67 Dec 8 18:44 /dev/ttyS3 crw-rw---- 1 root dialout 4, 68 Dec 8 18:44 /dev/ttyS4 root@multi-v7-ml:~# ls -lah /dev/ttymxc* crw------- 1 root tty 207, 17 Jan 6 15:03 /dev/ttymxc1 crw-rw---- 1 root dialout 207, 18 Dec 8 18:44 /dev/ttymxc2 root@multi-v7-ml:~# Not sure what is supposed to happen now.
Looking a bit further into it, it looks like ttyrun does not quite do it's job or at least behaves differently compared to the old behavior. SUMMARY = "Start the program if the specified terminal device is available." DESCRIPTION = "ttyrun is typically used to prevent a respawn through the \ init(8) program when a terminal is not available." HOMEPAGE = "https://github.com/ibm-s390-linux/s390-tools" ----- What ttyrun does is just to see if it can open the device, which means if /dev/xxx is available and it can open it, it's fine. With the old method also a check was made against /proc/consoles root@multi-v7-ml:~# cat /proc/consoles ttymxc1 -W- (EC p ) 207:17 I guess this is what broke it. Currently I am doing a build with the old approach, but probably something like this would be enough: +pkg_postinst:${PN} () { +# run this on host and on target +if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then + exit 0 +fi +} + +pkg_postinst_ontarget:${PN} () { +# run this on the target +if [ -e /proc/consoles ]; then + tmp="${SERIAL_CONSOLES_CHECK}" + for i in $tmp + do + j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g` + k=`echo ${i} | sed s/^.*\://g` + if [ -z "`grep ${j} /proc/consoles`" ]; then + if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then + sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab + fi + fi + done + kill -HUP 1 +else + exit 1 +fi +} +
If I replace meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb with the previous version all seems to work as expected. I also replaced meta/recipes-core/busybox/busybox-inittab_1.36.1.bb, but this does not matter for my current use case. ... Configuring packages on first boot.... (This may take several minutes. Please do not power off the machine.) update-rc.d: /etc/init.d/run-postinsts exists during rc.d purge (continuing) Removing any system startup links for run-postinsts ... /etc/rcS.d/S99run-postinsts ... Now it /etc/inittab looks like this: # Normally not reached, but fallthrough in case of emergency. z6:6:respawn:/sbin/sulogin mxc1:12345:respawn:/sbin/getty 115200 ttymxc1 vt102
Created attachment 5001 [details] reintroduce SERIAL_CONSOLES_CHECK in order to restore the "old behavior" with SERIAL_CONSOLES_CHECK this patches reintroduce SERIAL_CONSOLES_CHECK in combination with ttyrun
Created attachment 5002 [details] reintroduce SERIAL_CONSOLES_CHECK inittab in order to restore the "old behavior" with SERIAL_CONSOLES_CHECK this patches reintroduce SERIAL_CONSOLES_CHECK in combination with ttyrun
First comment: we (I) removed SERIAL_CONSOLES_CHECK because it alters the rootfs on first boot, which means it's impossible to use machines that use it with a read-only rootfs (as you can't edit it on boot) or any form of package management on /etc/inittab (as an upgrade of base-files would delete the changes).
@Ross: Yes I am aware of the behavior with a read only rootfs as documented here: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13921 My problem is, the change in behavior. Before it was possible with a read only rootfs just not to use it. Now with a read/write rootfs consoles are just recognized as such when it's possible to open them even if they are not in /proc/consoles. With a read only rootfs plus overlayfs it might work.
> Now with a read/write rootfs consoles are just recognized as such when it's > possible to open them even if they are not in /proc/consoles. Sounds like the solution is to add a /proc/consoles check to ttyrun?
... also it would be interesting to investigate what happens with systemd. Some checks are done on every boot, but I did not investigate it further with the latest version.