Gsad.service activating

I’ve seen these problems thanks to the distributed systemd unit file (/lib/systemd/system/gsad.service, generated from gsad.service.in) using Type=forking rather than Type=exec and passing the --foreground flag to gsad.
For some reason, systemd loses track of the gsad process (once it’s double-forked away or something, I haven’t bothered looking in to that) and then is unable to stop it. This means that when you next try to start gsad the old one is actually still running, so it can’t bind a listener or open a new pid file, and fails hard.
My solution is to change the systemd unit to Type=exec so that systemd can actually track the process properly, and then everything works better. I haven’t been bothered submitting a PR against the upstream source (I should probably do that) but rather I just drop this override in place:
/etc/systemd/system/gsad.service.d/override.conf

[Service]
Type=exec
ExecStart=
ExecStart=/usr/sbin/gsad --listen 127.0.0.1 --port 9392 --foreground

edit: PR created

2 Likes