From 74ad34a0c5995e9d81773aa33dfdebd36716409f Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 13 Feb 2022 21:46:41 +0100 Subject: [PATCH] Another case for when we need to silently disable cgroups When running in a container we might not have the necessary privileges to mount cgroups. Don't cause error in this case, just log it. Signed-off-by: Joachim Wiberg --- src/cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cgroup.c b/src/cgroup.c index 628b6efe..71c7383d 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -466,8 +466,10 @@ void cgroup_init(uev_ctx_t *ctx) if (mount("none", FINIT_CGPATH, "cgroup2", opts, NULL)) { if (errno == ENOENT) logit(LOG_NOTICE, "Kernel does not support cgroups v2, disabling."); + else if (errno == EPERM) /* Probably inside an unpriviliged container */ + logit(LOG_NOTICE, "Not allowed to mount cgroups v2, disabling."); else - _pe("Failed mounting cgroup v2, disabling."); + _pe("Failed mounting cgroup v2"); avail = 0; return; }