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

generate systemd: add default.target to INSTALL #5427

Merged
merged 2 commits into from
Mar 9, 2020
Merged

Conversation

vrothberg
Copy link
Member

When enabling a systemd service we can specify which target will start
it by specifying it in the [INSTALL] section. In case of root, this
is commonly set to multi-user.target which is used to start other
essential system services such as the network manager, D-BUS and more.

However, the multi-user.target is not enough on all systems,
especially when running rootless and enabling user services. Multiple
users have reported issues that there isn't even an attempt to start the
service.

Setting the INSTALL target to default.target will fix the rootless
case. However, default.target may vary among systems. Fedora
Workstation, for instance, sets the default.target to the graphical
target (i.e., runlevel 5) while Fedora Server sets it to
multi-user.target which is on runlevel 2 and hence way earlier in the
startup sequence.

As INSTALL allows for specifying multiple INSTALL targets, we can set it
to multi-user.target to continue supporting existing workloads AND to
default.target which MAY redundantly attempt to start it at a later point;
effectively a NOP for the root case and essential for rootless.

Fixes: #5423
Signed-off-by: Valentin Rothberg [email protected]

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vrothberg
Copy link
Member Author

@giuseppe @rhatdan @edsantiago PTAL

@edsantiago
Copy link
Member

Could you update docs/source/markdown/podman-generate-systemd.1.md and docs/tutorials/rootless_tutorial.md please? (I feel really dumb for having restarted the flakes before reviewing)

When enabling a systemd service we can specify which target will start
it by specifying it in the `[INSTALL]` section.  In case of root, this
is commonly set to `multi-user.target` which is used to start other
essential system services such as the network manager, D-BUS and more.

However, the `multi-user.target` is not enough on all systems,
especially when running rootless and enabling user services.  Multiple
users have reported issues that there isn't even an attempt to start the
service.

Setting the INSTALL target to `default.target` will fix the rootless
case.  However, `default.target` may vary among systems.  Fedora
Workstation, for instance, sets the `default.target` to the graphical
target (i.e., runlevel 5) while Fedora Server sets it to
`multi-user.target` which is on runlevel 2 and hence way earlier in the
startup sequence.

As INSTALL allows for specifying multiple INSTALL targets, we can set it
to `multi-user.target` to continue supporting existing workloads AND to
`default.target` which MAY redundantly attempt to start it at a later point;
effectively a NOP for the root case and essential for rootless.

Fixes: #5423
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

Could you update docs/source/markdown/podman-generate-systemd.1.md and docs/tutorials/rootless_tutorial.md please? (I feel really dumb for having restarted the flakes before reviewing)

Done. Note that I removed the section from the rootless tutorial. The example there was incorrect. As users should use podman generate systemd and since there's no real difference between root and rootless (we want so support both), I opted to remove the section.

The example was not entirely correct.  Users should use `podman generate
systemd` and use the output either directly or as a template for further
adjustments to their needs.  Keeping an example in the rootless tutorial
is a maintenance burdon and can easily suggest incorrect usage patterns
to users.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member Author

Not sure why GitHub is not seeing the new commit ...

@vrothberg
Copy link
Member Author

Not sure why GitHub is not seeing the new commit ...

Accidentally created an upstream branch for it....

@edsantiago
Copy link
Member

LGTM. Good luck with the flakes.

@mheon
Copy link
Member

mheon commented Mar 9, 2020

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2020
@vrothberg
Copy link
Member Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2020
@vrothberg
Copy link
Member Author

Shall we force merge?

@mheon
Copy link
Member

mheon commented Mar 9, 2020

At this point, yeah, not worth waiting for the bot.

@mheon mheon merged commit 342d99f into master Mar 9, 2020
@vrothberg vrothberg deleted the systemd-default branch March 10, 2020 07:08
edsantiago added a commit to edsantiago/libpod that referenced this pull request Mar 16, 2020
PR collision with containers#5427

Solution: add 'default.target' to WantedBy

Signed-off-by: Ed Santiago <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman generate systemd creates incorrect WantedBy for user services
4 participants