Disable service in systemd

I installed fluidsynth in Ubuntu 22.04. I did not want the process running all the time. The install set it up service (or session) as a user WantedBy=default.target

I tried systemctl --user disable fluidsynth but when I logged out and back in, fluidsynth was running again.
I ended up removing (deleting) the symlink in the /etc/systemd/user/default.target.wants/ directory. That took care of the problem.
Now if I use systemctl --user enable fluidsynth it recreates the symlink in the ~/.config/systemd/user/default.target.wants/
and when I systemctl --user disable fluidsynth it removes the symlink.
I really don’t need to enable and disable the service, but it is now working as I thought it should of at the beginning.

My question is what was the proper way to remove the initial symlink?

Maybe it was installed and enabled for all users and a sudo systemctl disable fluidsynth would have done it. But it seems like what you did should have worked.

1 Like

When I tried that I got an error.

Failed to disable unit: Unit file fluidsynth.service does not exist.

If I didn’t use --user it would always say

Unit file fluidsynth.service does not exist.

of course when I used --user, it puts/removes the symlink under the home folder (~/.config/systemd/user/).

& yes, you are correct, it was initially setup for all users.

I just couldn’t figure out how to get it to remove the original symlink under /etc/systemd/user/

Big picture- I guess it doesn’t matter. I was just wondering if I was missing something obvious.

1 Like

It should have been

systemctl --global [enable/disable] fluidsynth
6 Likes

Thanks for the info-
Next time I’ll know how to do it properly.

1 Like