[Pkg-clamav-devel] Bug#969019: Bug#969019: clamav-daemon: How to run clamd under 'daemon' supervision with systemd?

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Sun Nov 1 12:46:32 GMT 2020


On 2020-08-26 09:32:11 [+0200], Benoit Panizzon wrote:
> Package: clamav-daemon
> Version: 0.102.4+dfsg-0+deb10u1
> Severity: normal
> 
> Dear Maintainer
> 
> clamd occasionaly runs in an out of memory situation and is killed on my system. So it would be nice to have it automatically restarted.
> 
> With Bugfix: #250008 the init file has been adapted for clamd to run under 'daemon' supervision.
> The README.Debian also describes this fact.
> 
> Unfortunately I didn't manage to get clamd started under daemon supervision.
> 
> I fear that this is due that since then, debian moved to systemd and the .service file
> is starting clamd directly.
> 
> Please advise how the systemd config has to be changed to achieve the same result.
> I believe systemd can directly supervise a daemon, but I don't know where to find that switch.

I'm not sure that automatic restart is wise:
- if it is processing an email which causes the crash it will crash
  again and again.

- if it is killed due to OOM then it will happen again. It is either due
  to a memory leak or simply because clamav is thirsty. 

In case clamav simply consumes too much memory you may want to increase
the memory available in the system so the daemon runs more stable.
You could also configure clamav to use less memory by disabling certain
features (this is just a guess).
Another option would be to tune clamav via OOMScoreAdjust/
oom-kill-protect to make clamav less of target for the OOM killer.

> -Benoit-

Sebastian



More information about the Pkg-clamav-devel mailing list