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

fix: Replace incorrectly used Systemd Alias directive with a WantedBy #657

Merged
merged 1 commit into from
Apr 7, 2023

Conversation

irvingpop
Copy link
Contributor

Which problem is this PR solving?

In testing Refinery with Amazon Linux 2023, I noticed that systemd refused to start the Refinery service, complaining about:

Failed to enable unit: Cannot alias refinery.service as refinery.

I asked the Amazon Linux devs what they thought about this, and they pointed out that Alias directive is being used incorrectly and helpfully suggested a better replacement. Their comment:

I'm a bit surprised this ever worked, actually. At best it was redundant, but it's not clear that it was ever even valid. Going back as far as AL2's systemd 219, the documentation indicates that aliases must specify the same suffix as the original unit file. An alias without a suffix at all has never been documented as being valid or meaningful, and systemd commands like systemctl would automatically apply a .service suffix to unqualified arguments (so, e.g. even in AL2, systemctl status sshd was equivalent to systemctl status sshd.service with no explicit aliases involved.)

A usual [Install] section does not normally need to specify an Alias= directive at all. Most likely the only line you'll need there is a WantedBy= directive indicating the services or targets that trigger the activation of this service. WantedBy=multi-user.target is a good place to start.

Short description of the changes

This PR updates our Systemd unit file, replacing the Alias directive (incorrectly used, expected to break on other newer systemd-using OSes) with more of a "best practices" kind of line ( WantedBy=multi-user.target )

@irvingpop irvingpop requested a review from a team as a code owner April 4, 2023 22:25
@irvingpop irvingpop changed the title Replace incorrectly used Systemd Alias directive with a WantedBy fix: Replace incorrectly used Systemd Alias directive with a WantedBy Apr 4, 2023
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

Honestly, I didn't know what this file did. Thank you.

@kentquirk kentquirk added this to the v1.21 milestone Apr 7, 2023
Signed-off-by: Irving Popovetsky <irving@honeycomb.io>
@irvingpop irvingpop force-pushed the irving/fix-systemd-install-directive branch from 54e8f47 to 192afb3 Compare April 7, 2023 14:48
@irvingpop irvingpop merged commit 4c6d3e0 into main Apr 7, 2023
@irvingpop irvingpop deleted the irving/fix-systemd-install-directive branch April 7, 2023 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants