From: Serge Hallyn Date: Tue, 31 Jul 2012 14:04:33 +0000 (+0200) Subject: lxc-ubuntu*: in precise, make /dev/shm a symbolic link to /run/shm X-Git-Tag: lxc-0.8.0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42ff5f0f8767114d060f5031055038a1a1c3759a;p=thirdparty%2Flxc.git lxc-ubuntu*: in precise, make /dev/shm a symbolic link to /run/shm This would be done (though done wrongly) by mounted-dev.conf, but that doesn't run because we don't mount /dev. Signed-off-by: Serge Hallyn Signed-off-by: Daniel Lezcano --- diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in index 79d10c8d1..29d1bea5f 100644 --- a/templates/lxc-ubuntu-cloud.in +++ b/templates/lxc-ubuntu-cloud.in @@ -31,6 +31,7 @@ copy_configuration() rootfs=$2 name=$3 arch=$4 + release=$5 if [ $arch = "i386" ]; then arch="i686" @@ -91,6 +92,16 @@ proc proc proc nodev,noexec,nosuid 0 0 sysfs sys sysfs defaults 0 0 EOF + # rmdir /dev/shm in precise containers. + # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did + # get bind mounted to the host's /run/shm. So try to rmdir + # it, and in case that fails move it out of the way. + if [ $release = "precise" ]; then + [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm + [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak + ln -s /run/shm $rootfs/dev/shm + fi + return 0 } @@ -358,7 +369,7 @@ EOF ) 200>/var/lock/subsys/lxc-ubucloud -copy_configuration $path $rootfs $name $arch +copy_configuration $path $rootfs $name $arch $release echo "Container $name created." exit 0 diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in index c232ab898..89afb617e 100644 --- a/templates/lxc-ubuntu.in +++ b/templates/lxc-ubuntu.in @@ -517,6 +517,16 @@ post_process() chroot $rootfs apt-get update chroot $rootfs apt-get install --force-yes -y --no-install-recommends upstart:${hostarch} mountall:amd64 iproute:amd64 isc-dhcp-client:amd64 fi + + # rmdir /dev/shm in precise containers. + # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did + # get bind mounted to the host's /run/shm. So try to rmdir + # it, and in case that fails move it out of the way. + if [ $release = "precise" ]; then + [ -d "$rootfs/dev/shm" ] && rmdir $rootfs/dev/shm + [ -e "$rootfs/dev/shm" ] && mv $rootfs/dev/shm $rootfs/dev/shm.bak + ln -s /run/shm $rootfs/dev/shm + fi } do_bindhome()