From c0ae7763a692e6b89c8d81d55f9a557698ac6e85 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 22 Mar 2021 10:45:26 +0100 Subject: [PATCH] initctl: ignore possibly missing cpu.stat in cgroup2 root Older kernels (4.19) don't have the summary cpu.stat in the cgroup2 root, so let's ignore that problem and return zero. Signed-off-by: Joachim Wiberg --- src/cgutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cgutil.c b/src/cgutil.c index 5d402ef7..eabc3bec 100644 --- a/src/cgutil.c +++ b/src/cgutil.c @@ -231,7 +231,9 @@ static struct cg *append(char *path) snprintf(fn, sizeof(fn), "%s/cpu.stat", path); if (access(fn, F_OK)) { - warn("not a cgroup path with cpu controller, %s", path); + /* older kernels, 4.19, don't have summary cpu.stat in root */ + if (strcmp(path, FINIT_CGPATH)) + warn("not a cgroup path with cpu controller, %s", path); return NULL; }