TransWikia.com

How are systemd/system overrides supposed to work?

Server Fault Asked by philolegein on November 4, 2021

I’m messing around with some timeout settings, and am trying to figure out the correct way to set things for systemd/system daemons. Specifically, this is an underpowered server, and I keep timing out on starting clamd, so I’m trying to figure out how high I need to set the TimeoutStartSec parameter. I tried

systemctl edit --full [email protected]

and edited it to say

TimeoutStartSec=20min

then did systemctl daemon-reload

But it kept mysteriously timing out after 7 minutes. Eventually, I found that /usr/lib/systemd/system/[email protected] had TimeoutStartSec=420.

Probably against all Right Way to do things, I edited the /usr/lib version of the file, and commented out that line. Sure enough, that changed things, but it still doesn’t seem to be reading the /etc/systemd version. Once I commented it out, it start timing out after 90 seconds, which I guess must be the default.

As a temporary workaround, I’ve edited the /usr/lib version to be my desired 20 minutes, but … this doesn’t seem like the right way to do things.

Is systemctl edit supposed to be editing the version in /etc/systemd/system?
Is this the putatively correct way to do things?
Do I have to do something more than systemctl daemon-reload?

Open to any and all suggestions on The Right Way to do this.

TIA

One Answer

systemctl daemon-reload is telling systemd itself to reload changed unit configuration. Not the software started by the unit, in this case clamd. (Despite the manual warning about this distinction, you are not the first be confused by it.)

Instead, use one of the unit commands, like systemctl reload-or-restart [email protected]

Is systemctl edit supposed to be editing the version in /etc/systemd/system?

Yes. The idea is that /etc contains site-specific configuration, which overrides what the system package installed to /usr.

I would omit --full and create "drop-in" files with only the different options. Avoids maintaining an entire copy of the unit. For example systemctl edit [email protected] edits a temporary file that will go somewhere like /etc/systemd/system/[email protected]/override.conf and might contain just the different TimeoutStartSec=.

Answered by John Mahowald on November 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP