You are not logged in.

#1 Yesterday 04:05:04

Beemo
Member
Registered: 2024-12-20
Posts: 187

[SOLVED] Changing a systemd unit name

In a package upgrade, I want to change a systemd service unit name.
Current I tried using a symlink with the old name to the new service (so that users relying on the old name don't break). However, if a user have previously run systemctl enable old@test.service it indeed still starts at boot, but now both systemctl status old@test or systemctl status new@test report the unit is disabled.

What's the right way to automatically migrate in this case?

Last edited by Beemo (Today 12:56:48)

Offline

#2 Yesterday 05:15:34

Beemo
Member
Registered: 2024-12-20
Posts: 187

Re: [SOLVED] Changing a systemd unit name

Related: How to migrate a folder's permission?
I changed the install permission to 700 but during upgrade it warns:

warning: directory permissions differ on /etc/path-to-folder/
filesystem: 755  package: 700

Or is manual intervention the only way for these changes?

Last edited by Beemo (Yesterday 05:16:21)

Offline

#3 Yesterday 06:34:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,105

Re: [SOLVED] Changing a systemd unit name

You can use a https://wiki.archlinux.org/title/PKGBUILD#install script to update files on the target system w/ eg. post_upgrade - either manually or using systemctl

Offline

#4 Today 09:22:29

Beemo
Member
Registered: 2024-12-20
Posts: 187

Re: [SOLVED] Changing a systemd unit name

Yep the install script works. However someone mentioned that these changes should be manual interventions, is it true? I couldn't find a definition for manual intervention online...

Offline

#5 Today 12:30:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,105

Re: [SOLVED] Changing a systemd unit name

"Don't fight the user" - if you've reason enough to assume that the file you're going to change was put there/deliberately changed by the user, leave it alone, issue a warning for manual action.
If it's just an artifact of your packaging strategy you can just as much just fix it.

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB