]> xenbits.xensource.com Git - xentesttools/bootstrap.git/commitdiff
rcS: Fix the annoying "init: starting pid XYZ, tty '/dev/hvc0': '/bin/sh, not found"
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 19 Jul 2013 17:49:36 +0000 (13:49 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 19 Jul 2013 17:52:00 +0000 (13:52 -0400)
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 <konrad.wilk@oracle.com>
root_image/etc/init.d/rcS
root_image/etc/inittab

index 251c03eee6e55b4e6b0f9f1db7774ed9b5d3046a..4c5a2a84becccbc4e7646ff99d1cbcb0a9191f28 100755 (executable)
@@ -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
index 5266a35391191bd0a30b6bf465aa85a7ab4d27af..b154849cee49e2b1bbe2d8793ca289d1ce1585ed 100644 (file)
@@ -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