Demi Marie Obenour writes: > Weston can find a card itself. If the card is not ready, it will exit, > but s6 will automatically restart it. > > Signed-off-by: Demi Marie Obenour I don't think this commit message really captures it. As long as the card is not hotplugged, it _will_ be ready, as far as I know, because it will become ready when DRM is loaded, before userspace starts. This makes it sound like Weston not finding a card and being restarted by s6 would be routine behaviour, whereas we'd actually not expect to ever see it, except in the very unusual case of somebody having no cards at boot and later hotplugging one. (Even then it's not ideal to need to restart in a loop, but that case can wait for COSMIC.) I suggest the following alternative, which also removes some other obsolete instances of the same pattern. From 71216f0aa36049cbd3c7b7562e6e7ff225a1c810 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 26 May 2026 16:05:21 +0200 Subject: [PATCH] Stop waiting for /dev/dri/card0 On the host, which does not run in a well-controlled VM environment, there might not be a card0 (sometimes you just get card1). This causes hangs. It hasn't been necessary to wait for non-hotplugged DRI devices to exist since the Nixpkgs kernel set CONFIG_DRM=y. (If there's no device at startup, s6 will just keep restarting the services until there is one, but that case should be pretty unusual.) Closes: https://matrix.to/#/!xSysqhzbOZImdvGpix:fairydust.space/$FXt0B6ZcIn1KO1k-sis5WrESsePTmi1hfg4ZXiVXwTM?via=fairydust.space&via=matrix.org&via=dataaturservice.se Link: https://matrix.to/#/!xSysqhzbOZImdvGpix:fairydust.space/$Gvq6jxvt5d5qngIqs0xssBmONLH-q66g-HG_9E7TOWw?via=fairydust.space&via=matrix.org&via=dataaturservice.se Reported-by: Yureka Lilian Closes: https://inbox.spectrum-os.org/spectrum-devel/6ba1fc13-c905-4074-a878-bb2488ef2020@gmail.com Link: https://inbox.spectrum-os.org/spectrum-devel/20260524-weston-card-fix-v1-1-9c6dad59c245@gmail.com Signed-off-by: Alyssa Ross --- host/rootfs/image/etc/s6-rc/weston/run | 1 - img/app/image/etc/mdev.conf | 2 +- img/app/image/etc/s6-rc/wayland-proxy-virtwl/run | 2 -- release/checks/wayland/default.nix | 8 ++------ 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/host/rootfs/image/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run index fd59586c..68eff51a 100644 --- a/host/rootfs/image/etc/s6-rc/weston/run +++ b/host/rootfs/image/etc/s6-rc/weston/run @@ -40,7 +40,6 @@ redirfd -r 0 /dev/tty1 importas -i home HOME cd $home -if { udevadm wait /dev/dri/card0 } s6-setuidgid wayland bwrap # no --unshare-net, breaks udev hotplug diff --git a/img/app/image/etc/mdev.conf b/img/app/image/etc/mdev.conf index 33a07d6b..40c2149d 100644 --- a/img/app/image/etc/mdev.conf +++ b/img/app/image/etc/mdev.conf @@ -4,7 +4,7 @@ -$MODALIAS=.* 0:0 0 ! +importas -Siu MODALIAS modprobe -q $MODALIAS $INTERFACE=.* 0:0 0 ! +/etc/mdev/iface $MODALIAS=virtio:d0000001Av.* 0:0 0 ! +/etc/mdev/virtiofs -dri/card0 user:user 660 +background { /etc/mdev/listen card0 } +dri/card0 user:user 660 -SUBSYSTEM=sound;.* pipewire:pipewire 660 snd/controlC0 pipewire:pipewire 660 +background { /etc/mdev/listen controlC0 } diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run index 3fe113fe..bcd4c0fc 100755 --- a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run +++ b/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run @@ -20,8 +20,6 @@ redirfd -r 0 /dev/null if { fdmove 1 5 echo } fdclose 5 -if { /etc/mdev/wait card0 } - export LISTEN_FDS 2 export LISTEN_FDNAMES wayland:x11 getpid LISTEN_PID diff --git a/release/checks/wayland/default.nix b/release/checks/wayland/default.nix index 40f96199..a36f5b91 100644 --- a/release/checks/wayland/default.nix +++ b/release/checks/wayland/default.nix @@ -16,10 +16,6 @@ testers.nixosTest ({ lib, pkgs, ... }: { nodes.machine = { ... }: { hardware.graphics.enable = true; - services.udev.extraRules = '' - KERNEL=="card0", TAG+="systemd" - ''; - systemd.mounts = [ { name = "shared-config.mount"; @@ -63,8 +59,8 @@ testers.nixosTest ({ lib, pkgs, ... }: { }; systemd.services.weston = { - after = [ "dev-dri-card0.device" "surface-notify-socket.service" ]; - wants = [ "dev-dri-card0.device" "surface-notify-socket.service" ]; + after = [ "surface-notify-socket.service" ]; + wants = [ "surface-notify-socket.service" ]; environment.XDG_RUNTIME_DIR = "/run"; environment.WAYLAND_DEBUG = "server"; serviceConfig.ExecStart = "${lib.getExe pkgs.westonLite} --modules ${surface-notify}/lib/weston/surface-notify.so,systemd-notify.so"; -- 2.53.0