<?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>12184</bug_id>
          
          <creation_ts>2017-10-04 19:51:51 +0000</creation_ts>
          <short_desc>sysvinit-inittab_2.88dsf.bb: ${base_bindir}/start_getty?</short_desc>
          <delta_ts>2018-10-12 16:38:10 +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>2.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.5 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Berger">pokylinux</reporter>
          <assigned_to name="Robert Berger">pokylinux</assigned_to>
          <cc>andrea.adami</cc>
    
    <cc>maxin.john</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
    
    <cc>stephano</cc>
    
    <cc>yin.thong.choong</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>77353</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-04 19:51:51 +0000</bug_when>
    <thetext>I use a multi_v7_defconfig kernel[1] with various device trees[2] and apparently different versions of u-boot for different boards.

This means I can keep kernel+rootfs identical between various boards and just need board specific u-boot(s), u-boot configs and appropriate device trees.

I pass the console over the kernel command line and in my machine config I have some dummy 

SERIAL_CONSOLES=&quot;115200;console&quot;

u-boot passes the correct console per board e.g.:

cat /proc/cmdline

console=ttymxc1,115200n8 ip=192.168.42.11:192.168.42.1:192.168.42.1:255.255.255.0:imx6q-phytec-mira-rdk-nand:eth0:off nfsroot=192.168.42.1:/opt/poky/mira-rootfs,v3,tcp noinitrd nohlt panic=1 earlyprintk=ttymxc1,115200n8


My tests with rocko indicated that the boards are not booting anymore which boils down to ${base_bindir}/start_getty being used instead of ${base_sbindir}/getty.

Looks like ${base_bindir}/start_getty freaks out;)

this is what I see in /etc/inittab, which does not work:

sole:12345:respawn:/bin/start_getty 115200 console vt102

if I run /bin/start_getty manually on the board I get:

root@multi-v7-ml:~# /bin/start_getty 115200 console vt102
/bin/start_getty: line 30: [: 1: unary operator expected
/bin/start_getty: line 30: [: 2: unary operator expected
root@multi-v7-ml:~# 

My fix for now to get the board booting is to replace /bin/start_getty with the good old /sbin/getty[4]. Something like a bbappend file, which does this:

do_install_append() {
        sed -i &apos;s/bin\/start_getty/sbin\/getty/&apos; ${D}${sysconfdir}/inittab
}

[1] https://github.com/RobertBerger/meta-mainline/blob/rocko-training-v4.9.x/multi-v7-ml/recipes-kernel/linux/linux-yocto-custom_4.9.44.bb

[2] https://github.com/RobertBerger/meta-mainline/blob/rocko-training-v4.9.x/multi-v7-ml/conf/machine/multi-v7-ml.conf#L114

[3] https://github.com/RobertBerger/meta-mainline/blob/rocko-training-v4.9.x/multi-v7-ml/conf/machine/multi-v7-ml.conf#L90

[4] https://github.com/RobertBerger/meta-mainline/blob/rocko-training-v4.9.x/multi-v7-ml/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bbappend</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77354</commentid>
    <comment_count>1</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-04 19:53:11 +0000</bug_when>
    <thetext>SERIAL_CONSOLES=&quot;115200;console&quot; [3]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77463</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-10-09 16:11:17 +0000</bug_when>
    <thetext>So the problem is that the script expects the console (argument 2 to start_getty) to have an index.

Can you just use a different value for the dummy console?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77731</commentid>
    <comment_count>3</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-20 14:16:32 +0000</bug_when>
    <thetext>@Ross: Where should this index come from?

I could use another value as a dummy console.

What would you suggest?

I see in the official repo[1] e.g. for the Beagle Bone Black:

SERIAL_CONSOLE = &quot;115200 ttyO0&quot;

which is actually deprecated for  

SERIAL_CONSOLES = &quot;115200;console&quot;

and I am not quite sure where this index you are talking about should come from.

[1] https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine/beaglebone.conf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77732</commentid>
    <comment_count>4</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-20 14:20:16 +0000</bug_when>
    <thetext>I&apos;ll try with

SERIAL_CONSOLES = &quot;115200;console1&quot; and see if this makes any difference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77741</commentid>
    <comment_count>5</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-20 15:32:12 +0000</bug_when>
    <thetext>Did not work as well.

If I use a non dummy value it works:

in top level machine config:

SERIAL_CONSOLES=&quot;115200;ttymxc1&quot;

created this inittab:

mxc1:12345:respawn:/bin/start_getty 115200 ttymxc1 vt102

which works for this specific board.

... but how would I create a rootfs which works on various different boards with different consoles with /bin/start_getty as I can do with /sbin/getty?

A dummy console e.g. 

SERIAL_CONSOLES=&quot;115200;ttyres1&quot; does not make /bin/start_getty freak out, but this does not help, since I still don&apos;t get a getty:

INIT: Id &quot;res1&quot; respawning too fast: disabled for 5 minutes</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77742</commentid>
    <comment_count>6</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-10-20 15:38:19 +0000</bug_when>
    <thetext>... and ...

a list of consoles where I add e.g. 2 consoles for 2 boards does not work as well, since one of them will always be invalid which leads to something like this:

Poky (Yocto Project Reference Distro) 2.4 imx6q-phytec-mira-rdk-nand-bsp /dev/ttymxc1

INIT: Id &quot;res1&quot; respawning too fast: disabled for 5 minutes

Poky (Yocto Project Reference Distro) 2.4 imx6q-phytec-mira-rdk-nand-bsp /dev/ttymxc1

imx6q-phytec-mira-rdk-nand-bsp login: 
Poky (Yocto Project Reference Distro) 2.4 imx6q-phytec-mira-rdk-nand-bsp /dev/ttymxc1

imx6q-phytec-mira-rdk-nand-bsp login: 
Poky (Yocto Project Reference Distro) 2.4 imx6q-phytec-mira-rdk-nand-bsp /dev/ttymxc1

imx6q-phytec-mira-rdk-nand-bsp login: root
root@imx6q-phytec-mira-rdk-nand-bsp:~# [   55.641543] random: crng init done

root@imx6q-phytec-mira-rdk-nand-bsp:~# 
root@imx6q-phytec-mira-rdk-nand-bsp:~# 
root@imx6q-phytec-mira-rdk-nand-bsp:~# 
root@imx6q-phytec-mira-rdk-nand-bsp:~#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77952</commentid>
    <comment_count>7</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-11-03 17:24:02 +0000</bug_when>
    <thetext>If we insist that a oe/yocto build has always to be for one very specific board than /bin/start_getty enforces this behaviour and I will need to add this bbappend to my meta layer (which is how I have it right now and how it works for me).

do_install_append() {
        sed -i &apos;s/bin\/start_getty/sbin\/getty/&apos; ${D}${sysconfdir}/inittab
}

The sad thing is, that it worked before the script and the script broke it and it&apos;s not very clear to me what this magic script tries to solve.

I found this:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10844

and this:

https://patchwork.openembedded.org/patch/144225/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80199</commentid>
    <comment_count>8</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2018-04-11 05:47:55 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; @Ross: Where should this index come from?
&gt; 
&gt; I could use another value as a dummy console.
&gt; 
&gt; What would you suggest?
&gt; 
&gt; I see in the official repo[1] e.g. for the Beagle Bone Black:
&gt; 
&gt; SERIAL_CONSOLE = &quot;115200 ttyO0&quot;

This shouldn&apos;t be a problem since we process SERIAL_CONSOLES in bitbake.conf as:

SERIAL_CONSOLES ??= &quot;${@d.getVar(&apos;SERIAL_CONSOLE&apos;).replace(&apos; &apos;, &apos;;&apos;)}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80200</commentid>
    <comment_count>9</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2018-04-11 06:48:17 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; ... and ...
&gt; 
&gt; a list of consoles where I add e.g. 2 consoles for 2 boards does not work as
&gt; well, since one of them will always be invalid which leads to something like
&gt; this:
&gt; 
&gt; Poky (Yocto Project Reference Distro) 2.4 imx6q-phytec-mira-rdk-nand-bsp
&gt; /dev/ttymxc1
&gt; 
&gt; INIT: Id &quot;res1&quot; respawning too fast: disabled for 5 minutes

This generally happens when we set the device in inittab and it is not available (not enabled in kernel)

One way to fix this scenario is to use &quot;SERIAL_CONSOLES_CHECK&quot; instead of SERIAL_CONSOLES. Could you please try this method and see if the error persists ?


commit 5e7d4ca3f34ef2eded0605327feed1f4611fe232
Author: Matthew McClintock &lt;msm@freescale.com&gt;
Date:   Wed Jul 11 18:15:27 2012 -0500

    sysvinit-inittab_2.88dsf.bb: Allow multiple serial port consoles to be defined
    
    Set SERIAL_CONSOLES if you want to define multiple serial consoles, also if
    you need to check for the presence of the serial consoles you can also define
    SERIAL_CONSOLES_CHECK to determine if these are present when you boot. This
    will prevent error message that pop up when the serial port is not present.
    
    SERIAL_CONSOLES = &quot;115200;ttyS0 115200;ttyS1 115200;ttyEHV0&quot;
    SERIAL_CONSOLES_CHECK = &quot;${SERIAL_CONSOLES}&quot;
    
    The above lines in machine.conf or elsewhere will have the effect of having
    two serial consoles and removing any that are not present at boot
    
    (From OE-Core rev: eecd65f188ba2c924626b7e1bf5c8e2eb51e9b59)
    
    Signed-off-by: Saul Wold &lt;sgw@linux.intel.com&gt;
    Signed-off-by: Richard Purdie &lt;richard.purdie@linuxfoundation.org&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80237</commentid>
    <comment_count>10</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2018-04-13 04:57:21 +0000</bug_when>
    <thetext>Please let us know if using &quot;SERIAL_CONSOLES_CHECK&quot; instead of &quot;SERIAL_CONSOLE&quot; fixes this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80395</commentid>
    <comment_count>11</comment_count>
    <who name="Stephano Cetola">stephano</who>
    <bug_when>2018-04-25 09:52:25 +0000</bug_when>
    <thetext>@Robert please see @Maxin&apos;s fix on Comment 9. Let us know if that doesn&apos;t work for you.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80400</commentid>
    <comment_count>12</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-25 23:27:50 +0000</bug_when>
    <thetext>I am currently on the road, so it might take some time to test it.
I do have rocko with the &quot;commit 5e7d4ca3f34ef2eded0605327feed1f4611fe232&quot; inside. Please stay tuned for a while.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80401</commentid>
    <comment_count>13</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-26 01:03:09 +0000</bug_when>
    <thetext>I did a quick test while delivering a training.

machine config:
https://pastebin.com/gaM3GpVj

bootlog excerpt:
https://pastebin.com/F6FCyu2g

new inittab generated (which does not work)
https://pastebin.com/cqXRTTw6

======

This is the bootlog excerpt as it should be:

https://pastebin.com/uaMQhFY0

This is the inittab which works:

https://pastebin.com/RWcZcMPC

Please note, that the magic line in inittab which makes it work is:

sole:12345:respawn:/sbin/getty 115200 console vt102

Am I doing the right thing in machine config?

SERIAL_CONSOLES=&quot;115200;console&quot;
SERIAL_CONSOLES_CHECK = &quot;${SERIAL_CONSOLES}&quot;

Note that console is just a dummy value, which is replaced with the right value by the bootloader:

root@am335x-phytec-wega-bsp:~# cat /proc/cmdline 
console=ttyO0,115200n8 ip=192.168.42.11:192.168.42.1:192.168.42.1:255.255.255.0:am335x-phytec-wega:eth0:off nfsroot=192.168.42.1:/opt/poky/wega-rootfs,v3,tcp noinitrd nohlt panic=1
root@am335x-phytec-wega-bsp:~# 

For this Sitara based board it&apos;s console=ttyO0,115200n8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80405</commentid>
    <comment_count>14</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-26 01:30:34 +0000</bug_when>
    <thetext>I assume, that I should add all the possible consoles for all my boards in SERIAL_CONSOLES.

something like: 

SERIAL_CONSOLES = &quot;115200;ttyO0 115200;ttymxc1&quot;
SERIAL_CONSOLES_CHECK = &quot;${SERIAL_CONSOLES}&quot;

for sitara and i.mx6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80406</commentid>
    <comment_count>15</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-26 02:05:02 +0000</bug_when>
    <thetext>
With a quick check for sitara it seems to work:

inittab:

# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
O0:12345:respawn:/bin/start_getty 115200 ttyO0 vt102</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80427</commentid>
    <comment_count>16</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2018-04-26 22:14:07 +0000</bug_when>
    <thetext>(In reply to comment #15)
&gt; With a quick check for sitara it seems to work:
&gt; 
&gt; inittab:
&gt; 
&gt; # Normally not reached, but fallthrough in case of emergency.
&gt; z6:6:respawn:/sbin/sulogin
&gt; O0:12345:respawn:/bin/start_getty 115200 ttyO0 vt102

Good to hear that it worked for you. Do you think it is fine to close this bug, then ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80431</commentid>
    <comment_count>17</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-26 23:28:11 +0000</bug_when>
    <thetext>If you like you can close it. I would like to test it on a few more boards just to be sure it works for my use case.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80434</commentid>
    <comment_count>18</comment_count>
    <who name="Maxin B. John">maxin.john</who>
    <bug_when>2018-04-27 03:13:48 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; If you like you can close it. I would like to test it on a few more boards
&gt; just to be sure it works for my use case.
&gt; 
&gt; Thanks!

Sure. Please feel free to reopen this, if you run into any troubles while testing on other boards.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>