Bug 1244 testcase

Eric Spakman E.Spakman at inter.nl.net
Mon Mar 5 19:07:31 UTC 2007


Hi Denis,
>
>>>> It's indeed strange that some daemons seem to need a controlling
>>>> tty, at least dnsmasq, openntpd and ulogd won't start without and I
>>>> can imagine
>>>
>>> I suspect that daemons don't need it, but some script probably fails
>>> before they have a chance to be started.
>>>
>>> In order to find out where it breaks down, do *NOT* use cttyhack,
>>> but use "exec >/dev/tty1 2>/dev/tty1 </dev/tty1" trick. Move it
>>> further and further down the script until you find the place where
>>> script starts to fail.
>>>
>> I tried it and some scripts indeed start to fail with the latest SVN
>> version. All those scripts contain "set -e". Commenting that out make
>> the script run again.
>>
>> A snippet:
>>
>>
>> set -e
>>
>> case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --quiet
>> --start --exec $DAEMON -- -d > /dev/null
>> 2>&1
>> echo "$NAME." ;;
>>
>>
>>
>> But the console is still quiet, I need the cttyhack program to show any
>>  init bootmessages on the screen.
>
> I have an idea what's going on. Your initrd stars /sbin/init this way:
> ...; exec /sbin/init <dev/console >dev/console 2>dev/console
> It seems '<' redirection is opened in O_RDONLY mode by shell
> (both ash and bash).
>
>
> Then init does this:
>
>
> close(1); close(2); set_term(); dup(0); dup(0);
>
> Guess what? Our fd #1 and #2 are _not_ writable_ after that!
> I managed to add statically linked strace into your image
> and it definitely shows that "/bin/echo TEST" fails to write(1, ...).
>
> Please try attached fix.
>
The attached patch fixes the problem! Thanks.

>
> Sorry.
> --
> vda
>
Regards,

Eric




More information about the busybox mailing list