What is the difference between systemctl edit vs. edit --full

In our knowledgebase, we have various articles which tell you how to modify systemd units. There are basically three ways how to manipulate a systemd unit.

  1. Directly editing the system unit shipped with OpenNMS in /usr/lib/systemd/system/opennms.service
  2. Use systemctl edit --full opennms to edit the systemd unit file
  3. Use systemctl edit opennms to create a partially override file

Each of the options has some pros and cons as always – let’s go through them.

Editing the unit directly described in 1. and 2. means less confusion, there is only one file, easy to verify and you don’t know much about overriding settings. If you run an update, you need to be aware of merging the changes coming to you from upstream when you run upgrades.

The variant in 3. with systemctl edit opennms.service has a bit different behavior. You can modify just specific directives in the unit without manipulating the original file. It will create a file in /etc/systemd/system/opennms.service.d/override.conf and you can add or change existing directives specifically. The big benefit of this method is you don’t change the pristine unit, it just overrides the existing one with the changes you provide. For example, using systemctl edit opennms.service and filling it with

[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE

will just add the ambient capabilities to the opennms.service as it is. The override file and systems unit get merged and you don’t have to manually verify and merge opennms systemd unit changes during an update.


:woman_facepalming: You can fix me, I’m a wiki post.