-
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
automatic start of rootless containers with systemd fails #4678
Comments
@giuseppe @vrothberg Ideas? |
I use podman-run but I always have to do |
More detailed logs from the service would be nice - using |
Yes, logs would be hugely appreciated. I am under the impression that |
Here more logs. Something goes wrong with resolv.conf. Strange thing is when I start the container manually after boot everything works. |
That's it. I am convinced that systemd has no influence as starting the container fails with:
Starting the container manually with The |
"podman start ae3453a9ada5" works without problems. And yes - on the host system there is a link /etc/resolv.conf -> /var/run/NetworkManager/resolv.conf. Is it perhpas possible that the container tries to start before this link is available? To check this I have removed the symbolic link and put the content to a normal file /etc/resolv.conf. Also I had to put "dns=none" into the main section of /etc/NetworkManager/NetworkManager.conf. After doing this the container starts automatically after boot as it should. This is a workaround - not the solution. |
Should the systemd unit file depend on the network being started then? |
First of all I cannot remember that I had this issue before.So this should not happen this way. I have now tried to add dependencies into the systemd files - but this does not help. For example I tried this:
or this:
I do not understand why if I configure these dependencies the containers are not able to find /var/run/NetworkManager/resolv.conf. When is this file created? With dependencies on NetworkManager as given here I check logfiles and stat on the file. Here the error from podman:
Now resolv.conf:
So from this it is clear that podman tries to read resolv.conf before NetworkManager has created it. To avoid this I have configured the dependency on NetworkManager (I also tried network-online.target which did not work either). Obviously this is not the correct way to define a dependency to /run/NetworkManager/resolv.conf. So what is the correct way doing this? This again a workaraound and should not be the solution:
|
Here my next ugly workaround:
Then I define the monitor-resolv-conf units: monitor-resolv-config.service
monitor-resolv-config.path
The path unit needs to be enabled:
Even this solution needs a sleep. This should not be the case. But otherwise the container is still not able to find the resolv.conf file. BTW: I noticed that there is indeed the same issue for my root containers. Only difference is that they come up after the second restart approach. I have now also for them configured this workaround. From my point of view this is just a workaround. If podman containers need the /etc/resolv.conf of the host system there should be a more generic way to make sure that they wait until this file is available. Also ervery solution should keep in mind that the user might not use NetworkManager but some other solution (e.g. systemd-networkd). |
@msekletar PTAL |
I had the same issue probably due to different cause, but I leave a comment any way for someone who comes across the same issue as the title. In conclusion, it was due to cgroup kill by one of podman systemd unit. My workaround is to deploy a podman systemd unit that always runs before any other containers run. |
A friendly reminder that this issue had no activity for 30 days. |
I think we have documented the issues here in the troublshooting guide. Please reopen if I am incorrect. |
It was very hard to me to except the proposed workaround but I tested and can say that the route cause of the problem is the following: The systemd scope necessary to create and run container must be created beforehand. The use cases when the scope is created by systemd-run --scope and Pod service system units run OK work OK. In both cases either systemd-run or Podman pod create ensure that the scope already exists. The problems with scope are 1. that it can die without any kill, only because all inner processes have exited. 2. It can't be defined using unit file. Podman-pause can't promise it because it can be too late to party and podman-pause scope has created and died beforethe unit starts. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Since some days my rootless containers do not start anymore automatically. This does not happen to my root containers.
Steps to reproduce the issue:
Describe the results you received:
After I boot my PC my root containers are started - my rootless containers not.
When I start the container after booting manually it starts with no errors.
This is what I find after booting:
I use the autogenerated systemd service.
Describe the results you expected:
Alls containers should be started after booting my PC.
Additional information you deem important (e.g. issue happens only occasionally):
This started to happen some days ago (maybe one week). Before this it was working. I did not any changes to these containers.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Additional environment details (AWS, VirtualBox, physical, etc.):
The text was updated successfully, but these errors were encountered: