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

Paul Menzel pmenzel+systemd-devel at molgen.mpg.de
Thu Mar 19 16:47:30 UTC 2020


Dear systemd folks,


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?

A small script applying permissions and ownership manually in 
`ExecStartPre=` seems to work around the (graphics) issue.

If it cannot be solved with ordering, what would you suggest?

[1]: https://gitlab.freedesktop.org/wayland/weston/issues/382
[2]: 
https://gitlab.freedesktop.org/wayland/weston/-/blob/master/libweston/backend-drm/kms.c#L741


More information about the systemd-devel mailing list