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

Re: More info on kernel 2.2 & debian bootdisks woes

Steve Dunham wrote:
> Eric Delaunay <delaunay@lix.polytechnique.fr> writes:
> > It was using a serial console display.
> > Anyway, I'm now using my latest bootdisks merged with a 2.2.0 kernel
> > on SparcClassic with linux console (cg3 + monitor) still with no
> > success.  It displays the first dialog box (choosing color or
> > mononochrome) but the keyboard is not responding at all (not arrow
> > keys, no enter, ...) :-( However, I can switch to other VTs (via
> > ALT+F?) and in all of them but the first, the keyboard is working
> > fine.  Ok, since the second VT is working, I launched dbootstrap in
> > it.  It seems to work well: I can do configuring the keyboard,
> > partitioning the hard drive, and so on.  I just run in trouble when
> > I run a subshell from dbootstrap.  Outputs of the programs I run
> > from the shell are going to the second VT as usual, but the shell's
> > prompt is not displaying in this VT but in the first one !!!  stderr
> > outputs are sent to the first VT as well.  In the first VT I can see
> > the following message displayed at ash starting time:
> >   sh: can't access tty; job control turned off
> > Any hints ?
> > Thanks in advance.
> I looked into the source code and found that the "dbootstrap" process
> was running with stdin/stdout pointing to /dev/tty0, which is causing
> problems (could this be a kernel bug?).
> To see that this is the problem, do:
>   rm /dev/tty0
>   mknod /dev/tty0 c 4 1
> and kill the dbootstrap process.
> The code that is making dbootstrap attach to tty0 is in
> /usr/src/boot-floppies/utilities/busybox/init.c:
>         default:
>                 tty = ttyname(0);
>                 if (tty) {
>                         strcpy( console, tty );
>                         if (!strncmp( tty, "/dev/cua", 8 ))
>                                 serial_cons=1;
>                 }
>                 else
>                         /* falls back to /dev/tty1 if an error occurs */
>                         strcpy( console, default_console );
> As a hack to fix this, you can disable the "if" part of the above
> statement.  (IMHO, it's always wrong to use tty0, since it refers to
> the VC that is currently being displayed - if the user switch VC's
> then the output would go to the current one.  And ttyname(0) is
> returning "/dev/tty0".)
> Also, I wonder about the code just above it, it opens /dev/cua0 or
> /dev/cua1 if the user specifies a serial console, these devices are
> depricated.  If you change those strings to ttyS0 and ttyS1, it may
> fix your serial console problems.
> Disabling the if part won't break serial consoles - the other parts of
> the case statement handle the serial console (although they do so
> incorrectly, since cua0 and cua1 no longer exist).

Well, part of the problem was indeed in init but one is remaining even after I
fixed it: the keyboard is still dead in the first console that is running
The real culprit is dbootstrap !
Just try to boot with "tty1=/bin/sh" as argument to the kernel: it tells init
to run /bin/sh in the first console.  The console is fully functional in this
case until you spawn dbootstrap :-(

I then checked the code for changes since my previous upload of bootdisks.
In utilities/dinstall/boxes.c, there is a call to a new method named
stderrToTTY that redirects stderr to /dev/tty3.  I commented out its contents
and the keyboard freeze disappeared.

I don't understand why this code is not working with 2.2 kernels:

int stderrToTTY(int tty) {
    static int fd=-1;
    char dev[10];

    if (fd > 0)
    if ((fd = open(dev, O_WRONLY|O_NOCTTY)) < 0)
        return 1;
    if (-1 == dup2(fd,2))
        return 1;
    return 0;

Any advice ?
Thanks in advance.

PS: I cc: this message to debian-boot for any/all comments.

 Eric Delaunay                 | "La guerre justifie l'existence des militaires.
 delaunay@lix.polytechnique.fr | En les supprimant." Henri Jeanson (1900-1970)

Reply to: