Skip to content

Instantly share code, notes, and snippets.

@palica
Last active November 26, 2017 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palica/c8d7722aab57de8a2437fa8b9d00ba42 to your computer and use it in GitHub Desktop.
Save palica/c8d7722aab57de8a2437fa8b9d00ba42 to your computer and use it in GitHub Desktop.
/etc/init.d/sysfs for lxd to be able to mount cgroups on container startup
--- sysfs 2017-11-25 00:02:31.150396179 +0100
+++ sysfs.palica 2017-11-26 11:22:54.041218857 +0100
@@ -15,7 +15,8 @@
depend()
{
- keyword -docker -lxc -prefix -systemd-nspawn -vserver
+# Removing -lxc keyword as we need to run cgroup mount inside container
+ keyword -docker -prefix -systemd-nspawn -vserver
}
mount_sys()
@@ -229,9 +230,13 @@
start()
{
- mount_sys
- mount_misc
+# Commenting out sys as it gets mounted from LXD
+# Commenting out misc as I don't need it in LXD - please comment if it is not true
+# Commenting out restorecon as I don't use SELinux
+ #mount_sys
+ #mount_misc
mount_cgroups
- restorecon_sys
+ #restorecon_sys
return 0
}
@brauner
Copy link

brauner commented Nov 26, 2017

openRC should be smart enough to not try to mount sysfs again if it detects that it is already mounted. If that's not the case then openRC should be made to respect existing sysfs mounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment