-
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
podman-restart.service causes shutdown to hang #14434
Comments
Restart-policy doesn't actually use or require |
Since I use the podman-restart.service to start all containers with restart-policy=always I added the ExecStop with the same filter just to stop the same containers. The problem does not come from the restart-policy, it comes from the fact, that without ExecStop added to the podman-restart.service, systemd needs to kill the running containers forcefully in order to shut down (since nothing else seem to stop them gracefully). |
Makes sense to me. @vrothberg WDYT? |
Sounds good to me. Adding a new |
@andrin55, interested in opening a PR to fix the issue? We can add the |
@vrothberg I made a new pull request. I messed something up with the signoff with the previous one. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Enabling podman-restart.service causes shutdown to hang until the containers are killed after the timeout.
Steps to reproduce the issue:
Create container with restart-policy=always
Enable podman-restart.service
Restart and observe log
Describe the results you received:
Systemd waits 1m 30s for "libcrun container" until it kills it.
Describe the results you expected:
Graceful shutdown of containers on shutdown
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes (RHEL Podman)
Additional environment details (AWS, VirtualBox, physical, etc.):
Running latest RHEL9 Podman.
Due to podman-restart.service not having a ExecStop procedure, it fails when stopping:
However this does not seem to stop the container, which then gets killed by systemd after the timeout.
Adding ExecStop to the podman-restart.service solves the issue (due to podman stop not supporting the "--filter" flag, I had to use this workarround):
ExecStop=/bin/sh -c '/usr/bin/podman $LOGGING stop $(/usr/bin/podman container ls --filter restart-policy=always -q)'
The text was updated successfully, but these errors were encountered: