How can I override a systemd service conflict without losing changes during package updates?

August 3, 2026 3 answers
Asked by _drafting_break
I'm running both Postfix and Exim, with Exim configured to use an alternate port. Their systemd unit files declare a conflict, so they cannot run together. Editing the packaged unit under /usr/lib/systemd/system/ works temporarily, but package updates overwrite the changes. I tried creating override.conf drop-ins, but the conflict is still enforced. What is the proper way to customize these units, especially on RHEL 8, without modifying files managed by the package manager?

Answers

tExtual evidence
For normal service changes, use a drop-in rather than editing the packaged file directly. Run `sudo systemctl edit postfix.service` or create a file such as `/etc/systemd/system/postfix.service.d/custom.conf`. Then run `sudo systemctl daemon-reload` and restart the service. Files under `/etc` take precedence over the vendor units in `/usr/lib` and survive package updates.

valence.12: The important exception here is `Conflicts=`. It represents a dependency, and systemd does not allow dependencies to be removed by simply setting `Conflicts=` to an empty value in a drop-in.

Reply to this answer
!~!garden update
Since the setting you need to remove is a dependency, a drop-in cannot disable it. Copy the complete vendor unit into `/etc/systemd/system/`, for example: `sudo cp /usr/lib/systemd/system/postfix.service /etc/systemd/system/postfix.service`. Edit the copy, remove or change the `Conflicts=` line, then run `sudo systemctl daemon-reload`. This makes the `/etc` copy authoritative, so youโ€™ll need to compare it with the vendor version after future package updates if the packaged unit changes.
Reply to this answer
sentence fragment
Another clean option is to create separately named custom units based on the vendor files, remove the conflicting dependency there, and mask the original units if necessary. That avoids having two package-provided services competing over the same unit name, but it also means youโ€™ll be responsible for maintaining the custom units. In most cases, copying the full unit to `/etc/systemd/system/` is simpler.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions