-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 podman via systemd with User directive does not work #6582
Comments
Add the -d (detach) option do your ExecStart line and try again. (otherwise you're not forking) |
@goochjj Doh you are right. I set that on my
|
That's...interesting... because I ran your service file (plus the -d) on my photon machine and it worked... |
I am on Fedora 32 with cgroups v2 if that makes a difference.
Funny, it was not having the I started debugging on my main workstation as I was trying to better understand what was going on but It looks like I found a different issue with cgroups v2 as FCOS has cgroups v1 enabled still. |
Thanks for creating the issue! We currently do not support the Given we're discussing the issue in #5572 already, I am closing this issue and ask to comment over there. |
/kind bug
In anticipation of #6415 getting merged I pulled down @vrothberg branch to start playing around with the new --infra-conmon-pidfile flag and I found that trying to create systemd units with the User directive doesn't work. I want to have a systemd unit that creates and starts a pod and then more systemd units that create services in that pod that run as a rootless user.
I then built https://koji.fedoraproject.org/koji/buildinfo?buildID=1522974 for Fedora 32 and installed that to get the most recent build.
Here is my systemd unit file for the pod:
This fails to start the pod correctly:
Jun 11 10:11:35 sts7 systemd[1]: Starting 12345 pod service... Jun 11 10:11:35 sts7 systemd[6314]: Started podman-272525.scope. Jun 11 10:11:35 sts7 systemd[6314]: Created slice cgroup user-libpod_pod_40db3b8c043fc1cd8d423e83d234c98d2c25d2b37f23211c68dcb54209436b1e.slice. Jun 11 10:11:35 sts7 12345-pod[272525]: 40db3b8c043fc1cd8d423e83d234c98d2c25d2b37f23211c68dcb54209436b1e Jun 11 10:11:35 sts7 systemd[6314]: podman-272525.scope: Succeeded. Jun 11 10:11:35 sts7 systemd[6314]: Started podman-272552.scope. Jun 11 10:11:35 sts7 systemd[6314]: Started libcrun container. Jun 11 10:11:36 sts7 12345-pod[272552]: 40db3b8c043fc1cd8d423e83d234c98d2c25d2b37f23211c68dcb54209436b1e Jun 11 10:11:36 sts7 systemd[1]: 12345-pod.service: New main PID 272597 does not belong to service, and PID file is not owned by root. Refusing. Jun 11 10:11:36 sts7 systemd[1]: 12345-pod.service: New main PID 272597 does not belong to service, and PID file is not owned by root. Refusing. Jun 11 10:11:36 sts7 systemd[1]: 12345-pod.service: Failed with result 'protocol'. Jun 11 10:11:36 sts7 systemd[1]: Failed to start 12345 pod service.
The PID in question is conmon:
$ ps aux |grep 272597 jdoss 272597 0.0 0.0 80492 1996 ? Ssl 10:11 0:00 /usr/bin/conmon --api-version 1 -c cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240 -u cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240 -r /usr/bin/crun -b /home/jdoss/.local/share/containers/storage/overlay-containers/cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240/userdata -p /run/user/1000/containers/overlay-containers/cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240/userdata/pidfile -n 40db3b8c043f-infra --exit-dir /run/user/1000/libpod/tmp/exits --socket-dir-path /run/user/1000/libpod/tmp/socket -s -l k8s-file:/home/jdoss/.local/share/containers/storage/overlay-containers/cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240/userdata/ctr.log --log-level error --runtime-arg --log-format=json --runtime-arg --log --runtime-arg=/run/user/1000/containers/overlay-containers/cc06c7b2d28fc5219a8e31609f78b76e19275f48a8334fb1bf669de18afe5240/userdata/oci-log --conmon-pidfile /tmp/12345-pod-conmon.pid
After some digging it turns out this is by design for systemd https://access.redhat.com/solutions/4420581
Running this as a user system service does not have this issue:
If I try to create a postgresql container in the same way without a pod, but with a PIDFile it just times out and says it doesn't start the unit. Here is the unit for this test case:
Which is weird because when the above unit starts it does write out the PIDFile:
and it shows the container as started:
but it fails eventually with a time out from systemd.
If you downgrade back down to podman 1.9.3 the 12345-postgresql.service still fails to start in the eyes of systemd but it is running when you do a
podman ps
.With that all said, is there a way to run a root systemd unit with the User directive set that runs as a non root user that has a PIDFile?
My end use case is that I want to use Podman and Systemd with Fedora CoreOS to deploy services in a pod via Ignition that run via rootless Podman.
The text was updated successfully, but these errors were encountered: