-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
lxc-top does not work with openrc and cgroup2 (Alpine Linux) #4376
Comments
|
This will most likely need a change similar to that in #4373 |
Hi! We are UT Austin students doing open-source contributions for a project in a class. Would it be fine to have this project assigned to us? Thank you! |
Anyone is welcome to post PRs or send patches - thanks :) |
I am with annoprac. We believe we have a solution to this, but we do not know how to test. How do we use Jenkins and test lxc-top/ lxc-create on our local machine after calling meson build on the git repo? |
You may need to do |
Sounds like you built LXC without libcap enabled. |
Make sure you have libcap-dev libseccomp-dev libcap-ng-dev libapparmor-dev for most features to be enabled. |
Now we have valid capabilities, but we still fail to parse the config file Update: Turns out I forgot to install the last two libraries. After installed we are able to create a container. Thank you so much for you help! |
We noticed that print and ERROR statements in do_lxcapi_get_cgroup_item() do not make it to the terminal. Is this expected behavior? |
We were able to get printing to work in do_lxcapi_get_cgroup_item(), and we traced the issue to open_at() inside of lxc_read_try_buf_at() in src/lxc/file_utils.c. The path or file descriptor that's passed in could be invalid. Is memory.usage_in_bytes a valid path? |
It's a valid path for cgroup1 but not for cgroup2. Under cgroup2, the equivalent is |
Does this also apply to memory.limit_in_bytes, memory.kmem.usage_in_bytes, and other paths? Should they ALL have the name memory.current.[x] instead? |
They all have cgroup2 equivalents. We have some convenient logic to handle cgroup1 and cgroup2 in Incus that you can look at here https://github.com/lxc/incus/blob/main/internal/server/cgroup/abstraction.go to see both paths. |
How do we know which c-group the system is using? |
There are also some paths that are implemented for cgroup that do not have an equivalent for cgroup2. Is there another resource with the mapping from the cgroup paths to their cgroup2 equivalents. |
Hmm, within the core code, we have An option would be to just try the cgroup2 file first and if that fails, fallback to the cgroup1 equivalent. Which ones are you missing an equivalent for? |
We're missing the equivalent for |
The other three we'd need to skip as they don't have straight up equivalents. |
We also don't have equivalents for cpuacct.stat. Does this have an equivalent? |
When we run containers locally we now get the following output: I don't think it is related to the lxc-top changes because I reverted to the main branch. |
|
For https://github.com/lxc/incus/blob/main/internal/server/cgroup/abstraction.go#L259 |
Does that also work for cgroup path |
Oh, oops, Incus doesn't use the stat one. Though I'd suspect |
Sounds good. I'll add a case for the cgroup2 equivalent for cpuacct.stat. |
Closes lxc#4376 Signed-off-by: Devon Schwartz <devon.s.schwartz@utexas.edu>
The template below is mostly useful for bug reports and support questions.
Feel free to remove anything which doesn't apply to you and add more information where it makes sense.
Required information
lxc-start --version
: 5.0.3lxc-checkconfig
:uname -a
: Linux alpine 6.6.4-1-virt python-lxc: Convert state to uppercase #2-Alpine SMP PREEMPT_DYNAMIC Tue, 05 Dec 2023 20:25:50 +0000 x86_64 Linuxcat /proc/self/cgroup
: 0::/cat /proc/1/mounts
:Issue description
lxc-top
stopped working after OpenRC switched to use unified cgroup (cgroup2). this comes as the default in alpine 3.19.0.This is the output of
lxc-top -b
:Downstream bug report: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15607
Steps to reproduce
qemu-system-x86_64 -m 2048 -accel kvm -cdrom https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-virt-3.19.0- x86_64.iso -nographic
setup-alpine -q
to set up basic network apk repositories.apk add iptables lxc lxc-bridge lxc-templates-legacy-alpine
service cgroups start && service dnsmasq.lxcbr0 start
lxc-create -t alpine -n a1
lxc-start -n a1
lxc-top -b
Information to attach
dmesg
)lxc-start -n <c> -l TRACE -o <logfile>
) a1.trace.logThe text was updated successfully, but these errors were encountered: