1

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.

So, that's all information about this problem, hope some one can help me out:-)

  • 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
  • here you go. The //config: comments tell you everything you need to know, including a workaround. You can copy-paste it into an answer, something I cannot do on a phone. – pizdelect Jul 13 at 6:07
0

As commented by pizdelect, here is the solution: https://raw.githubusercontent.com/brgl/busybox/master/shell/cttyhack.c.

For me, I simply use ::respawn:/bin/cttyhack /bin/sh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.