Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix systemd cgroup path error in integration test #2845

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lifubang
Copy link
Member

When I run integration test with systemd cgroup driver in a container, I got some errors like this:

root@f7c63618dde3:/opt/mygo/src/github.com/opencontainers/runc# RUNC_USE_SYSTEMD=1 bats tests/integration/delete.bats 
 ✓ runc delete
 ✓ runc delete --force
 ✓ runc delete --force ignore not exist
 ✗ runc delete --force in cgroupv1 with subcgroups
   (from function `fail' in file tests/integration/helpers.bash, line 266,
    in test file tests/integration/delete.bats, line 91)
     `[ -d "${path}" ] || fail "test failed to create memory sub-cgroup ($path not found)"' failed
   runc spec (status=0):
   
   runc run -d --console-socket /tmp/bats-run-211890/runc.3qcU9w/tty/sock test_busybox (status=0):
   
   runc state test_busybox (status=0):
   {
     "ociVersion": "1.0.2-dev",
     "id": "test_busybox",
     "pid": 212304,
     "status": "running",
     "bundle": "/tmp/bats-run-211890/runc.3qcU9w/bundle",
     "rootfs": "/tmp/bats-run-211890/runc.3qcU9w/bundle/rootfs",
     "created": "2021-03-10T04:12:48.316070083Z",
     "owner": ""
   }
   runc exec test_busybox sh (status=0):
   + cd /sys/fs/cgroup/memory
   + mkdir foo
   + cd foo
   + echo 7
   + cat tasks
   7
   + cd /sys/fs/cgroup/freezer
   + mkdir foo
   + cd foo
   + echo 7
   + cat tasks
   7
   test failed to create memory sub-cgroup (/sys/fs/cgroup/memory/machine.slice/runc-cgroups-integration-test-1001.scope/foo not found)
 - runc delete --force in cgroupv2 with subcgroups (skipped: test requires cgroups_v2)

5 tests, 1 failure, 1 skipped

The cgroup mount info looks like:

root@f7c63618dde3:/opt/mygo/src/github.com/opencontainers/runc# cat /proc/self/mountinfo | grep cgroup
433 432 0:117 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:134 - tmpfs tmpfs ro,mode=755
434 433 0:30 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:135 master:19 - cgroup cpuset rw,cpuset
481 433 0:31 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime shared:136 master:20 - cgroup cpu rw,cpu
482 433 0:32 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime shared:137 master:21 - cgroup cpuacct rw,cpuacct
483 433 0:33 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:138 master:22 - cgrou blkio rw,blkio
484 433 0:34 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:139 master:23 - cgroup memory rw,memory
485 433 0:35 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:140 master:24 - cgroup devices rw,devices
486 433 0:36 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:141 master:25 - cgroup freezer rw,freezer
487 433 0:37 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime shared:142 master:26 - cgroup net_cls rw,net_cls
488 433 0:38 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:143 master:27 - cgroup perf_event rw,perf_event
489 433 0:39 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/net_prio rw,nosuid,nodev,noexec,relatime shared:144 master:28 - cgroup net_prio rw,net_prio
490 433 0:40 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:145 master:29 - cgroup hugetlb rw,hugetlb
491 433 0:41 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:146 master:30 - cgroup pids rw,pids
492 433 0:42 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime shared:147 master:31 - cgroup rdma rw,rdma
493 433 0:43 /docker/f7c63618dde3a5af6632fe0e7cc2d4e6be70be0b3f273d90b9f615e60f901c1e /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:148 master:32 - cgroup cgroup rw,name=systemd
293 433 0:121 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:149 - cgroup2 cgroup2 rw,nsdelegate

Signed-off-by: lifubang lifubang@acmcoder.com

Signed-off-by: lifubang <lifubang@acmcoder.com>
@lifubang lifubang force-pushed the systemd-integrationtest branch from 0f1d13b to f7156d9 Compare March 10, 2021 12:00
@kolyshkin
Copy link
Contributor

Please provide steps to repro (I was not able to).

  1. Is the container you run things in using cgroupns?
  2. If this is a rootless container, the fix might be in Fix cgroup2 mount for rootless case #2818

@kolyshkin
Copy link
Contributor

@lifubang #2845 (comment) 🙏🏻

@lifubang
Copy link
Member Author

lifubang commented Jul 1, 2021

@lifubang #2845 (comment) 🙏🏻

  1. Run a container in a mac :
    docker run -dit —privileged -v /var/lib/docker —entrypoint=/sbin/init Ubuntu:20.04
  2. Run the integration test inside this container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants