[systemd-devel] Start service after video drivers have been loaded

Germano Massullo germano.massullo at gmail.com
Fri Jun 14 14:13:32 UTC 2019


I have two different options at the moment, and I would like to ask
you for a feedback.


A file

/usr/lib/udev/rules.d/01-boinc-gpu-plugged.rules

containing

ACTION=="add", SUBSYSTEM=="drm", RUN+=systemctl --no-block restart
boinc-client.service

should restart BOINC client when a new DRM device (under /dev/dri)
appears. So we can fix the problem that unables BOINC to detect OpenCL
capabilities if BOINC service is loaded before the videocard drivers.

Flag
--no-block
is needed to avoid udev time it out agains things runned by RUN. When
udev runs something with RUN it has a timeout and it kills the process
after that so that udev doesn't get blocked on some long running
script triggered from a rule.
By the way since udev has various sandbox rules that restict things
like what sort of sockets you can connect to and what system calls can
be used, this approach could not be recommended.

Another approach that should avoid this problems is

ACTION=="add", SUBSYSTEM=="drm", TAG+="systemd",
ENV{SYSTEMD_WANTS}+="boinc-restart.service"

and then have a simple service (""boinc-restart.service") that does
the restart. By the way this means that the machine will have two
systemd unit files for BOINC client and perhaps even a
boinc-restart.service marked as running among running services.

What do you think about? Thank you for your time


BOINC client systemd unit file:
https://github.com/BOINC/boinc/blob/master/client/scripts/boinc-client.service.in


More information about the systemd-devel mailing list