Commit 6f259716 by Serge Hallyn

ubuntu templates: add some kernel filesystems to container fstab

The debugfs, fusectl, and securityfs may not be mounted inside a non-init userns. But mountall hangs waiting for them to be mounted. So just pre-mount them using $lxcpath/$name/fstab as bind mounts, which will prevent mountall from trying to mount them. If the kernel doesn't provide them, then the bind mount failure will be ignored, and mountall in the container will proceed without the mount since it is 'optional'. But without these bind mounts, starting a container inside a user namespace hangs. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 8058be39
...@@ -96,6 +96,9 @@ EOF ...@@ -96,6 +96,9 @@ EOF
cat <<EOF > $path/fstab cat <<EOF > $path/fstab
proc proc proc nodev,noexec,nosuid 0 0 proc proc proc nodev,noexec,nosuid 0 0
sysfs sys sysfs defaults 0 0 sysfs sys sysfs defaults 0 0
/sys/fs/fuse/connections sys/fs/fuse/connections none bind 0 0
/sys/kernel/debug sys/kernel/debug none bind 0 0
/sys/kernel/security sys/kernel/security none bind 0 0
EOF EOF
# rmdir /dev/shm for containers that have /run/shm # rmdir /dev/shm for containers that have /run/shm
......
...@@ -427,6 +427,9 @@ EOF ...@@ -427,6 +427,9 @@ EOF
cat <<EOF > $path/fstab cat <<EOF > $path/fstab
proc proc proc nodev,noexec,nosuid 0 0 proc proc proc nodev,noexec,nosuid 0 0
sysfs sys sysfs defaults 0 0 sysfs sys sysfs defaults 0 0
/sys/fs/fuse/connections sys/fs/fuse/connections none bind 0 0
/sys/kernel/debug sys/kernel/debug none bind 0 0
/sys/kernel/security sys/kernel/security none bind 0 0
EOF EOF
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment