Cgroups mounts detection is not working inside LXC on CentOS 7 host

Open
#2,066 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
centos, go, linux

Research direction

Start in libcontainer/cgroups/utils.go around the mount filesystem detection referenced in the issue, and reproduce the supplied /proc/self/mountinfo case inside LXC on a CentOS 7 host. Compare the detected filesystem with the cgroup mounts shown there and inspect relevant cgroup tests. Done means the mounts are detected correctly in this environment and the daemon no longer reports the listed missing cgroup mounts.

Written by the indexing model from the issue text.

Description

The list of relevant errors from dockerd:

level=warning msg="Your kernel does not support cgroup memory limit"
level=warning msg="Unable to find cpu cgroup in mounts"
level=warning msg="Unable to find blkio cgroup in mounts"
level=warning msg="Unable to find cpuset cgroup in mounts"
level=warning msg="mountpoint for pids not found"
Error starting daemon: Devices cgroup isn't mounted
(container)$ cat /proc/self/mountinfo | grep cgroup
597 596 0:67 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs none rw,size=10240k,mode=755,uid=1000000,gid=1000000
598 597 0:52 /cgroup/blkio /sys/fs/cgroup/blkio rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
599 597 0:52 /cgroup/cpuacct,cpu /sys/fs/cgroup/cpuacct,cpu rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
600 597 0:52 /cgroup/cpuset /sys/fs/cgroup/cpuset rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
601 597 0:52 /cgroup/devices /sys/fs/cgroup/devices rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
602 597 0:52 /cgroup/freezer /sys/fs/cgroup/freezer rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
621 597 0:52 /cgroup/hugetlb /sys/fs/cgroup/hugetlb rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
622 597 0:52 /cgroup/memory /sys/fs/cgroup/memory rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
623 597 0:52 /cgroup/name=systemd /sys/fs/cgroup/systemd rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
745 597 0:52 /cgroup/net_prio,net_cls /sys/fs/cgroup/net_prio,net_cls rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
746 597 0:52 /cgroup/perf_event /sys/fs/cgroup/perf_event rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
788 597 0:52 /cgroup/pids /sys/fs/cgroup/pids rw,nosuid,nodev,relatime master:203 - fuse.lxcfs lxcfs rw,user_id=0,group_id=0,allow_other
(host)$ uname -a
Linux n4.mga.local 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

As you can see, the file system in this case is fuse.lxcfs whereas at https://github.com/opencontainers/runc/blob/master/libcontainer/cgroups/utils.go#L156 it's expected to find either cgroup2 or cgroup.
It's completely outside of my expertise but as far as I can tell, LXCFS is used in this case to provide "a container aware cgroupfs tree" because kernels < 4.6 do not have cgroup namespaces support.

Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opencontainers/runc

All issues in opencontainers/runc

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.