-
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
Systemd container unit works but not reliably on startup #19740
Comments
Thanks for reaching out, @mattventura. Editing the output of
I think that #12778 elaborates quite a bit that systemd's Does a simple unit generated with
|
Rootless containers must be run in the user systemd session in order to function properly.
This indicates to me that the unit is started before the user systemd session is created so it just fails because the path does not exists. |
Good thinking! A |
As always, we recommend using quadlets for running jobs under systemd. |
Unfortunately, that did not fix it, but I think it's on the right track. I just had an occurrence where it was failed, but the automatic restart got it running. But this only seems to work after I log in - if I don't log in, then it just keeps failing. I went back to an unmodified generated unit file for a simple service, and it worked. But as soon as I added User=, it didn't. I will take a look at quadlets. It seems to be what I'm looking for, thanks! |
Issue Description
I created a systemd unit file to automatically start a container as a user using rootless podman. Due to other open issues such as #12778 , I am using a simple
Type=exec
unit. It is modified from thepodman generate
output to accommodate for those issues:This works fine when I run
systemctl daemon-reload
andsystemctl start container-my-service
. The container comes up, and I see it inpodman container list
if I log in as the appropriate user. Then, I dosystemctl enable container-my-service
to enable to to start automatically. But when I reboot, sometimes it will fail to come up and I see this in journalctl:But then if I manually restart the service with
systemctl restart container-my-service
, it comes up successfully. I tried adding sufficient delay to the restart attempts to make sure it wasn't just starting up too early in the boot process, but that seems to not be the case.This vaguely sounds like item 31 in the troubleshooting guide, but I'm not sure if that is applicable to something already being managed by systemd.
podman version:
Steps to reproduce the issue
Steps to reproduce the issue
Describe the results you received
Sometimes (maybe 30-40% of the time), the container fails to start as described above.
Describe the results you expected
If it starts successfully when manually started with
systemctl start
, then it should also automatically start successfully on boot.podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
No
Additional environment details
cat /etc/oracle-release: Oracle Linux Server release 9.2
uname -a: Linux *** 5.15.0-103.114.4.el9uek.x86_64 #2 SMP Mon Jun 26 10:09:23 PDT 2023 x86_64 x86_64 x86_64 GNU/Linux
Additional information
Described above - intermittent issue
The text was updated successfully, but these errors were encountered: