Skip to contentSkip to conversation

Serial console unusable with poky-image-sdk

DISCUSSION Wolfgang Denk 4 participants 10 messages Jan 27, 2011 – Jan 28, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

it seems that for some time (probably back to laverne-4.0) the serial console port is basicly unusable in the poky-image-sdk file system. I tried this in several PPC and ARM configurations, and the behaviours is pretty much the same: login works fine, but at the shell prompt only one out of N input characters (N usually between 2 and 10) gets through to the shell.

I found that dbus-launch (running as "dbus-launch --sh-syntax --exit-with-session") is also reading from /dev/console and "eating" the missing characters.

As soon as I stop the Xserver ("sh /etc/init.d/xserver-nodm stop") the serial console starts wroking fine (because dbus-launch is not running any more).

Is there a way to stop dbus-launch from concurring with a login shell on the serial console port?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Do not follow where the path may lead....go instead where there is no
path and leave a trail.
#1 lore raw

Hi,

Quoted 7 lines · in message <[email protected]> I wrote:

it seems that for some time (probably back to laverne-4.0) the serial console port is basicly unusable in the poky-image-sdk file system. I tried this in several PPC and ARM configurations, and the behaviours is pretty much the same: login works fine, but at the shell prompt only one out of N input characters (N usually between 2 and 10) gets through to the shell.

...

Quoted 2 lines

Is there a way to stop dbus-launch from concurring with a login shell on the serial console port?

This patch appears to be working fine for me:

Quoted 2 lines

From: Wolfgang Denk <[email protected]>
Subject: Stop dbus-launch from interfering with a serial console

---

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +1 -1
index a87447a..0b73127 100644
@@ -2,7 +2,7 @@
 
 if [ -x /usr/bin/dbus-launch ]; then
     # As this is the X session script, always start a new DBus session.
-    eval `dbus-launch --sh-syntax --exit-with-session`
+    eval `dbus-launch --sh-syntax --exit-with-session </dev/null`
     echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
 fi
 

---

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
The first thing we do is kill all the lawyers.
(Shakespeare. II Henry VI, Act IV, scene ii)
#2 lore raw
Quoted 27 lines · Wolfgang Denk

Hi,

Quoted 7 lines · in message<[email protected]> I wrote:

it seems that for some time (probably back to laverne-4.0) the serial console port is basicly unusable in the poky-image-sdk file system. I tried this in several PPC and ARM configurations, and the behaviours is pretty much the same: login works fine, but at the shell prompt only one out of N input characters (N usually between 2 and 10) gets through to the shell.

...

Quoted 2 lines

Is there a way to stop dbus-launch from concurring with a login shell on the serial console port?

This patch appears to be working fine for me:

Quoted 2 lines

From: Wolfgang Denk<[email protected]>
Subject: Stop dbus-launch from interfering with a serial console

---

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +0 -0
index a87447a..0b73127 100644

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession line 8

Quoted 8 lines
meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +1 -1
@@ -2,7 +2,7 @@
 
  if [ -x /usr/bin/dbus-launch ]; then
      # As this is the X session script, always start a new DBus session.
-    eval `dbus-launch --sh-syntax --exit-with-session`
+    eval `dbus-launch --sh-syntax --exit-with-session</dev/null`
      echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
  fi
 

you can also append "console=tty" to the kernel command line and the serial console should work. I've run into this on a couple platforms as well and addressed it this way. This isn't just an X11 issue as I usually boot -minimal images.

Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#3 lore raw

Dear Darren Hart,

Quoted 18 lines · In message <[email protected]> you wrote:
Quoted 18 lines
Quoted 3 lines

Is there a way to stop dbus-launch from concurring with a login shell on the serial console port?

This patch appears to be working fine for me:

Quoted 2 lines

From: Wolfgang Denk<[email protected]>
Subject: Stop dbus-launch from interfering with a serial console

---

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +0 -0
index a87447a..0b73127 100644
@@ -2,7 +2,7 @@
 
Quoted 12 lines

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession line 8

Quoted 7 lines
meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +1 -1
  if [ -x /usr/bin/dbus-launch ]; then
      # As this is the X session script, always start a new DBus session.
-    eval `dbus-launch --sh-syntax --exit-with-session`
+    eval `dbus-launch --sh-syntax --exit-with-session</dev/null`
      echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
  fi
 

you can also append "console=tty" to the kernel command line and the serial console should work. I've run into this on a couple platforms as well and addressed it this way. This isn't just an X11 issue as I usually boot -minimal images.

I think you misunderstand. It is not that the serial console port is not working at all, or that there are any wrong assignments to the Linux console device.

The problem is that after logging in both the shell and the dbus-launch processes will read from the same device, and it is pur chance which of these provesses will read which input character.

The problem is that dbus-launch should not read from the console terminal at all, and this is what above patch enforces.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
"Engineering without management is art."               - Jeff Johnson
#4 lore raw
Quoted 38 lines · Wolfgang Denk

Dear Darren Hart,

Quoted 18 lines · In message<[email protected]> you wrote:
Quoted 18 lines
Quoted 3 lines

Is there a way to stop dbus-launch from concurring with a login shell on the serial console port?

This patch appears to be working fine for me:

Quoted 2 lines

From: Wolfgang Denk<[email protected]>
Subject: Stop dbus-launch from interfering with a serial console

---

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +0 -0
index a87447a..0b73127 100644
@@ -2,7 +2,7 @@
 
Quoted 12 lines

meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession line 8

Quoted 7 lines
meta/recipes-graphics/x11-common/x11-common/etc/X11/Xsession +1 -1
   if [ -x /usr/bin/dbus-launch ]; then
       # As this is the X session script, always start a new DBus session.
-    eval `dbus-launch --sh-syntax --exit-with-session`
+    eval `dbus-launch --sh-syntax --exit-with-session</dev/null`
       echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
   fi
 

you can also append "console=tty" to the kernel command line and the serial console should work. I've run into this on a couple platforms as well and addressed it this way. This isn't just an X11 issue as I usually boot -minimal images.

I think you misunderstand. It is not that the serial console port is not working at all, or that there are any wrong assignments to the Linux console device.

Quoted 6 lines

The problem is that after logging in both the shell and the dbus-launch processes will read from the same device, and it is pur chance which of these provesses will read which input character.

The problem is that dbus-launch should not read from the console terminal at all, and this is what above patch enforces.

Actually, this is precisely the behavior I was seeing on other boards. The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last console= parameter becomes /dev/console, if only serial is specified this seems to conflict with the getty started via inittab. If you add a second console directive after the first, /dev/console will point to that. console=/dev/tty0 works for example. Using /dev/tty however instructs the kernel to use an automatic console on all tty's - except the serial ports, which also resolves the problem for me.

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

Thanks,

Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#5 lore raw

Dear Darren Hart,

Quoted 5 lines · In message <[email protected]> you wrote:

The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

Indeed. And the reason for this behaviour is that you have two processes reading from the console, so it depends on the scheduling which of hem receives which characters.

Quoted 2 lines

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last

No, it does not. You can test it by shutting down X11 (try:
"/etc/init.d/xserver-nodm stop"); this will also terminate the dbus-launch process, and your login shell immediately works fine.

Or try out the patch I posted.

Quoted 6 lines

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

THere is no problem with the console= settings. It's two processes reading from a single input stream. This can never work. Try it ut if you don't believe me.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Ernest asks Frank how long he has been working for the company.
        "Ever since they threatened to fire me."
#6 lore raw
Quoted 29 lines · Wolfgang Denk

Dear Darren Hart,

Quoted 5 lines · In message<[email protected]> you wrote:

The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

Indeed. And the reason for this behaviour is that you have two processes reading from the console, so it depends on the scheduling which of hem receives which characters.

Quoted 2 lines

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last

No, it does not. You can test it by shutting down X11 (try:
"/etc/init.d/xserver-nodm stop"); this will also terminate the dbus-launch process, and your login shell immediately works fine.

Or try out the patch I posted.

Quoted 6 lines

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

Quoted 3 lines

THere is no problem with the console= settings. It's two processes reading from a single input stream. This can never work. Try it ut if you don't believe me.

Wolfgang has it spot-on - both the console login and dbus are fighting over the console device.

I've been using the equivalent of this patch for months and it solves the problem just fine. (Sorry I didn't report it, it wasn't high on my list)

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

Disconnect console from dbus - otherwise, serial console is unusable if X session is running.

etc/X11/Xsession +1 -1
diff -ur x11-common.ORIG/etc/X11/Xsession x11-common/etc/X11/Xsession
@@ -2,7 +2,7 @@
 
 if [ -x /usr/bin/dbus-launch ]; then
     # As this is the X session script, always start a new DBus session.
-    eval `dbus-launch --sh-syntax --exit-with-session`
+    eval `dbus-launch --sh-syntax --exit-with-session </dev/null`
     echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
 fi
#7 lore raw
Quoted 34 lines · Gary Thomas
Quoted 29 lines · Wolfgang Denk

Dear Darren Hart,

Quoted 5 lines · In message<[email protected]> you wrote:

The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

Indeed. And the reason for this behaviour is that you have two processes reading from the console, so it depends on the scheduling which of hem receives which characters.

Quoted 2 lines

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last

No, it does not. You can test it by shutting down X11 (try:
"/etc/init.d/xserver-nodm stop"); this will also terminate the dbus-launch process, and your login shell immediately works fine.

Or try out the patch I posted.

Quoted 6 lines

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

Quoted 3 lines

THere is no problem with the console= settings. It's two processes reading from a single input stream. This can never work. Try it ut if you don't believe me.

Quoted 6 lines

Wolfgang has it spot-on - both the console login and dbus are fighting over the console device.

I've been using the equivalent of this patch for months and it solves the problem just fine. (Sorry I didn't report it, it wasn't high on my list)

FWIW I've now merged Wolfgang's patch into master.

If there are issues like this please do tell us about them as its good to get them fixed.

Cheers,

Richard

#8 lore raw
In reply to Wolfgang Denk
Quoted 13 lines · Wolfgang Denk

Dear Darren Hart,

Quoted 5 lines · In message<[email protected]> you wrote:

The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

Indeed. And the reason for this behaviour is that you have two processes reading from the console, so it depends on the scheduling which of hem receives which characters.

Quoted 8 lines
Quoted 2 lines

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last

No, it does not. You can test it by shutting down X11 (try:
"/etc/init.d/xserver-nodm stop"); this will also terminate the dbus-launch process, and your login shell immediately works fine.

Or try out the patch I posted.

I'm not running X11, this is just a poky-image-minimal.

Quoted 11 lines
Quoted 7 lines

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

THere is no problem with the console= settings. It's two processes reading from a single input stream. This can never work. Try it ut if you don't believe me.

Agreed on the two processes thing, that's clear. I believe the console= settings impact which processes are started and which read from which console devices.

And again, I can't try your patch, because I'm not running X.

Perhaps we are seeing similar problems caused by different things.

Signature · 3 lines
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
#9 lore raw
Quoted 39 lines · Darren Hart
Quoted 13 lines · Wolfgang Denk

Dear Darren Hart,

Quoted 5 lines · In message<[email protected]> you wrote:

The serial console would show all the output of the boot process and then present a getty. It would accept my login and my password, but as soon as I was logged in, things went weird. Only every Nth character I typed made it to the console, where N was somewhere between 2 and 30.

Indeed. And the reason for this behaviour is that you have two processes reading from the console, so it depends on the scheduling which of hem receives which characters.

Quoted 8 lines
Quoted 2 lines

I believe this had something to do with the automatic consoles the kernel will setup based on the console= parameters. By default, the last

No, it does not. You can test it by shutting down X11 (try:
"/etc/init.d/xserver-nodm stop"); this will also terminate the dbus-launch process, and your login shell immediately works fine.

Or try out the patch I posted.

I'm not running X11, this is just a poky-image-minimal.

Quoted 11 lines
Quoted 7 lines

What I haven't been able to explain yet is why just omitting the getty from the tty doesn't result in console on the serial port due to the kernel's automatic console thing. So clearly there are some gaps in my explanation here, but please try this approach and let me know what your results are. Based on that, we can dig a bit more and figure out how to best setup the console= directives on the default images.

THere is no problem with the console= settings. It's two processes reading from a single input stream. This can never work. Try it ut if you don't believe me.

Quoted 7 lines

Agreed on the two processes thing, that's clear. I believe the console= settings impact which processes are started and which read from which console devices.

And again, I can't try your patch, because I'm not running X.

Perhaps we are seeing similar problems caused by different things.

Regardless, I think we should take the patch since we have at least two users seeing issues due to it.

Saul or I will ensure it gets in, I keep meaning to merge it but then get distracted...

Cheers,

Richard