inittab: Start shell only if console is not null

Guillermo Rodriguez Garcia guille.rodriguez at gmail.com
Thu Aug 28 09:13:37 UTC 2014


Hi Denys,

2014-08-28 11:05 GMT+02:00 Denys Vlasenko <vda.linux at googlemail.com>:
> On Thu, Aug 28, 2014 at 10:08 AM, Guillermo Rodriguez Garcia
>> But I didn't know this. So it seems that if I use "console" as the id,
>> the device open succeeds when the system boots with console=ttyS0 but
>> fails when booting with console=null (not sure why -- shouldn't it be
>> possible to open /dev/null ?).
>>
>> Is my understanding correct?
>
> init won't try to open /dev/null for
> "console::respawn:/sbin/getty -L 115200 ttyS0 vt100"
> line. It will try to open /dev/console.

Right. This was a misunderstanding on my side. I stand corrected.

> If that open fails, then respawning will not be done.

Actually I'm testing this and it seems that init keeps spawning child
processes forever, every second. Inside run(), vfork succeds but then
the device open fails and the child process _exits().

Is there a way to have init completely skip the line if the
controlling tty is not valid or cannot be opened.

>
> Therefore, your question should be
> "why when I boot my kernel with console=null,
> /dev/console can't be opened?"

Indeed.

>> And, if this is indeed correct, then why leaving the id empty works
>> even when booting with console=null ?
>
> The "::respawn:/sbin/getty -L 115200 ttyS0 vt100" line
> (empty id case) does not try to open anything.
> It just uses already-opened file descriptors 0,1,2 for stdio.
> It can't "fail to open /dev/something" since it does not open anything.

OK right. I was misled by the wording here:
http://spblinux.de/2.0/doc/init.html , where it says that "If this
field is left blank, the controlling tty is set to the console". My
fault.

Thanks,

Guillermo Rodriguez Garcia
guille.rodriguez at gmail.com


More information about the busybox mailing list