From 96e4bd7ebb54b93ad5ec68feab4eda94b3073927 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 25 Nov 2026 15:37:25 +0000 Subject: [PATCH] guest: preinstall dbus-daemon in the Debian image, for session buses (dbus-run-session; nothing starts at boot): 0.5 MiB more erofs, the same 4 MiB boot prefetch; the image leaves out D-Bus's random machine id, which kw-init makes once per machine, a second after the console starts (during the boot it delays the prompt by 15 ms) --- .agents/kernel/guest.md | 4 +++- guest/distro/debian/build.sh | 13 ++++++++----- guest/distro/debian/rootfs/usr/local/sbin/kw-init | 7 +++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.agents/kernel/guest.md b/.agents/kernel/guest.md index 7f1dbcf..51c7a02 100644 --- a/.agents/kernel/guest.md +++ b/.agents/kernel/guest.md @@ -379,7 +379,9 @@ layer: boot to a prompt 0.25 s (Alpine) and 0.32 s (Debian) from image only; the page's boot (`kw.wayland=1`) reads it, and the build's traced boots boot as the page does (`KW_TRACE_BOOT` in `guest/lib/image.sh`), so it is in the boot set. - `DEBIAN_PACKAGES` in build.sh (curl, ca-certificates, unzip) are + `DEBIAN_PACKAGES` in build.sh (curl, ca-certificates, unzip, dbus-daemon + for session buses, which starts nothing at boot: kw-init makes its + machine id, which the image leaves out, once per machine) are installed at build time by the image's apt in the same build VM, from .debs the host fetches from snapshot.debian.org (checked against the baked lists); the install's changes to the overlay's upper layer are diff --git a/guest/distro/debian/build.sh b/guest/distro/debian/build.sh index adc2b46..f6399cf 100755 --- a/guest/distro/debian/build.sh +++ b/guest/distro/debian/build.sh @@ -27,7 +27,7 @@ # by the image's apt at build time (needs the # base bundle and node; else left out) # curl, wget, ca-certificates, unzip, procps, less, vim-tiny, xz-utils, zstd, -# iproute2, htop, tmux, sudo, libatomic1, sysv-rc installed +# iproute2, htop, tmux, sudo, libatomic1, sysv-rc, dbus-daemon installed # (DEBIAN_PACKAGES, below; needs the same) # /usr/lib/kw-commands "NAME PACKAGE" per command of main, for # kw-apt-install (command not found: @@ -222,7 +222,9 @@ chmod 755 "$stage/usr/lib/kw/wlandr" # libatomic1: the official Node.js build links it (the kw layer's node shim). # sysv-rc (with insserv and startpar): the service runner kw-init drives # (below, and rootfs/usr/local/sbin/kw-init). -DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils zstd iproute2 htop tmux sudo libatomic1 sysv-rc" +# dbus-daemon: session buses for desktop apps (dbus-run-session); nothing +# starts at boot (the system bus is the package dbus). +DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils zstd iproute2 htop tmux sudo libatomic1 sysv-rc dbus-daemon" # Both are made by the image's own programs: the tree as it is at that # point becomes a first image (erofs, uncompressed), which boots on the # distroless bundle (guest/tools/vm-run.ts); files come out over exec's @@ -244,8 +246,9 @@ DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils z # (maintainer scripts included: update-ca-certificates fills # /etc/ssl/certs, update-alternatives /etc/alternatives). What the install # created or changed in the root overlay's upper layer (ctime after a -# stamp; not /var/log, ldconfig's aux-cache with its inode numbers, apt's -# caches or the .debs) comes out as a tar and goes into the tree, and what +# stamp; not /var/log, ldconfig's aux-cache with its inode numbers, D-Bus's +# random machine id (kw-init makes one per machine), apt's caches or the +# .debs) comes out as a tar and goes into the tree, and what # it deleted (whiteouts) is deleted there; mktree.py then gives the new # files root:root, their modes and the upstream epoch, so a rebuild is # identical. @@ -313,7 +316,7 @@ else cd $u find . -mindepth 1 -cnewer /tmp/kw-stamp -type c | sort > /tmp/kw-gone find . -mindepth 1 -cnewer /tmp/kw-stamp ! -type c ! -path './var/log/*' \\ - ! -path ./var/cache/ldconfig/aux-cache ! -path './var/cache/apt/*' ! -path './kw-debs*' | sort > /tmp/kw-list + ! -path ./var/cache/ldconfig/aux-cache ! -path ./var/lib/dbus/machine-id ! -path './var/cache/apt/*' ! -path './kw-debs*' | sort > /tmp/kw-list tar -cf /tmp/kw-pkgs.tar --no-recursion --numeric-owner -T /tmp/kw-list" || { echo "debian: installing $DEBIAN_PACKAGES in the image failed" >&2; exit 1; } rm -rf "$archives" diff --git a/guest/distro/debian/rootfs/usr/local/sbin/kw-init b/guest/distro/debian/rootfs/usr/local/sbin/kw-init index 2e905f6..e8e84c4 100755 --- a/guest/distro/debian/rootfs/usr/local/sbin/kw-init +++ b/guest/distro/debian/rootfs/usr/local/sbin/kw-init @@ -61,6 +61,13 @@ console() { setsid -c /usr/bin/kwbox tty login <>/dev/hvc0 >&0 2>&0 & role[$!]=c kwtty() { { /usr/lib/kw/net wait 2>/dev/null; exec /usr/bin/kwbox tty serve; } /var/lib/dbus/machine-id; }