# How to avoid “can't access tty; job control turned off” when boot to initramfs

i'm testing my custom initramfs now, but everytime the log there will have the

"can't access tty; job control turned off".

The /dev in initramfs has four files: null, sda1, ttyS0. The kernel parameter is 'console=ttyS0'.

Also, i test ctrl+c, it works fine.So how could this problem heppen? In busybox documentation,

Why do I keep getting "sh: can't access tty; job control turned off" errors? Why doesn't Control-C work within my shell? This isn't really a uClibc question, but I'll answer it here anyways. Job control will be turned off since your shell can not obtain a controlling terminal. This typically happens when you run your shell on /dev/console. The kernel will not provide a controlling terminal on the /dev/console device. Your should run your shell on a normal tty such as tty1 or ttyS0 and everything will work perfectly. If you REALLY want your shell to run on /dev/console, then you can hack your kernel (if you are into that sortof thing) by changing drivers/char/tty_io.c to change the lines where it sets "noctty = 1;" to instead set it to "0". I recommend you instead run your shell on a real console...

I type tty and it gives me /dev/console instead of /dev/ttyS0.

• are you running busybox inside your initramfs? then look for "cttyhack". Maybe do what it's doing if your building your own stuff. You can also run script /dev/null, or create a pty by other means. – pizdelect Jul 13 at 4:39
For me, I simply use ::respawn:/bin/cttyhack /bin/sh.