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?
3 Answers
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.
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.
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.

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.