]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
ubuntu: Fix regression in post-process
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 28 Nov 2013 00:46:18 +0000 (19:46 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 28 Nov 2013 00:46:18 +0000 (19:46 -0500)
THe recent reorg of lxc-ubuntu introduced some package installation in
post-process but without first disabling service startup.

As a result, if the cache is a bit out of date and a ssh update is
available, post-process will apply that update (as it does apt-get
install ssh vim) which in turn will attemp to start sshd. This will
either lead to ssh on the host being restarted or if there's no sshd on
the host, will fail the container creation as the postinst will get an
error from upstart.

The fix is very simply to add the same policy-rc.d trick when running
post-process.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
templates/lxc-ubuntu.in

index ac39ed2695ea6f4bce3a57915493d1a86d75ce29..4e6a54f25b6c70c5cf71dd1ce48ad6f9553f25f8 100644 (file)
@@ -467,6 +467,13 @@ post_process()
     release=$2
     packages=$3
 
+    # Disable service startup
+    cat > $rootfs/usr/sbin/policy-rc.d << EOF
+#!/bin/sh
+exit 101
+EOF
+    chmod +x $rootfs/usr/sbin/policy-rc.d
+
     if [ ! -f $rootfs/etc/init/container-detect.conf ]; then
         # Make sure we have a working resolv.conf
         cresolvonf="${rootfs}/etc/resolv.conf"
@@ -538,6 +545,9 @@ post_process()
         mv $rootfs/dev/shm $rootfs/dev/shm.bak
         ln -s /run/shm $rootfs/dev/shm
     fi
+
+    # Re-enable service startup
+    rm $rootfs/usr/sbin/policy-rc.d
 }
 
 do_bindhome()