diff --git a/enter.c b/enter.c index b2fbaa3..2c8357e 100644 --- a/enter.c +++ b/enter.c @@ -452,7 +452,7 @@ int enter(struct entry_settings *opts) to get the real path to the cgroup */ char cgroup_path[PATH_MAX]; if (!cgroup_read_current(cgroup_path)) { - errx(1, "could not determine current cgroup; are you using cgroups v2?"); + cgroup_path[0] = '\0'; } ns_enter_postfork(namespaces, ns_len); @@ -486,7 +486,9 @@ int enter(struct entry_settings *opts) /* Set some extra useful environment */ setenv("ROOT", root, 1); setenv("EXECUTABLE", opts->pathname, 1); - setenv("CGROUP_PATH", cgroup_path, 1); + if (cgroup_path[0] != '\0') { + setenv("CGROUP_PATH", cgroup_path, 1); + } extern char **environ; diff --git a/man/bst.1.scd b/man/bst.1.scd index 3719758..6195402 100644 --- a/man/bst.1.scd +++ b/man/bst.1.scd @@ -530,7 +530,9 @@ The following environment variables are accessible to the setup program: Set to the executable name that will be executed after the setup is done. *CGROUP_PATH* - Set to the path of the cgroup of the process that will be executed. + Set to the path of the cgroup of the process that will be executed. Can + be missing if bst could not determine the cgroup path (e.g. only cgroups v1 + are available, or /proc isn't mounted) # NETWORKING