-
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
Correct systemd configuration for rootless containers // mkdir /run/user/1001: permission denied #5094
Comments
As i mentioned it in my previous post, the reboot of the host was still in progress, while the podman tries to launch the container, that has been stored on the users-home directory. As a consequence of this, the As a consequence of this we need a condition, that delays the podman-start call until the users home environement is ready. The solution is to add Users/Group-ID Require/After to the Unit clause and the Group into the Service - clause as depicted below:
Nice work ! |
I am re-opening as this is something the generated service files should include. Thanks for the nice summary! |
Salut Valenting, there is another thing, you should check out. Each time the host performs a reboot, the host-database is (of course) beeing restartet, but the web-application inside the podman container is beeing melt-up again with all its tcp-connection to the outer (host) space. So the When i restart the host-database via Thank you |
@groovyman is this something to be fixed in podman, or something that the user would need to fix. |
This should be your stuff. I think the podman freezes all socket connections on |
So this is a container listening to proceses on the outside via a unix domain socket? If so then this would require SELinux separation to be disabled. Similarly if it is connecting to socket on the other side it would need to be disabled. |
Salut Daniel, This is the systemd-service file created by podman. The service is running as a user-process under techlxoffice. The file has been stored into ~/.config/systemd/user/container-kivi.service. I testet successfully
Do i have to add a dependency to the host postgres service? Ups, there is a symlink of this file under ~/.config/systemd/user/multi-user.target.wants/container-kivi.service. Who created this ? |
@vrothberg Any ideas? |
If your container needs the postgres service to be running, then you need to add this a dependency.
I assume systemd did. |
uh yes!
Thank you! |
... is still outstanding (working on it atm) |
Ah i see. This belongs to the issue i posted this morning (see my idea at the bottom of my error description.) So the systemctl should wait with the start of the service, until the user-level and the user-account becomes vital. (see issue #5377) As a consequence, i should add the [email protected] as Requires and After to my systemd.service file. This make sense. |
I gave the change of the systemd.service file a try. With the [email protected] in the systemd-file the services are not started. Regardless of the change you have to implement, the system is still failing to run my services. (see #5377). There is another problem. |
I think the user@1001 service is wrong, because when i try:
|
I believe that's not something we can control. Systemd manages that alone. I need to test a bit in a VM. There's a dedicated run-mount service for each user. |
Yes how do you access the postgres.service out of a systemd-user-scope.
|
Only root can see/alter them. Give me a couple more days to look into it :) |
FWIW I cannot reproduce on F31 rootless. In case of root, we had to add network dependencies which is addressed with #5382. Can you try |
The weird thing is, that he did not forget old depencencies. I think the database dependency can be implemented by connecting to the db-listner by |
@groovyman, can you try with a simpler service, maybe just running |
Yeah, i did not, because i described two of my container (a more compex one and a simple one) that already was quite simple enough to play with it. But, i found a solution to this problem, simply take a look at the section Under "An ideas" is i described my impression/approach, that the user context has not been completly setup to run the container. I described the situation, when i logged to the technical account not using a login, but entering it by root and then So the solution is to run (as root):
to enable both account context in oder to allow podman to be called by
but the solution was loginctl! |
#5427 will fix parts of the reported issues here as well. |
With #5427 being merged, I am closing this issue. Both, system and user services are now reported to be starting during startup. |
This issue is closed, but there was another problem i mentioned with stale connections from the host. Finally i resolved that issue (it was not on your side). I was wondering, why the connection from the web-server inside my container to the host outside database listener sometimes was in a stale state. Now, i figured out, that -sometimes- the database was started too early by systemd, finally not able to bind with an eth0 device, that was addressed by the container'ed application. So, that was my fault. ( solution is here ) Everything is working now for me, my accounting-application is now running reliable in a podman-container. In build mode, your application
and finally completes its work, when it is beeing started (podman run). Thanks to you all for your great job and your notable support! |
@groovyman, thanks a lot for sharing! I am really happy it's working. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
I am trying to control the start/stop process of a rootless container with systemd. Yesterday Matthew was so nice to help me with #5057. The i checked these useful links:
My service-file looks like this:
When i perform systemctl start/stop on a running system, systemd is able to start/stop the container without any problems. Please note, that the container resides inside a user-account (i call it technical user, simply non root).
As i mentioned before, the start/stops is running from the console. Unfortunately it fails, when the host-system is restarted. Podman-start returns:
I think, the podman-start should be called later, if possibe.
Steps to reproduce the issue:
Describe the results you received:
podman writes:
Describe the results you expected:
I would expect the same behaviour as i perform a
systemctl restart
on my console.Additional information you deem important (e.g. issue happens only occasionally):
I receive the following message in the output (defined in the depicted service file).
I guess, the user-session environement hast not been set up correctly.
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: