]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
oracle template: prevent mingetty from calling vhangup(2)
authorDwight Engen <dwight.engen@oracle.com>
Mon, 18 Nov 2013 17:28:14 +0000 (12:28 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Tue, 19 Nov 2013 22:22:09 +0000 (16:22 -0600)
This is needed when using the user namespace since the kernel check does
not allow user_ns root to successfully call vhangup(2), and mingetty will
quit in this case.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
templates/lxc-oracle.in

index 106150c9c25ab9727605e839f3e99c6ca5a56cba..d3d6ff9aa02a5b467cb687b800180a963ac3c39e 100644 (file)
@@ -226,6 +226,9 @@ EOF
     echo "# For libvirt/Virtual Machine Monitor" >>$container_rootfs/etc/securetty
     echo "pts/0"        >>$container_rootfs/etc/securetty
 
+    # prevent mingetty from calling vhangup(2) since it fails with userns
+    sed -i 's|mingetty|mingetty --nohangup|' $container_rootfs/etc/init/tty.conf
+
     # dont try to unmount /dev/lxc devices
     sed -i 's|&& $1 !~ /^\\/dev\\/ram/|\&\& $2 !~ /^\\/dev\\/lxc/ \&\& $1 !~ /^\\/dev\\/ram/|' $container_rootfs/etc/init.d/halt
 
@@ -234,7 +237,8 @@ EOF
 
     # start a getty on /dev/console, /dev/tty[1-4]
     if [ $container_release_major = "4" -o $container_release_major = "5" ]; then
-        sed -i '/1:2345:respawn/i cns:2345:respawn:/sbin/mingetty console' $container_rootfs/etc/inittab
+        sed -i 's|mingetty|mingetty --nohangup|' $container_rootfs/etc/inittab
+        sed -i '/1:2345:respawn/i cns:2345:respawn:/sbin/mingetty --nohangup console' $container_rootfs/etc/inittab
         sed -i '/5:2345:respawn/d' $container_rootfs/etc/inittab
         sed -i '/6:2345:respawn/d' $container_rootfs/etc/inittab
     fi
@@ -250,7 +254,7 @@ start on stopped rc RUNLEVEL=[2345]
 stop on runlevel [!2345]
 
 respawn
-exec /sbin/mingetty /dev/console
+exec /sbin/mingetty --nohangup /dev/console
 EOF
     fi