patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Spectrum OS Development <devel@spectrum-os.org>
Cc: Demi Marie Obenour <demiobenour@gmail.com>, Alyssa Ross <hi@alyssa.is>
Subject: [PATCH v2 3/3] host/rootfs: Simplify s6-rc dependencies
Date: Wed, 24 Sep 2025 06:32:40 -0400	[thread overview]
Message-ID: <20250924-udev-v2-3-6089de521b3b@gmail.com> (raw)
In-Reply-To: <20250924-udev-v2-0-6089de521b3b@gmail.com>

This moves almost all of the s6-rc dependencies into named, commented
bundles.  This makes the system much easier to understand.

Most of the explanation is in the bundle files themselves.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
 host/rootfs/Makefile                                  |  8 ++++----
 host/rootfs/image/etc/s6-rc/basic/contents            | 18 ++++++++++++++++++
 host/rootfs/image/etc/s6-rc/{vmm-env => basic}/type   |  0
 .../image/etc/s6-rc/{vmm-env => basic}/type.license   |  0
 host/rootfs/image/etc/s6-rc/ok-all/contents           | 19 ++++++++++++++++---
 .../s6-rc/sys-vmms/dependencies.d/{vmm-env => vm-env} |  0
 host/rootfs/image/etc/s6-rc/systemd-udevd/run         |  9 ++++++---
 host/rootfs/image/etc/s6-rc/vm-env/contents           | 13 ++++++++++---
 host/rootfs/image/etc/s6-rc/vmm-env/contents          |  9 ---------
 .../dependencies.d/{systemd-udevd-coldplug => basic}  |  0
 10 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index db142f290a1efd3884d8c5a114b26fa0f42ef5f1..9a9e533ad2433bce137dd73e7e9d519c5afab303 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -127,6 +127,8 @@ build/empty:
 	mkdir -p $@
 
 S6_RC_FILES = \
+	image/etc/s6-rc/basic/contents \
+	image/etc/s6-rc/basic/type \
 	image/etc/s6-rc/core/type \
 	image/etc/s6-rc/core/up \
 	image/etc/s6-rc/kvm/timeout-up \
@@ -136,7 +138,7 @@ S6_RC_FILES = \
 	image/etc/s6-rc/ok-all/type \
 	image/etc/s6-rc/static-nodes/type \
 	image/etc/s6-rc/static-nodes/up \
-	image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env \
+	image/etc/s6-rc/sys-vmms/dependencies.d/vm-env \
 	image/etc/s6-rc/sys-vmms/type \
 	image/etc/s6-rc/sys-vmms/up \
 	image/etc/s6-rc/systemd-udevd-coldplug/dependencies.d/systemd-udevd \
@@ -148,9 +150,7 @@ S6_RC_FILES = \
 	image/etc/s6-rc/systemd-udevd/type \
 	image/etc/s6-rc/vm-env/contents \
 	image/etc/s6-rc/vm-env/type \
-	image/etc/s6-rc/vmm-env/contents \
-	image/etc/s6-rc/vmm-env/type \
-	image/etc/s6-rc/weston/dependencies.d/systemd-udevd-coldplug \
+	image/etc/s6-rc/weston/dependencies.d/basic \
 	image/etc/s6-rc/weston/notification-fd \
 	image/etc/s6-rc/weston/run \
 	image/etc/s6-rc/weston/type
diff --git a/host/rootfs/image/etc/s6-rc/basic/contents b/host/rootfs/image/etc/s6-rc/basic/contents
new file mode 100644
index 0000000000000000000000000000000000000000..54f58577ba9f125e7fc08dcdd69394e8a88ab622
--- /dev/null
+++ b/host/rootfs/image/etc/s6-rc/basic/contents
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: CC0-1.0
+# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+# This file contains all atomics and bundles needed for basic system
+# initialization.  Everything that is not meant to run in early boot
+# should depend on this.
+
+# This ensures that core files are written to the right place.
+core
+
+# This ensures that static nodes are created.
+static-nodes
+
+# systemd runs systemd-udev-trigger.service before sysinit.target.
+# Therefore, anything using libudev that isn't an early boot service
+# might expect udev coldplug to have finished.
+systemd-udevd-coldplug
diff --git a/host/rootfs/image/etc/s6-rc/vmm-env/type b/host/rootfs/image/etc/s6-rc/basic/type
similarity index 100%
rename from host/rootfs/image/etc/s6-rc/vmm-env/type
rename to host/rootfs/image/etc/s6-rc/basic/type
diff --git a/host/rootfs/image/etc/s6-rc/vmm-env/type.license b/host/rootfs/image/etc/s6-rc/basic/type.license
similarity index 100%
rename from host/rootfs/image/etc/s6-rc/vmm-env/type.license
rename to host/rootfs/image/etc/s6-rc/basic/type.license
diff --git a/host/rootfs/image/etc/s6-rc/ok-all/contents b/host/rootfs/image/etc/s6-rc/ok-all/contents
index c76a5af336c7f1c3f4b81bf1f6244a53e0399fe8..edef03d2b6eae4fb0b92ac828436cd4572ca7acc 100644
--- a/host/rootfs/image/etc/s6-rc/ok-all/contents
+++ b/host/rootfs/image/etc/s6-rc/ok-all/contents
@@ -1,6 +1,19 @@
 # SPDX-License-Identifier: CC0-1.0
 # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-#
-systemd-udevd-coldplug
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+# This file contains the services that need to be started even
+# if nothing else depends on them.  It should not include services
+# that are only needed by other services.  For instance, it would
+# not be appropriate for this file to reference systemd-udevd.
+# However, services should be included in this file whenever they
+# are directly needed by the user, even if they depend on another
+# service in this files.  For instance, sys-vmms depends on weston,
+# but it is still included.
+
+# VMMs that should be started at boot.  In the future
+# it might make sense to start them only as needed.
 sys-vmms
-vm-env
+
+# The Wayland compositor.
+weston
diff --git a/host/rootfs/image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env b/host/rootfs/image/etc/s6-rc/sys-vmms/dependencies.d/vm-env
similarity index 100%
rename from host/rootfs/image/etc/s6-rc/sys-vmms/dependencies.d/vmm-env
rename to host/rootfs/image/etc/s6-rc/sys-vmms/dependencies.d/vm-env
diff --git a/host/rootfs/image/etc/s6-rc/systemd-udevd/run b/host/rootfs/image/etc/s6-rc/systemd-udevd/run
index 2501680b69eb0060b651146dffb6b3a99640c6fb..f05804a6b3903a767f8e1400cf0153045dd3781f 100644
--- a/host/rootfs/image/etc/s6-rc/systemd-udevd/run
+++ b/host/rootfs/image/etc/s6-rc/systemd-udevd/run
@@ -1,11 +1,14 @@
 #!/bin/execlineb -P
 # SPDX-License-Identifier: EUPL-1.2+
 # SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
-if { rm -f /run/sd-notify-wrapper/systemd-udevd }
+if { mkdir -p /run/sd-notify-wrapper }
+s6-setlock -d 4 /run/sd-notify-wrapper/systemd-udevd.lock
+if { rm -f /run/sd-notify-wrapper/systemd-udevd.sock }
 background {
-   s6-ipcserver-socketbinder -b0 -m -a 0600 /run/sd-notify-wrapper/systemd-udevd
+   s6-ipcserver-socketbinder -b0 -m -a 0600 /run/sd-notify-wrapper/systemd-udevd.sock
    fdmove 1 3
    sd-notify-adapter
 }
-export NOTIFY_SOCKET /run/sd-notify-wrapper/systemd-udevd
+fdclose 3
+export NOTIFY_SOCKET /run/sd-notify-wrapper/systemd-udevd.sock
 exec -a systemd-udevd udevadm
diff --git a/host/rootfs/image/etc/s6-rc/vm-env/contents b/host/rootfs/image/etc/s6-rc/vm-env/contents
index ed8b5c410adfc17f5bbc33932ac79d97bd7b3115..81bfd422d22bde582fe198e0778c1c93d0d0f329 100644
--- a/host/rootfs/image/etc/s6-rc/vm-env/contents
+++ b/host/rootfs/image/etc/s6-rc/vm-env/contents
@@ -1,6 +1,13 @@
 # SPDX-License-Identifier: CC0-1.0
 # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-#
-static-nodes
-systemd-udevd-coldplug
+# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
+
+# This file contains s6 atomics and bundles that
+# need to be started before starting any VMs.
+
+# Basic initialization
+basic
+# KVM being available
+kvm
+# Wayland compositor ready
 weston
diff --git a/host/rootfs/image/etc/s6-rc/vmm-env/contents b/host/rootfs/image/etc/s6-rc/vmm-env/contents
deleted file mode 100644
index 9a1aea63abd1b5c374e3ac9a9671e4c9341f8d16..0000000000000000000000000000000000000000
--- a/host/rootfs/image/etc/s6-rc/vmm-env/contents
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: CC0-1.0
-# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
-#
-core
-kvm
-# systemd runs systemd-udev-trigger.service before sysinit.target.
-# Therefore, anything using libudev that isn't an early boot service
-# might expect udev coldplug to have finished.
-systemd-udevd-coldplug
diff --git a/host/rootfs/image/etc/s6-rc/weston/dependencies.d/systemd-udevd-coldplug b/host/rootfs/image/etc/s6-rc/weston/dependencies.d/basic
similarity index 100%
rename from host/rootfs/image/etc/s6-rc/weston/dependencies.d/systemd-udevd-coldplug
rename to host/rootfs/image/etc/s6-rc/weston/dependencies.d/basic

-- 
2.51.0


  parent reply	other threads:[~2025-09-24 10:34 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-14  3:16 [PATCH 0/3] Switch from mdevd to systemd-udevd in root filesystem Demi Marie Obenour
2025-09-14  3:16 ` [PATCH 1/3] host/rootfs: Add early serial output Demi Marie Obenour
2025-09-17 11:45   ` Alyssa Ross
2025-09-18  2:44     ` Demi Marie Obenour
2025-09-19 14:21   ` Alyssa Ross
2025-09-19 14:49   ` Alyssa Ross
2025-09-14  3:16 ` [PATCH 2/3] tools: Add adapter tool for services using sd_notify Demi Marie Obenour
2025-09-14  3:16 ` [PATCH 3/3] host/rootfs: switch to systemd-udevd Demi Marie Obenour
2025-09-19 14:12   ` Alyssa Ross
2025-09-19 19:32     ` Demi Marie Obenour
2025-09-21 12:18       ` Alyssa Ross
2025-09-21 17:02         ` Demi Marie Obenour
2025-09-21 16:27       ` Demi Marie Obenour
2025-09-21 16:28     ` Demi Marie Obenour
2025-09-23 18:39       ` Alyssa Ross
2025-09-23 19:18         ` Demi Marie Obenour
2025-09-24 10:32 ` [PATCH v2 0/3] Switch from mdevd to systemd-udevd in root filesystem Demi Marie Obenour
2025-09-24 10:32   ` [PATCH v2 1/3] tools: Add adapter tool for services using sd_notify Demi Marie Obenour
2025-09-25 10:29     ` Alyssa Ross
2025-09-25 16:54       ` Demi Marie Obenour
2025-09-24 10:32   ` [PATCH v2 2/3] host/rootfs: Switch to systemd-udevd Demi Marie Obenour
2025-09-25 10:53     ` Alyssa Ross
2025-09-25 17:53       ` Demi Marie Obenour
2025-09-26 14:56         ` Alyssa Ross
2025-09-28 22:51     ` [PATCH v3 0/2] Switch from mdevd to systemd-udevd in root filesystem Demi Marie Obenour
2025-09-28 22:51       ` [PATCH v3 1/2] tools: Add adapter tool for services using sd_notify Demi Marie Obenour
2025-10-01 16:06         ` Alyssa Ross
2025-09-28 22:51       ` [PATCH v3 2/2] host/rootfs: Switch to systemd-udevd Demi Marie Obenour
2025-10-01 14:24         ` Alyssa Ross
2025-10-01 14:39         ` Alyssa Ross
2025-10-01 17:40           ` Demi Marie Obenour
2025-10-02  9:53             ` Alyssa Ross
2025-10-02 10:34         ` Alyssa Ross
2025-10-02 10:36       ` [PATCH v3 0/2] Switch from mdevd to systemd-udevd in root filesystem Alyssa Ross
2025-10-03 21:42       ` [PATCH v4 " Demi Marie Obenour
2025-10-03 21:42         ` [PATCH v4 1/2] tools: Add adapter tool for services using sd_notify Demi Marie Obenour
2025-10-28 15:38           ` Alyssa Ross
2025-10-28 22:56             ` Demi Marie Obenour
2025-10-29 11:26           ` Alyssa Ross
2025-10-31  4:34             ` Demi Marie Obenour
2025-10-31  8:54               ` Alyssa Ross
2025-11-01 18:23                 ` Demi Marie Obenour
2025-10-03 21:42         ` [PATCH v4 2/2] host/rootfs: Switch to systemd-udevd Demi Marie Obenour
2025-10-28 16:02           ` Alyssa Ross
2025-10-28 22:56             ` Demi Marie Obenour
2025-10-29  9:31               ` Alyssa Ross
2025-10-29  9:55                 ` Demi Marie Obenour
2025-09-24 10:32   ` Demi Marie Obenour [this message]
2025-09-25 11:07     ` [PATCH v2 3/3] host/rootfs: Simplify s6-rc dependencies Alyssa Ross
2025-09-25 15:50       ` Demi Marie Obenour
2025-10-02 10:37         ` 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=20250924-udev-v2-3-6089de521b3b@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /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).