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

Our systemd services are probably using Type=oneshot wrong #7349

Closed
legoktm opened this issue Nov 22, 2024 · 0 comments · Fixed by #7350
Closed

Our systemd services are probably using Type=oneshot wrong #7349

legoktm opened this issue Nov 22, 2024 · 0 comments · Fixed by #7350
Assignees

Comments

@legoktm
Copy link
Member

legoktm commented Nov 22, 2024

Based on reading https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html,

Type=oneshot is for services that you want to be considered "up" after they finish running, in conjunction with RemainAfterExit. But we don't do that, so as the doc explains, "the service will never enter "active" unit state, but will directly transition from "activating" to "deactivating" or "dead", since no process is configured that shall run continuously".

I think we want Type=exec, which triggers the command, moves to "running" as it runs, and then once it stops, moves to "dead".

We also have a number of services that don't specify any Type, and are defaulting to Type=simple. I don't think this is wrong, but exec seems like it has slightly better semantics.

Since I introduced all the oneshot ones, I'm going to fix those and leave the simple ones alone.

@legoktm legoktm added this to the SecureDrop 2.11.0 milestone Nov 22, 2024
@legoktm legoktm self-assigned this Nov 22, 2024
legoktm added a commit that referenced this issue Nov 22, 2024
`oneshot` is designed to be used with RemainAfterExit, but we don't need
that nor use it. After reviewing
<https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html>,
`exec` appears to be the correct type since we want the service to be
running once the binary has started, not once it's finished.

Practically this shouldn't make a big difference except that `systemctl
start <name>` won't wait for the entire command to complete.

Fixes #7349.
@cfm cfm closed this as completed in #7350 Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant