6

I used sudo systemctl edit name.service to edit a service, now I no longer need these modifications and I wish to restore it to its default setting.

How can I restore it?

I'm running Ubuntu 16.04.

9

If you're running a version of systemd higher than of "229", then you can simply use:

systemctl revert name.service

From github commit:

This allows dropping all user configuration and reverting back to the vendor default of a unit file.

  • It basically undoes what:
    • "systemctl edit"
    • "systemctl set-property" and
    • "systemctl mask" do.

Ubuntu 16.04 uses "systemd version 229", so you should remove override file manually:

sudo rm -r /etc/systemd/system/name.service.d

Then reload systemd daemon and restart your service:

sudo systemctl daemon-reload
sudo systemctl restart name.service

Remember that if you used --full with edit subcommand to copy the original unit instead of creating a drop-in file, then you should remove /etc/systemd/system/name.service instead of the directory.

| improve this answer | |

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.