3

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 clamd@.service

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/clamd@.service 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

philolegein
  • 369
  • 3
  • 9

1 Answers1

4

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 clamd@.service

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 clamd@.service edits a temporary file that will go somewhere like /etc/systemd/system/clamd@.service.d/override.conf and might contain just the different TimeoutStartSec=.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32