r/linuxadmin • u/Burgergold • Jun 25 '26
How to override systemd conflict
Running postfix and exim. Exim is on an alternative port. Both are in conflict in systemd unit files. If I edit the file, ir gets overwrited each time exim or postfix package is updated. Tried to create a folder for each service with override.conf but its not taken.
16
Upvotes
27
u/Hotshot55 Jun 25 '26
Quit editing the /usr/lib/systemd/system/*.service file and create a drop-in at /etc/systemd/system/
4
u/BloodyIron Jun 25 '26
I think you might be modifying the systemd in a way different from how your distro prefers you do.
Without knowing which distro you're using I can't give specific advice, but here's something that might help.
In my case I rock Ubuntu a lot, and I previously tried modifying such systemd unit files, and had the same problem. But with certain commands I can customise the systemd service without breaking updating of it.
For example:
sudo systemctl edit nginx
Would achieve this for me. And the ecosystem through symlinks etc makes those changes apply.
This is of course if you're editing a systemd daemon already established, which your distro should be doing for you in the process of installing exim/postfix.
1
u/arcimbo1do Jun 26 '26
Not an expert, but what if you mask both services and then create two custom services with different names, copying the unit files and removing the conflicts?
3
u/sequentious Jun 26 '26
You've missed a few key points from the documentation.
From
man systemd.unit, at the bottom under Examples, there's notes and examples of the two ways to modify a systemd unit file:cp /usr/lib/systemd/system/postfix.service /etc/systemd/system/postfix.servicesystemctl edit postfix.service, which would create/etc/systemd/system/postfix.service.d/overlay.confThat's a re-cap, because based on your other comments, you've already been experimenting with the drop-in. You've already tried blanking the Conflicts entry:
The Example in the man page was using this method to blank
AssertPathExistsinstead of Conflicts, so I can see why you'd think it would work. However, there's a key line from the manpage that you missed:And if you scan back up the manpage and read the description for
Conflicts=:Conflicts is a dependency, which means it can't be blanked out from a drop-in.
You'll have to go with the method of copying the whole unit file, and modifying to remove the Conflicts= line.
-1
u/mestia Jun 25 '26
I'd rather put either exim, or postfix, or both into containers...
-5
u/abotelho-cbn Jun 25 '26
https://www.freedesktop.org/software/systemd/man/latest/systemd.service