Skip to content

Change a systemd Service with a Drop-In Override

Admin
October 5, 2026
7 min read
Intermediate
💻 Target OS: Ubuntu 24.04+ / Debian 12+ / RHEL 9+

Before you begin

  • Applies to:Linux hosts running systemd.
  • Where to start:Open a shell on the affected host. Keep it open so the later steps reuse the service name set in Step 1.
  • What you need:Have sudo access and an existing test service. Find its unit name with systemctl list-units --type=service --all. Arrange a maintenance window before restarting a production service.
Guide tools
Guide tools
0/0 Steps (0%)

systemd drop-ins let an administrator adjust a packaged unit without editing the vendor’s unit file. This guide uses a harmless scheduling-priority change as an example. Use a lab service first; restarting a production service can interrupt applications.


01

Inspect the Unit and Its Existing Overrides

Read First

Choose an existing service and inspect its vendor unit, merged definition, current state, and any drop-in paths before changing it. Replace example.service with a real unit name.

Terminal window
unit=example.service
systemctl status "$unit" --no-pager
systemctl cat "$unit"
systemctl show "$unit" -p FragmentPath -p DropInPaths -p Nice
❯ Illustrative Output (Results Vary)
FragmentPath=/usr/lib/systemd/system/example.service
DropInPaths=
Nice=0
Linux terminal confirming the service drop-in path, Nice value, and active service status

Terminal: Confirm systemd loaded the drop-in and the service remains active.


02

Create a Small Local Override

Drop-In

Use systemctl edit to create /etc/systemd/system/UNIT.d/override.conf. If an override already exists, review it and preserve its settings. The example raises the unit’s nice value, giving it a lower CPU scheduling priority. The exact effect is workload-dependent; avoid changing resource controls without measuring the impact.

Terminal window
sudo systemctl edit "$unit"

Add the example above the boundary comment if the editor displays one. The text below that boundary is reference material and is discarded when you save. If the editable area already has a [Service] section, add or update Nice=5 there and preserve the other settings:

[Service]
Nice=5

What to press · In nano, press Ctrl+O, Enter, then Ctrl+X. In Vim, press i before editing, then press Esc, type :wq, and press Enter. In Step 3, check that systemctl cat lists the drop-in and that systemctl show reports Nice=5 after reloading the unit configuration. Step 4 covers applying the change to the running service.

❯ Illustrative Output (Results Vary)
Created /etc/systemd/system/example.service.d/override.conf

03

Reload and Review the Merged Unit

Configuration Check

After writing a drop-in, reload systemd’s manager configuration. Then inspect the merged unit and property value. A daemon reload does not itself restart the service.

What you should see · DropInPaths lists your override and Nice is 5 for this example.

If you see something else · If the override is absent, return to Step 2 and check that you saved above the editor boundary. If the value differs, inspect the files listed by systemctl cat for a later setting. Continue to the approved restart in Step 4 only after the merged value is correct.

Terminal window
sudo systemctl daemon-reload
systemctl cat "$unit"
systemctl show "$unit" -p DropInPaths -p Nice
❯ Illustrative Output (Results Vary)
DropInPaths=/etc/systemd/system/example.service.d/override.conf
Nice=5

04

Apply Only During an Approved Restart Window

Service Impact

Some properties affect newly started processes, so the running process may not reflect the change until restarted. Check application health requirements, dependencies, and maintenance timing before restarting the real service.

Terminal window
# In a lab, or during an approved maintenance window:
sudo systemctl restart "$unit"
systemctl is-active "$unit"
systemctl show "$unit" -p Nice
journalctl -u "$unit" --since '10 minutes ago' --no-pager
❯ Illustrative Output (Results Vary)
active
Nice=5

05

Remove Only Your Override When Reverting

Rollback

Reopen the override and remove only the Nice=5 line added for this example. Preserve any other directives. Restore the previous Nice value if you changed an existing directive. Saving an empty edit cancels the change. If the file was created solely for this lab, inspect it first and remove just that file using the command below. Reload and verify the baseline from Step 1.

Terminal window
sudo systemctl edit "$unit"
# Edit and save if the file contains other settings. If it was created solely
# for this lab, exit the editor, inspect the file, then remove only that file:
# sudo cat -- "/etc/systemd/system/${unit}.d/override.conf"
# sudo rm -i -- "/etc/systemd/system/${unit}.d/override.conf"
sudo systemctl daemon-reload
systemctl show "$unit" -p DropInPaths -p Nice

If you already restarted the service with the changed setting, repeat the approved restart and workload checks from Step 4 to apply the restored setting.

❯ Illustrative Output (Results Vary)
Nice=0

Further reading: systemctl manual and systemd unit drop-in configuration.

Comments