[systemd-devel] Ordering after udev applied rules to `/dev/dri/card0`

Paul Menzel pmenzel+systemd-devel at molgen.mpg.de
Wed Apr 1 12:23:49 UTC 2020


Dear Andrei, dear Lennart,


Thank you very much for your answers.

Am 31.03.20 um 17:09 schrieb Lennart Poettering:
> On Do, 19.03.20 20:24, Andrei Borzenkov (arvidjaar at gmail.com) wrote:
> 
>> 19.03.2020 19:47, Paul Menzel пишет:

>>> I am using Debian Sid/unstable with systemd 245.2 and Weston 8.0.0.
>>>
>>> I amtrying to start a graphical desktop as soon as possible. Currently,
>>> I use Weston, but unfortunately accessing `/dev/dri/card0` it gets a
>>> permission denied error. The Weston service unit is ordered after
>>> `systemd-logind.service`.
>>>
>>> Weston now fails to start, because it gets a permission denied error
>>> accessing `/dev/dri/card0` [1][2].
>>>
>>>      drmModeSetCrtc(backend->drm.fd, output->crtc_id,
>>> scanout_state->fb->fb_id, 0, 0, connectors, n_conn, &mode->mode_info);
>>>
>>> Right before Weston starts, the permission and ownership are like below.
>>>
>>>      $ ls -l /dev/dri:
>>>      insgesamt 0
>>>      crw------- 1 root root 226,   0 Mär 19 17:29 card0
>>>      crw------- 1 root root 226, 128 Mär 19 17:29 renderD128
>>>
>>> After udev applied the rules, it looks like below, meaning users in
>>> group `video` are allowed to access the device.
>>>
>>>      $ ls -l /dev/dri
>>>      insgesamt 0
>>>      drwxr-xr-x  2 root root         80 Mär 19 17:29 by-path
>>>      crw-rw----+ 1 root video  226,   0 Mär 19 17:29 card0
>>>      crw-rw----+ 1 root render 226, 128 Mär 19 17:29 renderD128
>>>
>>> Is there a way to order a service in such a way, that it’s guaranteed
>>> that udev rules to devices were applied?
>>
>> After=device should work. udev announces device after all rules have
>> been processed.
> 
> After= only orders, but this doesn't pull the device unit into the job
> queue. To do that, you need to add Wants= on the device unit as well.

Trying this,

     After=dev-dri-card0.device
     Wants=dev-dri-card0.device

the service times out waiting for the device.

     $ journalctl -a
     […]
     Apr 01 14:15:42.672430 kodi systemd[1]: Reached target Multi-User 
System.
     […]
     Apr 01 14:17:09.805001 kodi systemd[1]: dev-dri-card0.device: Job 
dev-dri-card0.device/start timed out.
     Apr 01 14:17:09.805839 kodi systemd[1]: Timed out waiting for 
device /dev/dri/card0.
     Apr 01 14:17:09.806464 kodi systemd[1]: dev-dri-card0.device: Job 
dev-dri-card0.device/start failed with result 'timeout'.
     Apr 01 14:17:09.809847 kodi systemd[1]: Starting Weston, a Wayland 
compositor, as a system service...
     […]
     $ ls -l /dev/dri/card0
     crw-rw---- 1 root video 226, 0 Apr  1 14:15 /dev/dri/card0


Kind regards,

Paul


More information about the systemd-devel mailing list