From 06b54536cf9ecd1dfe0bb810ade581918dc1dc3f Mon Sep 17 00:00:00 2001 From: Jason-ZW Date: Mon, 23 Jul 2018 09:45:31 +0800 Subject: [PATCH] Add systemd cgroup directory (cherry picked from commit f6ebb5002e1598e5a9dea98dfc480443e86b0bd6) --- cmd/control/console_init.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/control/console_init.go b/cmd/control/console_init.go index 616e1c89..a0e03bb8 100644 --- a/cmd/control/console_init.go +++ b/cmd/control/console_init.go @@ -11,6 +11,8 @@ import ( "strings" "syscall" + "golang.org/x/sys/unix" + "github.com/codegangsta/cli" "github.com/rancher/os/cmd/cloudinitexecute" "github.com/rancher/os/config" @@ -108,6 +110,14 @@ func consoleInitFunc() error { } } + // mount systemd cgroups + if err := os.MkdirAll("/sys/fs/cgroup/systemd", 0555); err != nil { + log.Error(err) + } + if err := unix.Mount("cgroup", "/sys/fs/cgroup/systemd", "cgroup", 0, "none,name=systemd"); err != nil { + log.Error(err) + } + // font backslashes need to be escaped for when issue is output! (but not the others..) if err := ioutil.WriteFile("/etc/issue", []byte(config.Banner), 0644); err != nil { log.Error(err)