how to turn job control on?

penguin
Hi,

I have created basic rootfs with busybox following this beautiful tutorial
http://wiki.iface.ch/index.php/Basic_rootfs_for_Mini2440
After boot I get shell prompt
-sh: can't access tty; job control turned off

Everybody keeps repeating this is a warning that can be safely ignored.

I would agree but then why I cannot start any programs in background, i.e 
/ # ./pthread_test &

Also I cannot Ctrl + Z it.

Could you kindly help me? I searched a lot of forums to no avail.

Juergen Beisert
This typically happens when you run your shell on /dev/console. The kernel
will not provide a controlling terminal on the /dev/console device. You
should run your shell on a normal tty such as tty1 or ttyS0 and everything
will work perfectly.

penguin
Thank you Juergen
But honestly that much I saw on the net.
I think I have to correct the question.
How do I do that?
I connect to mini2440 via serial cable with minicom or screen. This ttySAC0
device is passed to linux args by u-boot as console=ttySAC0.
How do I set it up so I can actually have job control?
Is /dev/console you are talking about is on the mini2440?
ls /dev output does not contain this entry.

Thank you

Robin Arnold
I've just received a tiny6410 board with the preinstalled linux software,
and one thing I noticed last night is if you start getty on a serial port,
you can't seem to send keypresses such as control C or control Z to
programs.  The 'more' file viewer also seemed to grossly malfunction.  I've
been using linux on x86 (without busybox though) for embedded projects for
17 years, and it's the first time I've seen this problem.

If you're stuck, one thing you could try is getting regular copies of
agetty and login (and maybe even bash and 'more' too), maybe the busybox
versions aren't setting up the terminal settings correctly?  (either that
or maybe it's a problem with the driver in the Linux kernel for the ARM
serial ports.)

Sorry juet to explain further, you can login as root with telnet over
ethernet, and then type:

getty -hL 115200 /dev/ttySAC2

Where '/dev/ttySAC2' is an free unused serial port.  This simplifies the
problem as you know no other software is using the serial port.  However it
still doesn't work properly.

Also you could try reading the man page for stty, though that might just be
confusing.

I tried using getty on /dev/console and it wouldn't seem to receive any
keypresses at all.

I'm not too bothered about any of this personally, I'm just trying to help.

Juergen Beisert
@penguin: Start your login at ttySAC0. This is a real tty which supports
job control. Do never! use /dev/console

Robin Arnold
Just as a follow-up to what I was saying, it appears if you run getty then
the login session on the serial port is still responding to control C on
the telnet session terminal it's started from, rather than completely
detaching from that terminal.  It maybe needs to be started from init to
set things up properly before getty is called.

sulogin seems to have the same problem too.

You maybe need to start using init.

penguin
@Juergen
The thing is I do not use /dev/console. I pass console=/dev/ttySAC0 to
linux that is true, but anyway from what I have read, thanks to your
emphasis on /dev/console, I surmise that ttySAC0 is considered by linux a
system console and job control on system console cannot be turned on. What
is weird that even when I pass console=/dev/ttySAC1, sh still would not
turn job control on.

@Robin
Thank you, what you are saying is making sense. 
I intended to make this investigation before starting the thread, but I
thought this had been a common problem and somebody would point out a short
and efficient solution.

Juergen Beisert
As I said: run your login on ttySAC0. "console=/dev/ttySAC0" is for the
kernel, but not your login!

penguin
Juergen,

I am sorry, but how do I run my login on ttySAC0? 
My rootfs contains only files described here
http://wiki.iface.ch/index.php/Basic_rootfs_for_Mini2440
What should I change?

Juergen Beisert
As Robin stated: you need to start "init". You should google for it and how
to use it.

Robin Arnold
I am uncertain whether init will fix it, or whether it's just a problem
with the linux ARM serial port driver code not supporting the sending of
the SIGINT and SIGSTOP signals etc.  If it's the latter using psuedo
terminals in the same way telnetd does might be a workaround, but you'd
probably have to write a special C program to do it.  Try using init
though, just don't be too disappointed if there's still a problem.

penguin
Guys,

Unfortunately, my inittab already contains the line:

# Put a getty on the serial port
ttySAC0::respawn:/sbin/getty -L ttySAC0 115200 vt100 # GENERIC_SERIAL

Robin Arnold
Try creating a line for another unused serial port (check that there
already isn't one), and then rebooting and testing it out with minicom
(make sure the change to the file survives the reboot).

This will help confirm init is actually running.  It will also remove the
possibility of any complications caused by the kernel using the same serial
port for its console.

Apologies for not checking all this out myself, I literally only got my
first ARM computer Saturday, and I've only casually checked it out so far.

Juergen Beisert
Sharing the login console with the kernel's console is possible and does
not limit the login console in any way. It's the default in almost all
systems I know.

> Unfortunately, my inittab already contains the line

And? What does it? Do you see a login prompt? Try starting it manually.

> [...] whether it's just a problem with the linux ARM serial port driver
> code not supporting the sending of the SIGINT and SIGSTOP signals etc.

Handling signals is the job of the tty layer, not the UART driver. You can
run any UART driver below the tty layer and it will work as expected.

penguin
Thank you Robin. Please, do not apologize, you and Juergen are doing great
job trying to help!

I added 
ttySAC2::respawn:/sbin/getty -L ttySAC2 115200 vt100 # GENERIC_SERIAL

and the behavior is exactly the same, no Ctrl + Z reaction on both ports.
I can work on my project even with this issue, it is rather inconvenient
but when I have time I will try to build real getty.

penguin
Juergen,

Yes, I have login prompt. Here is the console output

........
VFS: Mounted root (nfs filesystem) on device 0:11.                         
   
Freeing init memory: 156K                                                  
   
Warning: unable to open an initial console.                                
   
                                                                           
   
Welcome to IFACE distro for embedded.                                      
   
ttySAC0 on ARM-dev                                                         
   
ARM-dev login: root                                                        
   
-sh: can't access tty; job control turned off                              
   
~ # ps aux

Juergen Beisert
> Warning: unable to open an initial console.

Do you have a /dev/console at all?

penguin
Juergen,

I do not have /dev/console at all.

Ok, I just compiled mgetty for mini2440 and it created this file at first
start up so it is there and the message "Warning: unable to open an initial
console." disappeared. It changes little in my quest though. 
I could not setup mgetty correctly so far.
It looks I will have to compile complete linux-utils to have real getty.

georg
hey penguin,
i wonder if you were able to solve that problem?

ashok
i am trying to installed kali linux in my pc it could not works. 
-sh: can't access tty; job control turned off
 the above msg is shown in my pc, plz help mr

Les
Hi 
I am a novice with computer my xmbc box keeps showing can't access  tty job
control turned off
How can do I Fix 
Regards