Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the sh:cannot set terminal process group (-1) inappropriate ioctl for device error mean?

Tags:

shell

I am trying to run a little init script instead of sysvinit, which drops me in a shell. My code for the init script is:

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/sbin

mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs none /dev

exec sh

But when it drops me in the shell this error appears:

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

The command tty returns /dev/console. I am dropped in as root and the set of commands that I tried are working correctly.

like image 502
Arnold Avatar asked Aug 19 '15 09:08

Arnold


1 Answers

That error message likely means shell is probably calling tcsetpgrp() and getting back errno=ENOTTY. That can happen if the shell process does not have a controlling terminal. The kernel doesn't set that up before running init on /dev/console.

You have already discovered the solution: use a real terminal device like /dev/tty0.

like image 106
ephemient Avatar answered Oct 16 '22 01:10

ephemient