Skip to content
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

Delay being killed on reboot/poweroff #811

Closed
wants to merge 1 commit into from

Conversation

champtar
Copy link

@champtar champtar commented Jan 8, 2025

Setting KillSignal=SIGCONT is a hack, but it gives us DefaultTimeoutStopSec before being killed (45s on Fedora, 90s on EL9).
The proper systemd way would be to use inhibit locks but they are ignored by reboot/poweroff commands, ie you need the systemctl reboot/poweroff variants, and just using systemd-inhibit makes all the logs starts with systemd-inhibit instead of bootupctl.

Setting KillSignal=SIGCONT is a hack, but it gives us DefaultTimeoutStopSec
before being killed (45s on Fedora, 90s on EL9).
The proper systemd way would be to use inhibit locks but they are
ignored by reboot/poweroff commands, ie you need the systemctl
reboot/poweroff variants, and just using systemd-inhibit makes all the
logs starts with systemd-inhibit instead of bootupctl.
Copy link

openshift-ci bot commented Jan 8, 2025

Hi @champtar. Thanks for your PR.

I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! I'd prefer to have us explicitly ignore SIGTERM in our own code.

@champtar
Copy link
Author

champtar commented Jan 8, 2025

Thanks for the patch! I'd prefer to have us explicitly ignore SIGTERM in our own code.

If we want to fully integrate with systemd, we can use sd_notify() and send EXTEND_TIMEOUT_USEC= (https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#EXTEND_TIMEOUT_USEC=%E2%80%A6)

If we just ignore SIGTERM, we must set KillMode=mixed so that subprocess do not also get SIGTERM (https://www.freedesktop.org/software/systemd/man/latest/systemd.kill.html#KillMode=)

I'm hello world level in rust so if someone wants to implement this please go ahead

cgwalters added a commit to cgwalters/bootupd that referenced this pull request Jan 8, 2025
Since our updates are non-transactional in general, we should
at least be robust against some concurrent invocation of e.g.
`reboot`.

Replaces: coreos#811
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters
Copy link
Member

Moving this to #812

Thanks again for submitting a patch though!

@cgwalters cgwalters closed this Jan 8, 2025
@champtar champtar deleted the delaykill branch January 8, 2025 21:34
cgwalters added a commit to cgwalters/bootupd that referenced this pull request Jan 8, 2025
Since our updates are non-transactional in general, we should
at least be robust against some concurrent invocation of e.g.
`reboot`.

Replaces: coreos#811
Signed-off-by: Colin Walters <walters@verbum.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants