2

I am trying to run agetty in a runit based linux system, but I have the following problem

sh: cannot set terminal process group (136) Inappropriate ioctl for device
sh: no job control in this shell

I have no clue about this error, do you have some ideas

The script for running agetty is

#!/bin/sh
exec /sbin/agetty 38400 tty1 linux --noclear

Any help will be good.

3

Use setsid as follows.

#!/bin/sh
exec setsid /sbin/agetty 38400 tty1 linux --noclear

The setsid wrapper will start agetty as a session leader (see this answer), allowing it to bind to tty1.

You can see the different behavior from the following example ps.

# ps xao pid,ppid,sid,tty,cmd
[...]
150 1   150 ?    runsvdir
154 150 155 ?    runsv agetty-3
157 154 157 tty3 -bash
152 150 152 ?    runsv agetty-4
156 152 152 ?    -bash
[...]

The agetty-3 service used setsid, whereas agetty-4 did not. Therefore, the shell on tty3 is session leader and bound to its tty. The shell on tty4 is in the same session of its supervisor and not bound (? in tty column).

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.