From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id A01AB31E8; Tue, 28 Oct 2025 16:02:30 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id A903531BE; Tue, 28 Oct 2025 16:02:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149]) by atuin.qyliss.net (Postfix) with ESMTPS id 6EB7C31BC for ; Tue, 28 Oct 2025 16:02:27 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 92872EC0313; Tue, 28 Oct 2025 12:02:26 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 28 Oct 2025 12:02:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1761667346; x=1761753746; bh=x2YrNocmDm U8fS9MPAdVaWzPzQAwu937YP9K4nVjvoE=; b=aIzW0URWMMxB+4F8uJaSgkK1dX R3OUV61VwKJwT07ksX2AcfHsr1xsrKYwwSSaSes5g+54waMAHQzbpSVvZMq1sMFA D8+FeBrcL0VJD9h82xzDwEQzNV3fLuQyUzqnZACRq+6+obmX/upVgAqcmtTg8Z+5 9qSuDrXX+A7F1JXxhz9CeUyl1eTqEWUWKuNjlPoKggixkws7OJyossV/Dw8o0x5n uqojPezLZZhgGi6j+tAzxrt2yMYrAPmeaE1/U86N2Y/dSQpDQrAsJszy7SKVc8OH WD/ziuXaZY0kjqhRSQaM36W3FpeMq0Oi3zRNlTpWqJQ84HGE8OB0z43Yt0YA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1761667346; x=1761753746; bh=x2YrNocmDmU8fS9MPAdVaWzPzQAwu937YP9 K4nVjvoE=; b=jR1i5HoDQ61pm6wUjhc/7FB0C7+grVIbCzdV8mGqKGjINfW95IQ a3cHooM/cXsdFih6CRSsWoclHvoZKfZ0PLn1qDckcm9ZQlX7LYU5Yh9Z4mIeB3E3 /iDCPYtUD5ezudSc84x+MuRJFXmhpzhml2PiSjW/pGGHTCuhxONrfvB+auR2tdjq KOZdCOair3JbfHx8isNQVzaeCgav8C0HA8EmYVuijYivzUIXakuveoH+af0Q57bF lKCn1ONbu+LNI2YYm/oFTg0R8HKjeDLLMscYahvZnQJpYH+/dWEjoa8MCACDZ9td IP+587ZA7DhFW3pfOHZ8mKfaG+SsEaYX69Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduieduvdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtsehgtderredttddtnecuhfhrohhmpeetlhihshhsrgcu tfhoshhsuceohhhisegrlhihshhsrgdrihhsqeenucggtffrrghtthgvrhhnpeeiudffue eilefgtefgtddttdekkeehkefgheekudefveetgeefiefftedvteeuveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhihesrghlhihsshgrrd hishdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep uggvmhhiohgsvghnohhurhesghhmrghilhdrtghomhdprhgtphhtthhopeguvghvvghlse hsphgvtghtrhhumhdqohhsrdhorhhg X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Oct 2025 12:02:25 -0400 (EDT) Received: by fw12.qyliss.net (Postfix, from userid 1000) id B50364FA7DC; Tue, 28 Oct 2025 17:02:14 +0100 (CET) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH v4 2/2] host/rootfs: Switch to systemd-udevd In-Reply-To: <20251003-udev-v4-2-7d7344b14d11@gmail.com> References: <20251003-udev-v4-0-7d7344b14d11@gmail.com> <20251003-udev-v4-2-7d7344b14d11@gmail.com> Date: Tue, 28 Oct 2025 17:02:13 +0100 Message-ID: <87jz0f3th6.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: ICEAJY32GB3KX2WF7BDQF7YP76YNBBOV X-Message-ID-Hash: ICEAJY32GB3KX2WF7BDQF7YP76YNBBOV X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > This replaces the mdevd uevent daemon with systemd-udevd, which supports > much more hardware and is therefore to be preferred for a full desktop > environment. Various Wayland compositors integrate with systemd-udevd, > allowing them to discover devices as they appear rather than having to > only use devices plugged in when the compositor is started. > Additionally, systemd-udevd has quirks for various devices that are > needed to support the wide variety of hardware end-users have. > > The dependency on /dev/dri/card0 being present is eliminated, and > whatever devices the user has are now picked up by the compositor. New > dependencies are added to ensure that udev coldplug has finished before > any non-trivial services are started. systemd-udev-trigger.service runs > 'udevadm trigger' and has Before=3Dsysinit.target, so anything that is not > an early boot service can assume 'udevadm trigger' has run. > > systemd-udevd unsets PATH before it runs programs. Therefore, manually > set it to /usr/bin before invoking any scripts. > > systemd-udevd provides the 'udevadm wait' command to wait for a device > to appear and be processed. This replaces all uses of /etc/mdev/wait, > so this script is removed. /etc/mdev/listen and /run/wait only existed > to wake up /etc/mdev/wait, so they are also removed. > > The command-line options to 'udevadm trigger' are taken from > systemd-udev-trigger.service on my Arch machine. Using the wrong > arguments leads to problems that take a very long time to debug. > > Signed-off-by: Demi Marie Obenour > --- > LICENSES/LGPL-2.1-or-later.txt | 502 +++++++++++++++= ++++++ > host/rootfs/Makefile | 2 +- > host/rootfs/default.nix | 118 ++--- > host/rootfs/file-list.mk | 33 +- > host/rootfs/image/etc/mdev.conf | 7 - > host/rootfs/image/etc/mdev/listen | 11 - > host/rootfs/image/etc/mdev/wait | 14 - > host/rootfs/image/etc/s6-rc/card0/type.license | 2 - > host/rootfs/image/etc/s6-rc/card0/up | 4 - > host/rootfs/image/etc/s6-rc/kvm/timeout-up | 1 - > host/rootfs/image/etc/s6-rc/kvm/timeout-up.license | 2 - > host/rootfs/image/etc/s6-rc/kvm/type | 1 - > host/rootfs/image/etc/s6-rc/kvm/type.license | 2 - > host/rootfs/image/etc/s6-rc/kvm/up | 4 - > host/rootfs/image/etc/s6-rc/mdevd-coldplug/type | 1 - > host/rootfs/image/etc/s6-rc/mdevd-coldplug/up | 4 - > .../image/etc/s6-rc/mdevd/notification-fd.license | 2 - > host/rootfs/image/etc/s6-rc/mdevd/run | 5 - > .../contents.d/systemd-udevd-coldplug} | 0 > .../dependencies.d/systemd-udevd} | 0 > .../s6-rc/{card0 =3D> systemd-udevd-coldplug}/type | 0 > .../type.license | 0 > .../image/etc/s6-rc/systemd-udevd-coldplug/up | 6 + > .../s6-rc/{mdevd =3D> systemd-udevd}/notification-fd | 0 > .../s6-rc/systemd-udevd/notification-fd.license | 2 + > host/rootfs/image/etc/s6-rc/systemd-udevd/run | 15 + > .../image/etc/s6-rc/{mdevd =3D> systemd-udevd}/type | 0 > .../s6-rc/{mdevd =3D> systemd-udevd}/type.license | 0 > .../contents.d/systemd-udevd-coldplug} | 0 > .../contents.d/systemd-udevd-coldplug} | 0 > .../weston/dependencies.d/systemd-udevd-coldplug | 0 > host/rootfs/image/etc/s6-rc/weston/run | 7 +- > .../image/etc/udev/rules.d/99-spectrum.rules | 15 + > host/rootfs/image/usr/bin/run-vmm | 1 + > host/rootfs/image/usr/bin/systemd-udevd | 1 + > .../{etc/mdev/net/add =3D> usr/libexec/net-add} | 0 > 36 files changed, 604 insertions(+), 158 deletions(-) Also looking good, and again if you'd prefer I just make my suggested changes myself when I apply it that's fine by me. > diff --git a/host/rootfs/image/etc/s6-rc/systemd-udevd-coldplug/up b/host= /rootfs/image/etc/s6-rc/systemd-udevd-coldplug/up > new file mode 100644 > index 0000000000000000000000000000000000000000..f4bfe58d1219218ba486050e4= de0f949df8f2058 > --- /dev/null > +++ b/host/rootfs/image/etc/s6-rc/systemd-udevd-coldplug/up > @@ -0,0 +1,6 @@ > +# SPDX-License-Identifier: LGPL-2.1-or-later > +# SPDX-FileCopyrightText: systemd is free software; you can redistribute= it and/or modify it > +# under the terms of the GNU Lesser General Publ= ic License as published by > +# the Free Software Foundation; either version 2= .1 of the License, or > +# (at your option) any later version. This is a statement of the license and is covered by the SPDX-License-Identifier metadata. SPDX-FileCopyrightText is for identifying copyright owners. For a project that doesn't provide a copyright notice, we'd typically attribute copyright to e.g. "The systemd Authors". In this case though, I don't think there's anything copyrightable here, so CC0-1.0 and your name should be fine. > +udevadm trigger --type=3Dall --action=3Dadd --prioritized-subsystem=3Dmo= dule,block,tpmrm,net,tty,input > diff --git a/host/rootfs/image/etc/s6-rc/systemd-udevd/run b/host/rootfs/= image/etc/s6-rc/systemd-udevd/run > new file mode 100644 > index 0000000000000000000000000000000000000000..98d1aa83153c99f32afb4d27a= 97cf39fcadb2968 > --- /dev/null > +++ b/host/rootfs/image/etc/s6-rc/systemd-udevd/run > @@ -0,0 +1,15 @@ > +#!/bin/execlineb -P > +# SPDX-License-Identifier: EUPL-1.2+ > +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour > +s6-setlock /run/sd-notify-wrapper/systemd-udevd.lock > +# Save stdin to restore it later. > +fdmove -c 4 0 stdin will always be /dev/null, so instead of this dance you can just redirfd -r 0 /dev/null after the background. > +s6-ipcserver-socketbinder -b0 -m -a 0600 /run/sd-notify-wrapper/systemd-= udevd.sock > +background { > + fdmove 1 3 > + sd-notify-adapter > +} > +fdclose 3 > +fdmove 0 4 > +export NOTIFY_SOCKET /run/sd-notify-wrapper/systemd-udevd.sock > +systemd-udevd > diff --git a/host/rootfs/image/etc/s6-rc/weston/run b/host/rootfs/image/e= tc/s6-rc/weston/run > index 7dca0dab095569c9e7d49df9d245533a7265283e..8276e7eed45ab8155e21a3e11= f86c57c03d66cc4 100644 > --- a/host/rootfs/image/etc/s6-rc/weston/run > +++ b/host/rootfs/image/etc/s6-rc/weston/run > @@ -4,9 +4,9 @@ >=20=20 > unexport WAYLAND_DISPLAY >=20=20 > -foreground { > - umask 077 > - mkdir /run/user/0 > +if { > + umask 0022 > + mkdir -p -m 0700 /run/user/0 What's the point in continuing to umask when you explicitly provide the mod= e? > } > unexport ? >=20=20 > @@ -20,4 +20,5 @@ redirfd -r 0 /dev/tty1 >=20=20 > importas -i home HOME > cd $home > +if { udevadm wait /dev/dri/card0 } > weston > diff --git a/host/rootfs/image/etc/udev/rules.d/99-spectrum.rules b/host/= rootfs/image/etc/udev/rules.d/99-spectrum.rules > new file mode 100644 > index 0000000000000000000000000000000000000000..c65829419de3516d6ec8e95e7= 928a69c308507aa > --- /dev/null > +++ b/host/rootfs/image/etc/udev/rules.d/99-spectrum.rules > @@ -0,0 +1,15 @@ > +# SPDX-License-Identifier: EUPL-1.2+ > +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour > + > +# systemd-udevd unsets PATH, so fix that. Stray copy of comment. > +ACTION=3D=3D"remove", GOTO=3D"spectrum-end" > +ENV{PCI_CLASS}!=3D"2????", GOTO=3D"spectrum-end" > + > +# net-add unbinds and rebinds the driver, so avoid calling > +# it more than once. > +IMPORT{db}=3D"SPECTRUM_DRIVER_ASSIGNED" > +ENV{SPECTRUM_DRIVER_ASSIGNED}=3D=3D"yes", GOTO=3D"spectrum-end" > +# systemd-udevd unsets PATH, so fix that. > +RUN+=3D"/usr/bin/env PATH=3D/usr/bin /usr/libexec/net-add" > +ENV{SPECTRUM_DRIVER_ASSIGNED}=3D"yes" > +LABEL=3D"spectrum-end" Again, I'd much rather this was taken care of in net-add. I'll post a patch to make it re-entrant, I guess. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQQGoGac7QfI+H5ZtFCZddwkt31pFQUCaQDpBQAKCRCZddwkt31p FUFQAQCVldj0ON4DkpecnuuKg7EBgZQAtQ9ODYDqBLYt/rYNGgEAzINtzsb3kfTp TU1n+vyH79SVn+tu+pRIElWj+zspUA0= =xn8+ -----END PGP SIGNATURE----- --=-=-=--