patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: Spectrum OS Development <devel@spectrum-os.org>,
	Yureka Lilian <yureka@cyberchaos.dev>
Subject: Re: [PATCH v2] host/rootfs: Don't wait for /dev/dri/card0
Date: Wed, 24 Jun 2026 10:55:38 +0200	[thread overview]
Message-ID: <87zf0k5ncl.fsf@alyssa.is> (raw)
In-Reply-To: <878q96tfyv.fsf@alyssa.is>

[-- Attachment #1: Type: text/plain, Size: 5547 bytes --]

Alyssa Ross <hi@alyssa.is> writes:

> Demi Marie Obenour <demiobenour@gmail.com> 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 <demiobenour@gmail.com>
>
> 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 <hi@alyssa.is>
> 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

Alas this is not true upon further investigation.  I saw
release/checks/wayland fail with this applied, because while DRM was
loaded pre-userspace, DRM_BOCHS still wasn't.  s6 would indeed just
restart Weston until it works, but I don't really want a restart loop to
be a routine thing…

> 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 <yureka@cyberchaos.dev>
> 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 <hi@alyssa.is>
> ---
>  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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2026-06-24  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 20:51 [PATCH] host/rootfs: Automatically select card node Demi Marie Obenour
2026-05-25 17:08 ` Alyssa Ross
2026-05-26  7:31 ` [PATCH v2] host/rootfs: Don't wait for /dev/dri/card0 Demi Marie Obenour
2026-05-26 14:15   ` Alyssa Ross
2026-06-24  8:55     ` Alyssa Ross [this message]
2026-06-25  1:07       ` Demi Marie Obenour
2026-06-25  9:56         ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zf0k5ncl.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=yureka@cyberchaos.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).