Debian Bug report logs - #484366
rootskel: cttyhack requires the serial console to be /dev/ttyS0

version graph

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

Reported by: Daniel Jacobowitz <dan@debian.org>

Date: Tue, 3 Jun 2008 21:42:02 UTC

Severity: normal

Tags: patch

Merged with 488441

Found in version rootskel/1.62

Fixed in version rootskel/1.66

Done: Otavio Salvador <otavio@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#484366; Package rootskel. Full text and rfc822 format available.

Acknowledgement sent to Daniel Jacobowitz <dan@debian.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: Daniel Jacobowitz <dan@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: rootskel: cttyhack requires the serial console to be /dev/ttyS0
Date: Tue, 03 Jun 2008 17:40:58 -0400
Package: rootskel
Version: 1.62
Severity: normal

I tried to install Debian on Versatile/PB using qemu and the armel
installer (Lenny beta 1).  It is quickly stuck complaining
"cttyhack: '/dev/ttyS0': No such file or device".

That's because the serial port on Versatile is named ttyAMA0.  I ran
qemu with -nographic and put console=ttyAMA0 on the command line.
This causes two problems:

1. Initially there is a /dev/ttyS0 but it is device 4/0.  ttyAMA0 is
204/64.  I could recreate it from the second debug shell or by appending
to init-udev-devices.

2. When udev runs, it recreates /dev.  udev successfully creates
/dev/ttyAMA0 with the proper major/minor.  But it naturally does not
create /dev/ttyS0.  So that doesn't work either and I created the
symlink by replacing 'exit 0' with 'ln -s ttyAMA0 /dev/ttyS0' at
the end of S02udev.

Frans warns that finish-install's 90console script may also have a
problem.  I haven't gotten there yet.

I don't know a clean fix for this problem.  It could be detected by
checking /proc/devices, most likely - there's ttyAMA but no ttyS.

On a related note, I thought cttyhack was supposed to give things
enough of a controlling terminal to use job control.  But cttyhack
/bin/sh still complains that there is no job control...

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-rc9 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash




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

Acknowledgement sent to 484366@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 #10 received at 484366@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: 484366@bugs.debian.org
Cc: Daniel Jacobowitz <dan@debian.org>
Subject: Re: Bug#484366: rootskel: cttyhack requires the serial console to be /dev/ttyS0
Date: Wed, 4 Jun 2008 15:21:41 +0200
[Message part 1 (text/plain, inline)]
On Tuesday 03 June 2008, Daniel Jacobowitz wrote:
> I tried to install Debian on Versatile/PB using qemu and the armel
> installer (Lenny beta 1).  It is quickly stuck complaining
> "cttyhack: '/dev/ttyS0': No such file or device".

What _exact_ qemu command line did you use?

How did you connect to the "ttyAMA0" serial port? Using minicom or 
something on the same host system, from a different system or what?

Note that D-I works just fine if you just let it run inside a qemu window.
I'm not yet convinced that there is either an installer bug or a busybox 
bug here.

Cheers,
FJP
[signature.asc (application/pgp-signature, inline)]

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

Acknowledgement sent to Daniel Jacobowitz <dan@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 #15 received at 484366@bugs.debian.org (full text, mbox):

From: Daniel Jacobowitz <dan@debian.org>
To: 484366@bugs.debian.org
Subject: Re: Bug#484366: rootskel: cttyhack requires the serial console to be /dev/ttyS0
Date: Wed, 4 Jun 2008 10:08:39 -0400
On Wed, Jun 04, 2008 at 03:21:41PM +0200, Frans Pop wrote:
> On Tuesday 03 June 2008, Daniel Jacobowitz wrote:
> > I tried to install Debian on Versatile/PB using qemu and the armel
> > installer (Lenny beta 1).  It is quickly stuck complaining
> > "cttyhack: '/dev/ttyS0': No such file or device".
> 
> What _exact_ qemu command line did you use?
> 
> How did you connect to the "ttyAMA0" serial port? Using minicom or 
> something on the same host system, from a different system or what?
> 
> Note that D-I works just fine if you just let it run inside a qemu window.
> I'm not yet convinced that there is either an installer bug or a busybox 
> bug here.

If you just run qemu, and SDL was available when it was built, you get
a graphical window including qemu's console and a real TTY.  So there's no
serial console involved at all.

My qemu was built without SDL, and I ran it with -nographic.  Either
of those is sufficient to end up with a serial console install,
effectively headless.  qemu's standard input and output are the serial
port.

The qemu command was:

qemu-system-arm -m 256 -M versatilepb -kernel qemu-kernel-image \
  -initrd initrd.gz -append "mem=256M console=ttyAMA0 root=/dev/ram" \
  -hda qemu-disk-image -nographic

-- 
Daniel Jacobowitz
CodeSourcery




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

Acknowledgement sent to 484366@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 #20 received at 484366@bugs.debian.org (full text, mbox):

From: Frans Pop <elendil@planet.nl>
To: 484366@bugs.debian.org
Cc: Daniel Jacobowitz <dan@debian.org>
Subject: Re: Bug#484366: rootskel: cttyhack requires the serial console to be /dev/ttyS0
Date: Wed, 4 Jun 2008 17:11:44 +0200
On Wednesday 04 June 2008, Frans Pop wrote:
> On Tuesday 03 June 2008, Daniel Jacobowitz wrote:
> > I tried to install Debian on Versatile/PB using qemu and the armel
> > installer (Lenny beta 1).  It is quickly stuck complaining
> > "cttyhack: '/dev/ttyS0': No such file or device".
>
> What _exact_ qemu command line did you use?

And of course, shortly after sending such a message you do reproduce it.

For the benefit of others:
- download armel versatile images
- start qemu with (add -nographic if needed/wanted):
  $ qemu-system-arm -M versatilepb -serial pty -hda <disk image> \
       -kernel vmlinuz-<kvers>-versatile -initrd initrd.gz \
       -append "root=/dev/ram console=ttyAMA0"
- qemu will output what char device qemu it is using:
  char device redirected to /dev/pts/1
- start minicom using:
  $ minicom -s
- adjust minicom 'Serial port setup' to use /dev/pts/1 as Serial Device
  (using the correct device reported by qemu - see above);
  in 'Modem and dialing', remove the Init and Reset strings

(If -nographic is used, the boot will happen in the terminal where qemu is 
started; if it is not used, minicom will have the boot messages and debug 
shells.)

The console seems to be just /dev/console:
# readlink /proc/1/fd/0
/dev/console
# readlink /proc/self/fd/0
/dev/console

I'm not sure what the real problem here is, especially because I'm not 
sure if current D-I (since the introduction of cttyhack) has really been 
tested on systems that use something else than ttySx for their serial 
consoles. I do know there are others.
AFAIK D-I used to work on those systems, without having to create those 
devices. I'm also not sure whether there's a bug in cttyhack or that the 
kernel isn't "telling" it what the correct device to use is.

The symlink approach below does not seem like the right solution as a 
system could (in theory at least) have both ttySx and tty<whatever>x.
And as every arch/subarch/serial driver seems to want to invent its own 
character devices, maintaining that would be unpleasant anyway.


The issue can easily be worked around:
- add extra boot parameter "BOOT_DEBUG=3" in -append option
- in first debug shell, use nano to edit /etc/inittab and just remove
  '/bin/cttyhack' from ::sysinit: and ::respawn: lines
- use 'exit' to exit the debug shells


The following works as well (probably close to what Daniel did):
<workaround>
/lib/debian-installer/init-udev-devices:
 for i in 0 1 2 3; do
-	makedev 600 /dev/ttyS"$i" c 4 "$(($i + 64))"
+	makedev 600 /dev/ttyAMA"$i" c 204 "$(($i + 64))"
+	ln -s ttyAMA"$i" /dev/ttyS"$i"
 done

/lib/debian-installer-startup.d/S02udev:
udevsettle

+for i in 0 1 2 3; do
+	ln -s ttyAMA"$i" /dev/ttyS"$i"
+done

exit 0
</workaround>

I have no idea where to go from here. Hope someone else does.

Cheers,
FJP




Forcibly Merged 484366 488441. Request was from Frans Pop <elendil@planet.nl> to control@bugs.debian.org. (Sun, 29 Jun 2008 16:39:08 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#484366; Package rootskel. Full text and rfc822 format available.

Acknowledgement sent to 484366@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 #27 received at 484366@bugs.debian.org (full text, mbox):

From: Jérémy Bobbio <lunar@debian.org>
To: 493865@bugs.debian.org, 484366@bugs.debian.org
Cc: Marco d'Itri <md@linux.it>, control@bugs.debian.org
Subject: Re: Bug#493865: cttyhack does not handle other serial devices than ttySn (was: Bug booting from console)
Date: Fri, 15 Aug 2008 22:55:34 +0200
[Message part 1 (text/plain, inline)]
block 484366 by 493865
tag 484366 + patch
thanks

(Moving the discussion to #484366)

On Sat, Aug 09, 2008 at 06:19:09PM +0200, Frans Pop wrote:
> On Wednesday 06 August 2008, Jérémy Bobbio wrote:
> > Bad news is that we probably have to modify
> > /lib/debian-installer/init-udev-devices to create a file for every
> > misc. serial line device.
> 
> I think someone should look into the option of starting udevd _before_ we 
> run init (as also suggested by Marco in a recent discussion on IRC).
> 
> A good time to do this would be after the first boot debug shell, but 
> before the second one.

Attached is a patch the implements this.  Details inside.

Attached is also a patch against udev that simple moves
/lib/debian-installer-startup.d/S02udev to
/lib/debian-installer/start-udev so the script can be called from the
init script.

I have tested that script on an amd64 build using KVM and also with the
same qemu setup described in #484366 and all worked fine.

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
[udev_0.125-5_di-udev-early.diff (text/x-diff, attachment)]
[rootskel_start-udev-before-init.diff (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Blocking bugs of 484366 added: 493865 Request was from Jérémy Bobbio <lunar@debian.org> to control@bugs.debian.org. (Fri, 15 Aug 2008 20:57:05 GMT) Full text and rfc822 format available.

Tags added: patch Request was from Jérémy Bobbio <lunar@debian.org> to control@bugs.debian.org. (Fri, 15 Aug 2008 20:57:07 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#484366; Package rootskel. Full text and rfc822 format available.

Acknowledgement sent to Jérémy Bobbio <lunar@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 #36 received at 484366@bugs.debian.org (full text, mbox):

From: Jérémy Bobbio <lunar@debian.org>
To: 484366@bugs.debian.org
Subject: Re: Bug#484366: Bug#493865: cttyhack does not handle other serial devices than ttySn (was: Bug booting from console)
Date: Sat, 23 Aug 2008 22:26:05 +0200
[Message part 1 (text/plain, inline)]
On Fri, Aug 15, 2008 at 10:55:34PM +0200, Jérémy Bobbio wrote:
> On Sat, Aug 09, 2008 at 06:19:09PM +0200, Frans Pop wrote:
> > On Wednesday 06 August 2008, Jérémy Bobbio wrote:
> > I think someone should look into the option of starting udevd _before_ we 
> > run init (as also suggested by Marco in a recent discussion on IRC).
> 
> Attached is a patch the implements this.  Details inside.
> 
> Attached is also a patch against udev that simple moves
> /lib/debian-installer-startup.d/S02udev to
> /lib/debian-installer/start-udev so the script can be called from the
> init script.

Ok, I have spent more time working on this and I think that there might
be a good chance that this would be the last time.

Bastian Blank suggested on IRC when we discussed the proposed fix
against busybox (see #493865) to replace cttyhack with a custom
solution.

I have digged the kernel source code, made several false starts, but the
attached patch contain a solution that should work in any cases.  It is
based on the previous patch that make udev starts earlier.

More details inside.  Please have a look, I have quite some faith in
this approach.

Cheers,
-- 
Jérémy Bobbio                        .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
[fix_484366.diff (text/x-diff, attachment)]
[signature.asc (application/pgp-signature, inline)]

Blocking bugs of 484366 removed: 493865 Request was from Jérémy Bobbio <lunar@debian.org> to control@bugs.debian.org. (Tue, 26 Aug 2008 11:09:06 GMT) Full text and rfc822 format available.

Tags added: pending Request was from Jérémy Bobbio <lunar@debian.org> to control@bugs.debian.org. (Tue, 26 Aug 2008 11:09:09 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#484366; Package rootskel. Full text and rfc822 format available.

Acknowledgement sent to Joey Hess <joeyh@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 #45 received at 484366@bugs.debian.org (full text, mbox):

From: Joey Hess <joeyh@debian.org>
To: 484366@bugs.debian.org
Subject: also affects real hardware
Date: Tue, 26 Aug 2008 15:51:31 -0400
[Message part 1 (text/plain, inline)]
FWIW, I'm seeing this bug with beta2 on real (arm (ADS Bitsy G5)) hardware, not just
qemu.

-- 
see shy jo
[signature.asc (application/pgp-signature, inline)]

Reply sent to Otavio Salvador <otavio@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Daniel Jacobowitz <dan@debian.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

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

From: Otavio Salvador <otavio@debian.org>
To: 484366-close@bugs.debian.org
Subject: Bug#484366: fixed in rootskel 1.66
Date: Thu, 28 Aug 2008 13:32:03 +0000
Source: rootskel
Source-Version: 1.66

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

rootskel-bootfloppy_1.66_amd64.udeb
  to pool/main/r/rootskel/rootskel-bootfloppy_1.66_amd64.udeb
rootskel_1.66.dsc
  to pool/main/r/rootskel/rootskel_1.66.dsc
rootskel_1.66.tar.gz
  to pool/main/r/rootskel/rootskel_1.66.tar.gz
rootskel_1.66_amd64.udeb
  to pool/main/r/rootskel/rootskel_1.66_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 484366@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Otavio Salvador <otavio@debian.org> (supplier of updated rootskel 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.8
Date: Thu, 28 Aug 2008 10:16:15 -0300
Source: rootskel
Binary: rootskel rootskel-bootfloppy
Architecture: source amd64
Version: 1.66
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Otavio Salvador <otavio@debian.org>
Description: 
 rootskel   - Skeleton root filesystem used by debian-installer (udeb)
 rootskel-bootfloppy - Skeleton root filesystem used by debian-installer boot floppy (udeb)
Closes: 484366
Changes: 
 rootskel (1.66) unstable; urgency=low
 .
   [ Jérémy Bobbio ]
   * Start udev before running init.
     Depends: udev-udeb (>= 0.125-6)
   * Rework the switch from /dev/console to the real console device
     (e.g. /dev/tty0).  (Closes: #484366)
     Breaks: cdebconf-gtk-udeb (<< 0.134)
Checksums-Sha1: 
 36830a0809993c4ae77853c6ac18c3a60e72acad 946 rootskel_1.66.dsc
 4dfe41bc22f9d1c3dc4fc37b2bd88580be08b9e3 30128 rootskel_1.66.tar.gz
 7360c2f5d39ca8a9302b13d325c96311506d6c66 7926 rootskel_1.66_amd64.udeb
 6acd5dd059df8bf9a466e097bf1c1dcc0e6136ce 2782 rootskel-bootfloppy_1.66_amd64.udeb
Checksums-Sha256: 
 90b6b3b075c7dbfb4a55b47db0f09a620ef36a1dbd7d80741775c10a00f9fa68 946 rootskel_1.66.dsc
 5c78060225b9cdcc14148cf9206d3c7d5fcb89841958ad086f3e1a8e54373323 30128 rootskel_1.66.tar.gz
 ad4317dfda2dc6d0770cb4a37ea1105f07dae76b36988d58745c91f99c23fb4b 7926 rootskel_1.66_amd64.udeb
 a30dbe037b796a0ee1edad9e87cece4c95f236158cca9a1a6cc748d45eb7c3ce 2782 rootskel-bootfloppy_1.66_amd64.udeb
Files: 
 0ad2460e7bc56ce2595ed708f910a733 946 debian-installer standard rootskel_1.66.dsc
 0ac54976438a2e0fad71331baebc947c 30128 debian-installer standard rootskel_1.66.tar.gz
 55b3006f7b94492610d89357230aa4e1 7926 debian-installer standard rootskel_1.66_amd64.udeb
 de003800af4a8f3525aaf3bfc73da2e5 2782 debian-installer extra rootskel-bootfloppy_1.66_amd64.udeb
Package-Type: udeb

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

iEYEARECAAYFAki2peEACgkQLqiZQEml+FWmHQCgq6eUK2Cqjh0eSZv+l0MZIL30
vyAAn0nI0MHPeArCjnmxw8OeeaRI97sz
=j//T
-----END PGP SIGNATURE-----





Reply sent to Otavio Salvador <otavio@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Sjoerd Simons <sjoerd@debian.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 11 Oct 2008 07:27:11 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: Thu Apr 17 04:34:16 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.