The following sections contain some examples for systemd customization.
WARNING: Avoiding Overwritten Customization
Always do systemd customization in /etc/systemd/, never in /usr/lib/systemd/. Otherwise your changes will be overwritten by the next update of systemd.
The systemd service files are located in /usr/lib/systemd/system. If you want to customize them, proceed as follows:
Copy the files you want to modify from /usr/lib/systemd/system to /etc/systemd/system. Keep the file names identical to the original ones.
Modify the copies in /etc/systemd/system according to your needs.
For an overview of your configuration changes, use the systemd-delta command. It can compare and identify configuration files that override other configuration files. For details, refer to the systemd-delta man page.
The modified files in /etc/systemd will take precedence over the original files in /usr/lib/systemd/system, provided that their file name is the same.
If you only want to add a few lines to a configuration file or modify a
small part of it, you can use so-called
Drop-in files let you extend the configuration of unit files without having
to edit or override the unit files themselves.
For example, to change one value for the FOOBAR service located in /usr/lib/systemd/system/FOOBAR.SERVICE, proceed as follows:
Create a directory called /etc/systemd/system/MY_SERVICE.service.d/.
Note the .d suffix. The directory must otherwise be named like the service that you want to patch with the drop-in file.
In that directory, create a file WHATEVERMODIFICATION.conf.
Make sure it only contains the line with the value that you want to modify.
Save your changes to the file. It will be used as an extension of the original file.
On System V init SUSE systems, runlevel 4 is unused to allow administrators to create their own runlevel configuration. systemd allows you to create any number of custom targets. It is suggested to start by adapting an existing target such as graphical.target.
Copy the configuration file /usr/lib/systemd/system/graphical.target to /etc/systemd/system/MY_TARGET.target and adjust it according to your needs.
The configuration file copied in the previous step already covers the
hard) dependencies for the target. To also cover
the wanted (
soft) dependencies, create a directory
For each wanted service, create a symbolic link from /usr/lib/systemd/system into /etc/systemd/system/MY_TARGET.target.wants.
Once you have finished setting up the target, reload the systemd configuration to make the new target available: