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

systemctl enable/preset should take over broken alias symlinks #23694

Closed
rhertzog opened this issue Jun 10, 2022 · 3 comments · Fixed by #25885
Closed

systemctl enable/preset should take over broken alias symlinks #23694

rhertzog opened this issue Jun 10, 2022 · 3 comments · Fixed by #25885
Labels
bug 🐛 Programming errors, that need preferential fixing systemctl
Milestone

Comments

@rhertzog
Copy link

In Debian, when we remove a package, we are not disabling the service provided by that package, the "enablement state" of the service is kept along with the configuration files so that if you reinstall the package, you end up in the same state.

The downside to this is that when you have a service unit with an "Alias" directive, the symlink created for the aliased name also stays and becomes a broken symlink (because the underlying .service file has been removed from /usr/lib/systemd/).

This symlink is then causing issue when the same aliased name is reused by another service unit. For instance, when I try to switch from wireplumber to pipewire-media-session (or the opposite), I will get an error like this:

$ sudo systemctl enable --global pipewire-media-session.service 
Failed to enable unit, file "/etc/systemd/user/pipewire-session-manager.service" already exists and is a symlink to "/usr/lib/systemd/user/wireplumber.service".

I would like systemd to recognize that this symlink is broken and behave as if it didn't exist precisely because it's broken. I don't think that you would break backwards compatibility in any meaningful way with this change.

@yuwata
Copy link
Member

yuwata commented Jun 15, 2022

Please provide version of systemd.

@yuwata yuwata added systemctl needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Jun 15, 2022
@yuwata
Copy link
Member

yuwata commented Jun 15, 2022

We have fixed several issues in enabling/disabling units. Please try to v251 if you use older.

@rhertzog
Copy link
Author

@yuwata Sorry that I forgot to mention the version, this was reproduced with version 251.2-2 (version in Debian unstable).

@yuwata yuwata added bug 🐛 Programming errors, that need preferential fixing and removed needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Jun 15, 2022
@yuwata yuwata added this to the v252 milestone Jun 15, 2022
@poettering poettering modified the milestones: v252, v253 Jul 26, 2022
YHNdnzj added a commit to YHNdnzj/systemd that referenced this issue Jan 4, 2023
When switching to an alternative alias provider,
the previous one might have been uninstalled or so.
It should be fine for us to overwrite them directly.

Closes systemd#23694
YHNdnzj added a commit to YHNdnzj/systemd that referenced this issue Jan 4, 2023
When switching to an alternative alias provider,
the previous one might have been uninstalled or so.
It should be fine for us to overwrite them directly.

Closes systemd#23694
bluca pushed a commit that referenced this issue Jan 5, 2023
When switching to an alternative alias provider,
the previous one might have been uninstalled or so.
It should be fine for us to overwrite them directly.

Closes #23694
d-hatayama pushed a commit to d-hatayama/systemd that referenced this issue Feb 15, 2023
When switching to an alternative alias provider,
the previous one might have been uninstalled or so.
It should be fine for us to overwrite them directly.

Closes systemd#23694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing systemctl
Development

Successfully merging a pull request may close this issue.

3 participants