2

What is the systemd-approved method for removing e.g. sidekiq.service from /etc/systemd/system/?

Note, there are many related discussions on this topic such as this one which I have already read: https://superuser.com/questions/513159/how-to-remove-systemd-services

My point of confusion is that the most-accepted answer in the above discussion requires the user to manually rm files from a bunch of locations, but a later answer suggests that systemctl disable <service> should have the same effect as manually removing the files.

According to my own testing of systemctl disable sidekiq, I am finding that the unit file sidekiq.service remains at /etc/systemd/system afterwards.

I understand that, in theory, using rm on a bunch of locations should do the trick, but I'm wondering how someone who is actually familiar with systemd or systemctl would do this. Is such brute force really necessary, or is there an actual systemctl command for this purpose?

2
  • Exactly what are you trying to accomplish? Feb 6, 2021 at 19:40
  • @MichaelHampton I'm trying to remove artifacts of my sidekiq installation
    – afarley
    Feb 6, 2021 at 20:07

1 Answer 1

4

If you're trying to uninstall software, then removing the file is the correct approach. But remember that systemd will remember the service until told to reload its configuration with systemctl daemon-reload. Then it will notice the unit is gone, and (if the service isn't still running) forget about it.

1
  • I was trying to disable a service, but it was still showing up even after daemon-reload. Turns out I was forgetting to use disable --now, so systemd was still hanging onto it because it was running. You're line "if the service isn't still running" was the hint I needed. Thanks! May 13 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.