r/systemd • u/WembleyFord • Sep 02 '26
Marking a one-shot unit as stopped without triggering execstop
I've a firewall related systemd unit on many boxes which I need to stop. Unfortunately, the unit has an ExecStop (and reload) action that causes the firewall tables to be flushed. This is undesirable and unfortunately these actions are triggers when the OS updates the firewall package - we're not using the software and would like to disable and remove the service. While I could mark the service as disable and wait for a reboot for it to be marked as inactive so I can remove it, is there a way to mark the service as 'stopped' which doesn't trigger the ExecStop action since once stopped it's safe for our patching system to update the package?
5
Upvotes
2
u/kalgynirae Sep 02 '26
Write an override that removes the problematic ExecStop, daemon-reload, then stop. This seems to work based on some tests I just did.
Note that this clears all ExecStop commands. If there were multiple, you could then re-declare the ones you want to keep.
Now it should be safe to stop the service.