Debian Bug report logs - #416310
grub-installer: serial console not properly enabled

version graph

Package: grub-installer; Maintainer for grub-installer is Debian Install System Team <debian-boot@lists.debian.org>; Source for grub-installer is src:grub-installer.

Reported by: Vagrant Cascadian <vagrant+debianbugs@freegeek.org>

Date: Mon, 26 Mar 2007 20:12:01 UTC

Severity: normal

Tags: patch

Found in version grub-installer/1.22

Fixed in versions grub-installer/1.23, grub-installer/1.22etch1

Done: Jérémy Bobbio <lunar@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to Vagrant Cascadian <vagrant+debianbugs@freegeek.org>:
New Bug report received and forwarded. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Vagrant Cascadian <vagrant+debianbugs@freegeek.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: grub-installer: serial console not properly enabled
Date: Mon, 26 Mar 2007 13:08:25 -0700
Package: grub-installer
Version: 1.22
Severity: normal

i booted debian-installer with "console=ttyS0,38400" using within a qemu
environment with the "-nographic" option:

Mar 26 18:11:59 kernel: Kernel command line: preseed/file=/cdrom/simple-cdd/default.preseed console=ttyS0,38400 vga=normal initrd=/install.386/initrd.gz -- BOOT_IMAGE=/install.386/vmlinuz

but serial support was not properly enabled for grub or the console
itself on the installed system... (there was a getty started
appropriately, thankfully)

/boot/grub/menu.lst contained the following two lines at the very top:

serial --unit=0 --speed=38400 --word=console=ttyS0,38400 --parity= --stop=1
terminal serial

i tried various combintions of removing --word, --parity and --stop
options to serial, but it required removing both the --word and --parity
options, so the line i got working was:

serial --unit=0 --speed=38400 --stop=1

it also workd without the "--stop=1" part.  i don't know what --word is
supposed to add, and maybe --parity should only be added if it's set to
something?


in order to get linux to recognize the serial console, i had to manually
add "console=ttyS0,38400" to the kopt line, and then run update-grub:

# kopt=root=/dev/hda1 ro console=ttyS0,38400


live well,
  vagrant



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to "Alex Owen" <r.alex.owen@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 416310@bugs.debian.org (full text, mbox):

From: "Alex Owen" <r.alex.owen@gmail.com>
To: 416310@bugs.debian.org
Subject: My Fault!
Date: Tue, 27 Mar 2007 20:26:18 +0100
Hello there,
I'm afraid this is my fault.

I supplied a patch to make grub-installer try to do the right thing in
bug http://bugs.debian.org/224641

However the code added there assumes a FULL serial port definition on
the kernel command line. eg: for the example Vagrant gives in this bug
report "console=ttyS0,38400n8" _should_ work  (i tested this when
writing the patch) while the shorter "console=ttyS0,38400" will not
(and was not tested - opps!).

Also it is preferable to add the "console=" argument after the "--"
argument that way it will be taken as a user supplied argument that
should be added to the "#kopt=" line in the grub.conf

Perhaps this should be included in the release notes for Etch?

For Lenny the code should parse the "console=" parameter more properly!



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to Frans Pop <elendil@planet.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #15 received at 416310@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: Alex Owen <r.alex.owen@gmail.com>, 416310@bugs.debian.org
Subject: Re: Bug#416310: My Fault!
Date: Tue, 27 Mar 2007 21:50:02 +0200
On Tuesday 27 March 2007 21:26, Alex Owen wrote:
> Perhaps this should be included in the release notes for Etch?

No, at most in the D-I errata I would say.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to "Alex Owen" <r.alex.owen@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #20 received at 416310@bugs.debian.org (full text, mbox):

From: "Alex Owen" <r.alex.owen@gmail.com>
To: "Frans Pop" <elendil@planet.nl>
Cc: 416310@bugs.debian.org
Subject: Re: Bug#416310: My Fault!
Date: Tue, 27 Mar 2007 21:46:58 +0100
On 27/03/07, Frans Pop <elendil@planet.nl> wrote:
> On Tuesday 27 March 2007 21:26, Alex Owen wrote:
> > Perhaps this should be included in the release notes for Etch?
>
> No, at most in the D-I errata I would say.
>

Proposed entry for d-i errata:

<dt>i386: Serial Console setup with GRUB</dt>
<dd>
There are some issues with the way the debian-installer tries to
setup GRUB to use a serial console. Full details can be found in the
bug report <a
href="http://bugs.debian.org/416310">#416310</a>.
Briefly these issues can be resolved
by ensuring that:<br> (1) the "<tt>console=</tt>" kernel argument is passed
after the "<tt>--</tt>" kernel argument;<br> (2) that the parity and
bits options are
also passed in the "<tt>console=</tt>" definition. For most people
this will mean that
instead of booting with "<tt>console=ttyS0,9600</tt>" you should boot
with "<tt>--
console=ttyS0,9600n8</tt>".
</dd>



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to "Alex Owen" <r.alex.owen@gmail.com>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #25 received at 416310@bugs.debian.org (full text, mbox):

From: "Alex Owen" <r.alex.owen@gmail.com>
To: "Frans Pop" <elendil@planet.nl>, "Vagrant Cascadian" <vagrant+debianbugs@freegeek.org>
Cc: 416310@bugs.debian.org
Subject: [Patch] fix fault in grub_serial_console
Date: Tue, 27 Mar 2007 23:35:09 +0100
[Message part 1 (text/plain, inline)]
This bug lies in the grub-installer script in the function grub_serial_console.
Attached is the file grub_serial_console.txt is a replacement
grub_serial_console function which parses the kernel command line
"console=" argument in a more robust and (I hope) readable manner.

A test script test.sh is also attached which can be used to excercise
the grub_serial_console  function in the file grub_serial_console.txt.

I know this is very late in the release cycle but I would like to see
this rewrite of
grub_serial_console enter d-i for Etch.

Regards
Alex Owen

[For Lenny: While rewriting grub_serial_console I thought I would tidy
up the function get_serial_console. Attached is the file
get_serial_console.txt which contains a drop-in replacement for the
function get_serial_console. This should _not_ be targeted at Etch]
[grub_serial_console.txt (text/plain, attachment)]
[test.sh (application/x-sh, attachment)]
[get_serial_console.txt (text/plain, attachment)]

Tags added: patch Request was from "Alex Owen" <r.alex.owen@gmail.com> to control@bugs.debian.org. (Tue, 27 Mar 2007 22:42:06 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to Frans Pop <elendil@planet.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #32 received at 416310@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: Alex Owen <r.alex.owen@gmail.com>, 416310@bugs.debian.org
Subject: Re: Bug#416310: [Patch] fix fault in grub_serial_console
Date: Thu, 29 Mar 2007 00:38:17 +0200
[Message part 1 (text/plain, inline)]
On Wednesday 28 March 2007 00:35, Alex Owen wrote:
> I know this is very late in the release cycle but I would like to see
> this rewrite of grub_serial_console enter d-i for Etch.

No, sorry. This issue is too minor to run the risk of regressions.

I spotted a few serious issues with the new version for 
grub_serial_console in the following two lines:
        [ $word ] && local word="--word=$word"
        [ $speed ] || local speed=9600 #Match Kernel Default

- In the tests the variables need to be quoted to avoid a syntax error
  when they are empty.
- As the script is run with 'set -e' the first line will cause the
  script to abort when the variable is empty as there is no "||".

In both cases it would be better to use real if/then statements.

Cheers,
FJP
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to 416310@bugs.debian.org:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #37 received at 416310@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: Alex Owen <r.alex.owen@gmail.com>, 416310@bugs.debian.org
Subject: Re: Bug#416310: My Fault!
Date: Thu, 29 Mar 2007 04:02:41 +0200
[Message part 1 (text/plain, inline)]
On Tuesday 27 March 2007 22:46, Alex Owen wrote:
> Proposed entry for d-i errata:

Added, but without the bit about adding "--" as that should work correctly 
by default. Thanks for the proposed text.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to Frans Pop <elendil@planet.nl>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #42 received at 416310@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: 416310@bugs.debian.org
Subject: Bug#416310: grub-installer: serial console not properly enabled
Date: Tue, 10 Apr 2007 16:49:07 +0200
[Message part 1 (text/plain, inline)]
tags 416310 pending
thanks

I have used the main ideas from Alex Owen's patch, but implemented some parts
a bit differently as I felt it could be further simplified.

Below the patch as committed in SVN. Comments welcome.

Cheers,
FJP

--- grub-installer      (revision 46252)
+++ grub-installer      (working copy)
@@ -33,32 +33,42 @@
 }

 get_serial_console() {
-       local defconsole="$(sed -e 's/.*console=/console=/' /proc/cmdline)"
-       if echo "${defconsole}" | grep -q console=ttyS; then
-               local PORT="$(echo "${defconsole}" | sed -e 's%^console=ttyS%%' -e 's%,.*%%')"
-               local SPEED="$(echo "${defconsole}" | sed -e 's%^console=ttyS[0-9]\+,%%' -e 's% .*%%')"
-               local SERIAL="ttyS${PORT},${SPEED}"
-               echo "console=$SERIAL"
+       # Get the last 'console=' entry (if none, the whole string is returned)
+       local defconsole="$(sed -e 's/.*\(console=[^ ]*\).*/\1/' /proc/cmdline)"
+       if echo "$defconsole" | grep -q console=ttyS; then
+               echo "$defconsole"
        fi
 }

 grub_serial_console() {
        #$1=output of get_serial_console
-       local unit=$(echo $1 | sed -e 's%^console=ttyS%%' -e 's%,.*%%')
-       local speed=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,%%' -e 's%[^(0-9)].*%%')
-       local parity=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+%%' -e 's%[78].*%%')
+       local serconsole=${1##console=}
+       local device=${serconsole%%,*}
+       local unit=${device##ttyS}
+       local options=""
+       if echo $serconsole | grep -q ","; then
+               options=${serconsole##*,}
+       fi
+       local speed=$(echo "$options" | sed -e 's/^\([0-9]\+\).*$/\1/')
+       options=${options##${speed}}
+       local parity=${options:0:1}
+       local word=${options:2:1}
+       if [ -z "$speed" ]; then
+               speed="9600"
+       fi
        case "$parity" in
-               "n") local parity="no" ;;
-               "e") local parity="even" ;;
-               "o") local parity="odd" ;;
-               *)   local parity="" ;;
+               n) parity="--parity=no" ;;
+               e) parity="--parity=even" ;;
+               o) parity="--parity=odd" ;;
+               *) parity="" ;;
        esac
-       local word=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen]%%' -e 's%r%%')
-       local flow=$(echo $1 | sed -e 's%^console=ttyS[0-9]\+,[0-9]\+[oen][78]%%')
+       if [ "$word" ]; then
+               word="--word=$word"
+       fi

-       echo serial --unit=$unit --speed=$speed --word=$word --parity=$parity --stop=1
+       echo serial --unit=$unit --speed=$speed $word $parity --stop=1
        echo terminal serial
-       }
+}

 serial="$(get_serial_console)"
[Message part 2 (application/pgp-signature, inline)]

Tags added: pending Request was from Frans Pop <elendil@planet.nl> to control@bugs.debian.org. (Tue, 10 Apr 2007 14:51:41 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#416310; Package grub-installer. Full text and rfc822 format available.

Acknowledgement sent to Otavio Salvador <otavio@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. Full text and rfc822 format available.

Message #49 received at 416310@bugs.debian.org (full text, mbox):

From: Otavio Salvador <otavio@debian.org>
To: 416310@bugs.debian.org
Subject: Re: Bug#416310: grub-installer: serial console not properly enabled
Date: Tue, 10 Apr 2007 13:25:22 -0300
Frans Pop <elendil@planet.nl> writes:

> tags 416310 pending
> thanks
>
> I have used the main ideas from Alex Owen's patch, but implemented some parts
> a bit differently as I felt it could be further simplified.

It looks pretty good.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



Reply sent to Joey Hess <joeyh@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Vagrant Cascadian <vagrant+debianbugs@freegeek.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #54 received at 416310-close@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: 416310-close@bugs.debian.org
Subject: Bug#416310: fixed in grub-installer 1.23
Date: Tue, 10 Apr 2007 20:32:17 +0000
Source: grub-installer
Source-Version: 1.23

We believe that the bug you reported is fixed in the latest version of
grub-installer, which is due to be installed in the Debian FTP archive:

grub-installer_1.23.dsc
  to pool/main/g/grub-installer/grub-installer_1.23.dsc
grub-installer_1.23.tar.gz
  to pool/main/g/grub-installer/grub-installer_1.23.tar.gz
grub-installer_1.23_i386.udeb
  to pool/main/g/grub-installer/grub-installer_1.23_i386.udeb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 416310@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Joey Hess <joeyh@debian.org> (supplier of updated grub-installer package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 10 Apr 2007 14:47:50 -0400
Source: grub-installer
Binary: grub-installer
Architecture: source i386
Version: 1.23
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Joey Hess <joeyh@debian.org>
Description: 
 grub-installer - Install GRUB on a hard disk (udeb)
Closes: 413855 416310
Changes: 
 grub-installer (1.23) unstable; urgency=low
 .
   [ Colin Watson ]
   * Drop dependency on dmidecode-udeb and rely on new archdetect support for
     Intel Macs (closes: #413855). Requires libdebian-installer4-udeb 0.51.
 .
   [ Frans Pop ]
   * Enable the option to select grub2 again.
   * Improve code that sets serial console parameters. Closes: #416310.
     Changes based on a patch by Alex Owen.
 .
   [ Joey Hess ]
   * Multiply menu-item-numbers by 100
 .
   [ Updated translations ]
   * Esperanto (eo.po) by Serge Leblanc
   * Spanish (es.po) by Javier Fernández-Sanguino Peña
   * Norwegian Bokmål (nb.po) by Bjørn Steensrud
Files: 
 3acfd1d51e567a40faf97922dc92b4bb 755 debian-installer standard grub-installer_1.23.dsc
 ea5fd1936dc42116a0197a86af7cf2f9 122954 debian-installer standard grub-installer_1.23.tar.gz
 bbc2d192688152ba3c25e019e19d81be 109592 debian-installer standard grub-installer_1.23_i386.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGG+y62tp5zXiKP0wRAhb9AJ9x3zFv/0ug8t6sY2/mcNsia04oHwCguIpm
EUet8YVPwcyWeG6L95fohGE=
=HTJk
-----END PGP SIGNATURE-----




Reply sent to Jérémy Bobbio <lunar@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Vagrant Cascadian <vagrant+debianbugs@freegeek.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #59 received at 416310-close@bugs.debian.org (full text, mbox):

From: Jérémy Bobbio <lunar@debian.org>
To: 416310-close@bugs.debian.org
Subject: Bug#416310: fixed in grub-installer 1.22etch1
Date: Sat, 29 Sep 2007 07:56:18 +0000
Source: grub-installer
Source-Version: 1.22etch1

We believe that the bug you reported is fixed in the latest version of
grub-installer, which is due to be installed in the Debian FTP archive:

grub-installer_1.22etch1.dsc
  to pool/main/g/grub-installer/grub-installer_1.22etch1.dsc
grub-installer_1.22etch1.tar.gz
  to pool/main/g/grub-installer/grub-installer_1.22etch1.tar.gz
grub-installer_1.22etch1_amd64.udeb
  to pool/main/g/grub-installer/grub-installer_1.22etch1_amd64.udeb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 416310@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jérémy Bobbio <lunar@debian.org> (supplier of updated grub-installer package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Fri, 21 Sep 2007 12:12:01 +0200
Source: grub-installer
Binary: grub-installer
Architecture: source amd64
Version: 1.22etch1
Distribution: stable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Jérémy Bobbio <lunar@debian.org>
Description: 
 grub-installer - Install GRUB on a hard disk (udeb)
Closes: 416310
Changes: 
 grub-installer (1.22etch1) stable; urgency=low
 .
   [ Frans Pop ]
   * Improve code that sets serial console parameters. Closes: #416310.
     Changes based on a patch by Alex Owen.
Files: 
 3a10a7e59d6491ee5c03c0fc138272e1 765 debian-installer standard grub-installer_1.22etch1.dsc
 6f262c2792a0aabc0a8b5a4652e9fff9 123052 debian-installer standard grub-installer_1.22etch1.tar.gz
 6036e8cab5b4cfbda6c120d45722a4a0 109722 debian-installer standard grub-installer_1.22etch1_amd64.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG85nG2PUjs9fQ72URArE2AKCdeXOBGbp/FoMeX15BqkS+56jYPQCbBsq2
+DSxVChdL7Cy15KFi9KLifU=
=8l3B
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 22 Jan 2008 07:26:52 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 11:29:49 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.