From: Konrad Rzeszutek Wilk Date: Fri, 19 Jul 2013 17:49:36 +0000 (-0400) Subject: rcS: Fix the annoying "init: starting pid XYZ, tty '/dev/hvc0': '/bin/sh, not found" X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=751bc4fcb95067293af1bfb704aac740b7b8e6bf;p=xentesttools%2Fbootstrap.git rcS: Fix the annoying "init: starting pid XYZ, tty '/dev/hvc0': '/bin/sh, not found" The reason the /etc/inittab was not re-read (even thought we did an kill -1 1 within this startup script) is b/c: (from busybox/init/init.c) /* * NB: while SYSINIT/WAIT/ONCE are being processed, * SIGHUP ("reread /etc/inittab") will be ignored. * Rationale: it would be ambiguous whether SYSINIT/WAIT/ONCE * need to be rerun or not. */ and init.d/rcS is SYSINIT - so no SIGHUP can be done as that is running. As such we just spawn a nohup subprocess that will do it for us. Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/root_image/etc/init.d/rcS b/root_image/etc/init.d/rcS index 251c03e..4c5a2a8 100755 --- a/root_image/etc/init.d/rcS +++ b/root_image/etc/init.d/rcS @@ -107,14 +107,16 @@ if [ $XEND_LOAD -eq 1 ]; then else echo "run_hotplug_scripts=0" >> /etc/xen/xl.conf fi - rm -f /dev/ttyS0 - ln -s /dev/null /dev/ttyS0 - sed -i 's/\(^ttyS0.*\)/# \1/' /etc/inittab + echo "hvc0::respawn:/bin/sh" >> /etc/inittab + #rm -f /dev/ttyS0 + #ln -s /dev/null /dev/ttyS0 + #sed -i 's/\(^ttyS0.*\)/# \1/' /etc/inittab else - rm -f /dev/hvc0 - ln -s /dev/null /dev/hvc0 - sed -i 's/\(^hvc0.*\)/# \1/' /etc/inittab - echo "You might have to do kill -1 1 if you see 'can't open /dev/hvc0'" + #rm -f /dev/hvc0 + #ln -s /dev/null /dev/hvc0 + #sed -i 's/\(^hvc0.*\)/# \1/' /etc/inittab + #echo "You might have to do kill -1 1 if you see 'can't open /dev/hvc0'" + echo "ttyS0::respawn:/bin/sh" >> /etc/inittab fi PATH=$PATH:/usr/bin:/usr/sbin @@ -159,3 +161,7 @@ if [ $? == 0 ]; then ;; esac fi +echo "while (true); do if [ -e /tmp/go ]; then sleep 2;init -q; rm /tmp/go; break; fi; sleep 1; echo "."; done" >> /tmp/reinit +chmod 755 /tmp/reinit +nohup bash /tmp/reinit 1>/dev/null 2>/dev/null & +touch /tmp/go diff --git a/root_image/etc/inittab b/root_image/etc/inittab index 5266a35..b154849 100644 --- a/root_image/etc/inittab +++ b/root_image/etc/inittab @@ -1,7 +1,4 @@ ::sysinit:/etc/init.d/rcS ::ctrlaltdel:/sbin/reboot ::shutdown:/etc/init.d/halt -tty0::respawn:/bin/sh tty1::respawn:/bin/sh -ttyS0::respawn:/bin/sh -hvc0::respawn:/bin/sh