How to remove a systemd's service?
Disabling a service from systemd:
To disable a systemd’s service the following command can be used:
systemctl stop service-name;
systemctl disable service-name;
Removing a service from systemd:
Systemd uses unit (file to define services) to remove a service the unit file have to be removed, here is a list of unit locations:
/etc/systemd/system/ (and sub directories)
/usr/local/etc/systemd/system/ (and sub directories)
~/.config/systemd/user/ (and sub directories)
/usr/lib/systemd/ (and sub directories)
/usr/local/lib/systemd/ (and sub directories)
/etc/init.d/ (Converted old service system)
Refresh/Reload systemd:
systemctl daemon-reload
systemctl reset-failed
Ghost services (not-found):
Systemd can list ghost (not-found) services even if the unit is deleted for many reasons
- Unit still present on one of the systemd directory
- Unit does not exit but a file link is still present on one of the systemd directory
- The service is used in other unit(s)*
(*) if a service is mentioned in other unit but does not exist systemd will still list that service with the state not-found even if there is not unit file… you can search what unit is using that service with a text search and edit those units (not recommended if you plan to install that service later)