]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Fix sshd template on systems with systemd 833/head
authorNikolay Martynov <mar.kolya@gmail.com>
Sun, 21 Feb 2016 06:16:15 +0000 (01:16 -0500)
committerNikolay Martynov <mar.kolya@gmail.com>
Sun, 21 Feb 2016 06:16:15 +0000 (01:16 -0500)
Systems with systemd have /sbin/init as a symlink pointing to real init.
Sshd template tries to bind-mount special init implementation.
The problem is that one cannot bind-mount to a location that is a symlink.

Fix this by deferencing /sbin/init symling and using that as bind-mount location.

Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
templates/lxc-sshd.in

index d34b3b4552b09c86d8293b9f6217657a64cbc26d..9b07ea600b09cce4a6c92533e7fdb7ab8a08b34c 100644 (file)
@@ -125,6 +125,8 @@ copy_configuration()
     rootfs=$2
     name=$3
 
+    init_path=$(realpath --relative-to=/ $(readlink -f /sbin/init))
+
     grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
 cat <<EOF >> $path/config
 lxc.utsname = $name
@@ -140,7 +142,7 @@ lxc.mount.entry = /bin bin none ro,bind 0 0
 lxc.mount.entry = /usr usr none ro,bind 0 0
 lxc.mount.entry = /sbin sbin none ro,bind 0 0
 lxc.mount.entry = tmpfs var/run/sshd tmpfs mode=0644 0 0
-lxc.mount.entry = @LXCTEMPLATEDIR@/lxc-sshd sbin/init none ro,bind 0 0
+lxc.mount.entry = @LXCTEMPLATEDIR@/lxc-sshd $init_path none ro,bind 0 0
 lxc.mount.entry = /etc/init.d etc/init.d none ro,bind 0 0
 
 lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed