Possible xhost error in boinc-client script
aspensmonster at riseup.net
Sat Jan 9 01:20:25 UTC 2016
-----BEGIN PGP SIGNED MESSAGE-----
> Hello Preston and Gianfranco
> Thanks for working this issue.
You're welcome. It's been a fun one :P I'm certainly more experienced
with the intricacies of systemd now (and finding myself enjoying
systemd-the-init-system, and disliking
> I was just about to say we only need the 36 file or we fight with
> x11-common, and i know who wins! ;-)
> I was going to suggest on 36
> === # # Some boinc headers needed so if some poor admin stumbles
> across this he knows where it came from... # # This file is sourced
> by Xsession(5), not executed. BOINC_USER=boinc # # If xhost (from
> x11-xserver-utils) is installed, use it to give access # to the X
> server to any process from the same user on the local host. #
> Unlike other uses of xhost, this is safe since the kernel can
> check # the actual owner of the calling process.
> if type xhost >/dev/null 2>&1; then id -u $BOINC_USER >/dev/null
> 2>&1 && xhost +SI:localuser:$BOINC_USER || : fi ===
I like it. Having the variable makes it more generic.
> I have tried removing my xhost hack from the lightdm.conf and
> The AMD GPU was not detected by boinc at reboot, (using 36 file) so
> GPU tasks not starting.
> Then logging in as normal - started boincmgr (see the non-started
> xhost does show boinc has been added as +SI:localuser:boinc
> A command line "sudo boinc-client restart" works as expected and
> the GPU is detected.
/me sighs. I figured that the AMD GPU issue would still not be fixed.
> May i ask - if either of you have an AMD card - did you find -
> that boinc automatically starts running GPU tasks on bootup?
Unfortunately I do not have access to any AMD cards. I use Nvidia
cards with the proprietary drivers
(I know, I know, shame on me; but nouveau basically doesn't have
OpenCL support: https://wiki.freedesktop.org/nouveau/FeatureMatrix/)
which don't even need access to the Xservers to crunch GPU work units.
Or rather, if they do, then they were getting access in a manner that
didn't require adding the boinc user via xhost.
I suspect that something about the AMD drivers requires/expects an
Xserver in such a manner that boinc won't start AMD GPU tasks without
one present. Or at least, boinc is starting too early for it to access
the graphics drivers for AMD cards. I know that the current GPU
detection code for BOINC does NOT poll periodically for GPU drivers
and their usability. It's a static, one-time check at boinc-client
start. If the detection fails, then GPU tasks don't start for the life
of the boinc-client process.
I've also been reading over systemd's documentation, and I was looking
for a way to specify a conditional startup requirement. If graphical
environment available, then wait to start boinc until it's available,
else, don't wait just start. Some users might not have GPU computation
available, so waiting for a graphical environment isn't necessary. But
some will, so... how do we satisfy both?
It looks like the "Wants=" and "After=" directives might/probably do
what we want. From "man 5 systemd.unit":
A weaker version of Requires=. Units listed in this option will be
started if the configuring unit is. However, if the listed units fail
to start or cannot be added to the transaction, this has no impact on
the validity of the transaction as a whole. This is the recommended
way to hook start-up of one unit to the start-up of another unit.
A space-separated list of unit names. Configures ordering
dependencies between units. If a unit foo.service contains a setting
Before=bar.service and both units are being started, bar.service's
start-up is delayed until foo.service is started up. Note that this
setting is independent of and orthogonal to the requirement
dependencies as configured by Requires=. It is a common pattern to
include a unit name in both the After= and Requires= option, in which
case the unit listed will be started before the unit that is
configured with these options.
So, we can specify a Wants= directive, attached to an appropriate unit:
graphical.target certainly seems like the most generic solution that
would work for most cases.
Then, since we still don't want boinc-client started in *parallel*
- --since the AMD GPU drivers might not be usable by boinc yet-- but
rather *after* the graphical target is set up --I'm assuming a working
Xserver of some sort is available after graphical.target is finished,
or at least that boinc can find usable AMD GPU drivers at this point--
then we can specify an After= directive.
And if there isn't a graphical environment to speak of? I.e.,
someone's just crunching CPU units on a headless box? Then boinc
should still start without needing the graphical.target, since with
the Wants= directive:
"if the listed units fail to start or cannot be added to the
transaction, this has no impact on the validity of the transaction as
Theoretically, if someone is crunching GPU units on a "headless" box,
AND has an AMD GPU, then presumably, something akin to a
graphical.target might still exist? Not entirely sure on this
honestly. In any case, as per the systemd documentation, if
graphical.target isn't available, then our unit file would continue
behaving like it has previously so, no change in that respect.
TL;DR: I suspect that adding these lines under the [Unit] section to
the boinc-client.service unit file should ensure that boinc-client is
started at the Right Time^(TM):
This would give us a new .service file:
Description=Berkeley Open Infrastructure Network Computing Client
ExecStartPre=/usr/bin/touch /var/log/boinc.log /var/log/boincerr.log
ExecStartPre=/bin/chown boinc:boinc /var/log/boinc.log
ExecStart=/usr/bin/boinc --dir /var/lib/boinc-client
ExecStopPost=/bin/rm -f /var/lib/boinc-client/lockfile
I don't have an AMD GPU to test though. Perhaps you could modify your
/lib/systemd/system/boinc-client.service file to look like above? (Or
at least have the additional Wants= and After= directives).
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
More information about the pkg-boinc-devel