-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
rootless container - systemd user service fails on 1.7.0 but is working on 1.6.2 #4833
Comments
Can you try the commands in the systemd (the ExecStartPre and ExecStart ones most notably) manually, with |
@vrothberg PTAL |
Thanks for the fast reply. The ExecStartPre and ExecStart on their own are working fine in both cases.
|
Interestingly, the same .service file is running fine as systemd system service.
|
@choeffer, can you share the service file or provide one as a reproducer? |
This is the one I am using:
|
I can't reproduce. It works on my machine. I am on cgroups v1 though. |
It is related to cgroups v2. I can reproduce the issue locally, see below:
... AND ...
It works when setting |
Can confirm, with
|
@choeffer thanks for confirming! We'll have a look at the issue (I'm currently bisecting). |
This reverts commit 78e2a31. Fixes: containers#4833 Signed-off-by: Valentin Rothberg <[email protected]>
I opened #4835 to revert the change introducing the regression. |
@giuseppe, how shall we tackle this? Move slirp and overlayfs in the other cgroups? |
I think the correct solution would be to not create a new cgroup at all when running directly from systemd, it is pointless to create a new one and tell systemd to monitor a process from another cgroup. The issue is that I don't know of any what to detect whether we are running from a systemd service, so we should invent our own way to signal it. It can be a simple environment variable, or if we want to make it more generic, we can add something like What do you think? |
I consider this as a regression as it works with pre-1.7 versions. One more F31 user has reached out on IRC today and I would not want to introduce that to RHEL. So I'd love to figure out a way to detect if we're running in a systemd service. More recent versions of systemd are setting some env variables (see https://serverfault.com/a/927481) but I think that might not work in all circumstances. A service might run a script which runs some containers where Podman is not meant to be the main PID. I think we could look at the parent PID of Podman and check if that's systemd. Would that work? |
What happens if the user does something that requires creating a cgroup, though? Sets resource limits on the Podman command line, uses pid=host, etc? |
Can't we look at the current cgroup and figure out if it is a service cgroup? |
In some cases that might be okay, e.g., when Podman/conmon is not the main PID of the service. Checking for the parent PID is afaics more realiable.
It seems redundant to what systemd provides but we must make sure to not regress. Tricky! |
that should not matter for the conmon cgroup, we don't set any limit there. We will still create a cgroup for the container payload. That is why I was suggesting another mode for disabling cgroups only for conmon, differently than what we do now with
yes agree. For example on Fedora 31 my console session has this cgroup:
|
Ahhh. Could we just disable creating a distinct cgroup for conmon in rootless entirely? I can't think of any advantages to having it in a distinct cgroup. |
Unfortunately we need that as the user creating the container must own the current cgroup, otherwise it won't be possible to move the container process inside the correct cgroup (you must control both the source and destination cgroup). There are cases where that is not true, as the current cgroup is owned by root. We were not creating it on cgroup v1 as anyway we were not able to use cgroups, this was changed for cgroup v2 as we started to use cgroups also for rootless |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Followed https://www.redhat.com/sysadmin/podman-shareable-systemd-services to create rootless container systemd user service. On Fedora 31 and podman 1.6.2 it is working fine, on Fedora 31 and podman 1.7.0 it is failing.
Steps to reproduce the issue:
Create systemd user service, as described in the link above.
Start service.
Podman 1.6.2 works, 1.7.0 fails.
Describe the results you received:
on 1.7.0 I get -> failed (Result: timeout)
Describe the results you expected:
on 1.6.2 I get -> active (running)
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:and
Output of
podman info --debug
:and
Package info (e.g. output of
rpm -q podman
orapt list podman
):and
Additional environment details (AWS, VirtualBox, physical, etc.):
and
user config:
and
and
The text was updated successfully, but these errors were encountered: