<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15337</bug_id>
          
          <creation_ts>2024-01-06 15:05:34 +0000</creation_ts>
          <short_desc>SERIAL_CONSOLES_CHECK removed, but behavior changed</short_desc>
          <delta_ts>2026-03-26 15:19:00 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>4.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Berger">pokylinux</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>pokylinux</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97752</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-06 15:05:34 +0000</bug_when>
    <thetext>The doc says[1]: &quot;SERIAL_CONSOLES_CHECK - no longer necessary because all consoles listed in SERIAL_CONSOLES are checked for their existence before a getty is started.&quot;

[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 ?= &quot;115200;ttyPS0 115200;ttyO0 115200;ttymxc1 115200;ttymxc0 115200;ttyS0 115200;ttyS2 115200;ttySTM0&quot;

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 &quot;S0&quot; respawning too fast: disabled for 5 minutes
INIT: Id &quot;S2&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97753</commentid>
    <comment_count>1</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-06 19:21:49 +0000</bug_when>
    <thetext>Looking a bit further into it, it looks like ttyrun does not quite do it&apos;s job or at least behaves differently compared to the old behavior.

SUMMARY = &quot;Start the program if the specified terminal device is available.&quot;
DESCRIPTION = &quot;ttyrun is typically used to prevent a respawn through the \
init(8) program when a terminal is not available.&quot;
HOMEPAGE = &quot;https://github.com/ibm-s390-linux/s390-tools&quot;

-----

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&apos;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 [ &quot;${SERIAL_CONSOLES_CHECK}&quot; = &quot;&quot; ]; then
+       exit 0
+fi
+}
+
+pkg_postinst_ontarget:${PN} () {
+# run this on the target
+if [ -e /proc/consoles ]; then
+       tmp=&quot;${SERIAL_CONSOLES_CHECK}&quot;
+       for i in $tmp
+       do
+               j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
+               k=`echo ${i} | sed s/^.*\://g`
+               if [ -z &quot;`grep ${j} /proc/consoles`&quot; ]; then
+                       if [ -z &quot;${k}&quot; ] || [ -z &quot;`grep ${k} /proc/consoles`&quot; ] || [ ! -e /dev/${j} ]; then
+                               sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
+                       fi
+               fi
+       done
+       kill -HUP 1
+else
+       exit 1
+fi
+}
+</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97754</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-06 20:05:45 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97755</commentid>
    <comment_count>3</comment_count>
      <attachid>5001</attachid>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-07 01:10:39 +0000</bug_when>
    <thetext>Created attachment 5001
reintroduce SERIAL_CONSOLES_CHECK

in order to restore the &quot;old behavior&quot; with SERIAL_CONSOLES_CHECK this patches reintroduce SERIAL_CONSOLES_CHECK in combination with ttyrun</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97756</commentid>
    <comment_count>4</comment_count>
      <attachid>5002</attachid>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-07 01:12:47 +0000</bug_when>
    <thetext>Created attachment 5002
reintroduce SERIAL_CONSOLES_CHECK inittab

in order to restore the &quot;old behavior&quot; with SERIAL_CONSOLES_CHECK this patches reintroduce SERIAL_CONSOLES_CHECK in combination with ttyrun</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97780</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-01-11 16:57:34 +0000</bug_when>
    <thetext>First comment: we (I) removed SERIAL_CONSOLES_CHECK because it alters the rootfs on first boot, which means it&apos;s impossible to use machines that use it with a read-only rootfs (as you can&apos;t edit it on boot) or any form of package management on /etc/inittab (as an upgrade of base-files would delete the changes).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97782</commentid>
    <comment_count>6</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-11 18:52:38 +0000</bug_when>
    <thetext>@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&apos;s possible to open them even if they are not in /proc/consoles.

With a read only rootfs plus overlayfs it might work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97783</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-01-12 18:29:37 +0000</bug_when>
    <thetext>&gt; Now with a read/write rootfs consoles are just recognized as such when it&apos;s
&gt; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97786</commentid>
    <comment_count>8</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2024-01-13 09:51:22 +0000</bug_when>
    <thetext>... 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.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5001</attachid>
            <date>2024-01-07 01:10:39 +0000</date>
            <delta_ts>2024-01-07 01:10:39 +0000</delta_ts>
            <desc>reintroduce SERIAL_CONSOLES_CHECK</desc>
            <filename>0031-busybox-add-SERIAL_CONSOLES_CHECK.patch</filename>
            <type>text/plain</type>
            <size>1613</size>
            <attacher name="Robert Berger">pokylinux</attacher>
            
              <data encoding="base64">RnJvbSBhOTIzZTJjNTRmN2Q2MzQ5ZmI4ODVlMzQzMjU4ODk1ZmU0MjIwZjYzIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBSb2JlcnQgQmVyZ2VyIDxSb2JlcnQuQmVyZ2VyQFJlbGlhYmxl
RW1iZWRkZWRTeXN0ZW1zLmNvbT4KRGF0ZTogU2F0LCA2IEphbiAyMDI0IDE4OjMyOjUzICswMDAw
ClN1YmplY3Q6IFtQQVRDSF0gYnVzeWJveDogYWRkIFNFUklBTF9DT05TT0xFU19DSEVDSwoKU2ln
bmVkLW9mZi1ieTogUm9iZXJ0IEJlcmdlciA8Um9iZXJ0LkJlcmdlckBSZWxpYWJsZUVtYmVkZGVk
U3lzdGVtcy5jb20+Ci0tLQogLi4uL2J1c3lib3gvYnVzeWJveC1pbml0dGFiXzEuMzYuMS5iYiAg
ICAgICAgIHwgNDYgKysrKysrKysrKysrKystLS0tLQogMSBmaWxlIGNoYW5nZWQsIDM0IGluc2Vy
dGlvbnMoKyksIDEyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL21ldGEvcmVjaXBlcy1jb3Jl
L2J1c3lib3gvYnVzeWJveC1pbml0dGFiXzEuMzYuMS5iYiBiL21ldGEvcmVjaXBlcy1jb3JlL2J1
c3lib3gvYnVzeWJveC1pbml0d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qfVwgL2QgLWUgL14u
KiR7an0kL2QgL2V0Yy9pbml0dGFiCisgICAgICAgICAgICAgICAgICAgICAgICBmaQorICAgICAg
ICAgICAgICAgIGZpCisgICAgICAgIGRvbmUKKyAgICAgICAga2lsbCAtSFVQIDEKK2Vsc2UKKyAg
ICAgICAgZXhpdCAxCitmaQorfQogCiAjIFNFUklBTF9DT05TT0xFUyBpcyBnZW5lcmFsbHkgZGVm
aW5lZCBieSB0aGUgTUFDSElORSAuY29uZi4KICMgU2V0IFBBQ0tBR0VfQVJDSCBhcHByb3ByaWF0
ZWx5LgotLSAKMi4zNC4xCgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5002</attachid>
            <date>2024-01-07 01:12:47 +0000</date>
            <delta_ts>2024-01-07 01:12:47 +0000</delta_ts>
            <desc>reintroduce SERIAL_CONSOLES_CHECK inittab</desc>
            <filename>0032-sysvinit-inittab-add-SERIAL_CONSOLES_CHECK.patch</filename>
            <type>text/plain</type>
            <size>1685</size>
            <attacher name="Robert Berger">pokylinux</attacher>
            
              <data encoding="base64">RnJvbSBjYzZiMzQyNjg3NDhkMzMwZTNlN2E2NmIxZmMzMzk0YzE5YWM3NTM4IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBSb2JlcnQgQmVyZ2VyIDxSb2JlcnQuQmVyZ2VyQFJlbGlhYmxl
RW1iZWRkZWRTeXN0ZW1zLmNvbT4KRGF0ZTogU2F0LCA2IEphbiAyMDI0IDE4OjM2OjI2ICswMDAw
ClN1YmplY3Q6IFtQQVRDSF0gc3lzdmluaXQtaW5pdHRhYjogYWRkIFNFUklBTF9DT05TT0xFU19D
SEVDSwoKU2lnbmVkLW9mZi1ieTogUm9iZXJ0IEJlcmdlciA8Um9iZXJ0LkJlcmdlckBSZWxpYWJs
ZUVtYmVkZGVkU3lzdGVtcy5jb20+Ci0tLQogLi4uL3N5c3Zpbml0L3N5c3Zpbml0LWlua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Y2hvICR7
aX0gfCBzZWQgcy9eLipcOi8vZ2AKKyAgICAgICAgICAgICAgICBpZiBbIC16ICJgZ3JlcCAke2p9
IC9wcm9jL2NvbnNvbGVzYCIgXTsgdGhlbgorICAgICAgICAgICAgICAgICAgICAgICAgaWYgWyAt
eiAiJHtrfSIgXSB8fCBbIC16ICJgZ3JlcCAke2t9IC9wcm9jL2NvbnNvbGVzYCIgXSB8fCBbICEg
LWUgL2Rldi8ke2p9IF07IHRoZW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2Vk
IC1pIC1lIC9eLioke2p9XCAvZCAtZSAvXi4qJHtqfSQvZCAvZXRjL2luaXR0YWIKKyAgICAgICAg
ICAgICAgICAgICAgICAgIGZpCisgICAgICAgICAgICAgICAgZmkKKyAgICAgICAgZG9uZQorICAg
ICAgICBraWxsIC1IVVAgMQorZWxzZQorICAgICAgICBleGl0IDEKK2ZpCit9CisKICMgVVNFX1ZU
IGFuZCBTRVJJQUxfQ09OU09MRVMgYXJlIGdlbmVyYWxseSBkZWZpbmVkIGJ5IHRoZSBNQUNISU5F
IC5jb25mLgogIyBTZXQgUEFDS0FHRV9BUkNIIGFwcHJvcHJpYXRlbHkuCiBQQUNLQUdFX0FSQ0gg
PSAiJHtNQUNISU5FX0FSQ0h9IgotLSAKMi4zNC4xCgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>