can't access tty; job control turned off - solution: setsid cttyhack sh
Jason
jason at fatpipeinc.com
Fri Jul 23 16:40:37 UTC 2010
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. Try this:
setsid cttyhack sh
It will give you a controlling terminal (tty1) with job control turned
on without requiring a login.
Note to web admin: It would be helpful if "setsid cttyhack sh" was
mentioned in the FAQ as a solution, as the solutions presented in the
FAQ do not work from the /init script within initramfs. At least they
wouldn't work for me. The console would hang if I tried to do __ exec
setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' __ from my /init script.
Also, so the console doesn't hang when I type "exit", I do this in my
/init script:
setsid cttyhack sh
# reboot if user types "exit"
echo s > /proc/sysrq-trigger # Sync
echo u > /proc/sysrq-trigger # Unmount (actually remounts
everything read-only)
echo b > /proc/sysrq-trigger # reBoot
This requires that you have CONFIG_MAGIC_SYSRQ enabled in your kernel.
If someone has a better solution, please share. The reboot, halt, and
shutdown commands provided by busybox don't do anything for me. I
assume they require busybox's init to be running.
Jason
More information about the busybox
mailing list