can't access tty; job control turned off - solution: setsid cttyhack sh

Denys Vlasenko vda.linux at googlemail.com
Mon Jul 26 01:57:24 UTC 2010


On Monday 26 July 2010 03:10, Jason wrote:
> On 7/23/2010 6:17 PM, Denys Vlasenko wrote:
> > On Friday 23 July 2010 18:40, Jason wrote:
> >>    It took me some time to figure this out so I'm sending this to the
> >> list in case it helps others.
> >>
> >> If you're getting this message when you launch a shell (sh):
> >>
> >>        "can't access tty; job control turned off"
> >>
> >> And you've looked at the FAQ on the subject:
> >>
> >>        http://www.busybox.net/FAQ.html#job_control
> >>
> >> But you're still having a problem.
> > Can you be more specific: what problem?
>
> Problem: Not able to get a controlling terminal from /init script.

Please familiarize yourself with:
http://catb.org/esr/faqs/smart-questions.html

> I tested this again and if I use __ exec setsid sh -c 'exec sh 
> </dev/tty1 >/dev/tty1 2>&1' __ in my /init script,

That's it. You are trying to use "exec" in _script_.
Do you know what "exec" does? It _replaces_ shell
process with whatever you "exec". You most likely
do not want that in scripts. Drop first "exec"
in that command.

Still, panic is not what should happen - you
should drop into a shell...

> > I get "Kernel Panic -  
> not syncing: Attempted to kill init!"
> Same thing if I use "exec setsid  
> cttyhack sh".  They do not give me a terminal at all.  Just an immediate 
> kernel panic.

Do you see any message just before this one? Like "exec: setsid: not found"?
Or did you redirect from /dev/null or closed stdin in your script?
That would make execed shell exit at once and kernel will not like
PID 1 exiting.

-- 
vda


More information about the busybox mailing list