usbguard
usbguard copied to clipboard
Daemonize parent returns before the IPC server is available
According to systemd documentation for forking services: "The child continues to run as the main service process, and the service manager will consider the unit started when the parent process exits".
The parent is currently exiting as soon as the creation of the child is confirmed (https://github.com/USBGuard/usbguard/blob/f0111982b1baed99b2dda3cf7734e88716464a52/src/Daemon/Daemon.cpp#L568) but before the IPC server is started (https://github.com/USBGuard/usbguard/blob/f0111982b1baed99b2dda3cf7734e88716464a52/src/Daemon/Daemon.cpp#L497). For a service that depends on that IPC server, we cannot rely on systemd dependencies.
@jvymazal Would it make sense to only terminate the parent process once the IPC server has been started so that systemd dependencies can be sure that the server is available?
If you are running usbguard with the default .service file, it won't detach. Does this issue still apply to you?