From: Nikolay Martynov Date: Sun, 21 Feb 2016 06:16:15 +0000 (-0500) Subject: Fix sshd template on systems with systemd X-Git-Tag: lxc-2.0.0.rc2~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F833%2Fhead;p=thirdparty%2Flxc.git Fix sshd template on systems with systemd 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 --- diff --git a/templates/lxc-sshd.in b/templates/lxc-sshd.in index d34b3b455..9b07ea600 100644 --- a/templates/lxc-sshd.in +++ b/templates/lxc-sshd.in @@ -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 <> $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