Skip to contentSkip to conversation

sysvinit-inittab: Make sure new shell from start_getty gets a controlling tty

PATCH In review Yong, Jonathan 1 participant 2 messages Dec 27, 2016 – Jan 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysvinit-inittab: Make sure new shell from start_getty gets a controlling tty

Without exec, the processes from the new shell do not get a ctty:

	root@intel-corei7-64:~# ps -x | grep getty
	  755 tty1     Ss+    0:00 /sbin/getty 38400 tty1
	  791 ?        Ss     0:00 /bin/sh /bin/start_getty 115200 ttyS0
	  804 ?        S      0:00 grep getty

In particular, the openssh client fails:

	root@intel-corei7-64:~# ssh -v <target>
	<truncated>
	debug1: read_passphrase: can't open /dev/tty: No such device or address
	Host key verification failed.

This patch fixes those errors.

---
 meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +1 -1
index e3d052a..ab238f6 100644
@@ -1,5 +1,5 @@
 #!/bin/sh
 if [ -c /dev/$2 ]
 then 
-	/sbin/getty -L $1 $2 $3
+	exec /sbin/getty -L $1 $2 $3
 fi
Signature · 1 line
2.10.2
#1 lore raw
Quoted 27 lines · Jonathan

Without exec, the processes from the new shell do not get a ctty:

	root@intel-corei7-64:~# ps -x | grep getty
	  755 tty1     Ss+    0:00 /sbin/getty 38400 tty1
	  791 ?        Ss     0:00 /bin/sh /bin/start_getty 115200 ttyS0
	  804 ?        S      0:00 grep getty

In particular, the openssh client fails:

	root@intel-corei7-64:~# ssh -v <target>
	<truncated>
	debug1: read_passphrase: can't open /dev/tty: No such device or address
	Host key verification failed.

This patch fixes those errors.

---
 meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +0 -0
index e3d052a..ab238f6 100644

meta/recipes-core/sysvinit/sysvinit-inittab/start_getty line 5

Quoted 6 lines
meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +1 -1
@@ -1,5 +1,5 @@
 #!/bin/sh
 if [ -c /dev/$2 ]
 then 
-	/sbin/getty -L $1 $2 $3
+	exec /sbin/getty -L $1 $2 $3
 fi

Ping?