[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#504721: Possible reason for serial console misdetection



Hi,

I looked into it, and here's what I get on my SunBlade 1000 when I 
boot using serial console:

~ # dmesg | grep -i console 
[    0.000000] console [earlyprom0] enabled 
[   53.918290] Console: colour dummy device 80x25 
[   53.971361] console handover: boot [earlyprom0] -> real [tty0] 
[   59.676537] Console: switching to mono PROM 80x34 
[   64.238061] Console: ttyS0 (SAB82532) 
[   64.308951] console [ttyS0] enabled 
~ #

The logic in reopen-console is the following:

1. Look for the 'console handover' line in dmesg output and extract 
whatever is listed there as a "real" console. If it's successful, then 
we are done. In this case this line matches, but it contains an 
incorrect console setting 'tty0', referring to the terminal. As a 
result of this setting the information is still displayed on the 
serial console, but you cannot enter information through it, only 
keyboard input is accepted.

2. If we still don't have a value for the console, look for 'console 
[...] enabled' line(s), and extract console values from it. In this 
case two lines would match, producing console values 'earlyprom0' and 
'ttyS0'. Function also checks whether corresponding devices in /dev 
exist, and if this reduces the number of values to a single console 
value, then this value is chosen. In this case /dev/earlyprom0 does 
not exist, so we would end up with a single 'ttyS0' value, which is 
correct.

So, the problem is that reopen-console gives preference to the value 
in 'console handover' line, which is incorrect on sparc (refers to a 
real terminal console even if one is connecting through serial). If it 
is obvious, that sparc is unique that way, and it works correctly on 
other arches, the following (untested) patch might do the trick:

--- a/src/sbin/reopen-console	2008-09-21 09:29:17.000000000 +0100
+++ b/src/sbin/reopen-console	2008-11-23 22:09:56.000000000 +0000
@@ -12,7 +12,7 @@
 		sed -n -e 's/.*\] console handover: boot \[.*\] -> 
real \[\(.*\)\]$/\1/p')"
 
 	consoles=
-	if [ -z "$console" ]; then
+	if [ -z "$console" ] || [ "$(/bin/archdetect)" = "sparc/sparc64" ]; then
 		# Retrieve all enabled consoles from boot log; ignore those
 		# for which no device file exists
 		for cons in $(dmesg -s 65535 |

I'll try to ask around and see whether current console detection in 
reopen-console is correct for other arches.

By the way, appending console=ttyS0 at the boot prompt fixes the 
problem, so can be used as a temporary workaround.

Cheers.
-- 
Jurij Smakov                                           jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC



Reply to: