Re: [PATCH 1/7] host/rootfs: Use full util-linux and systemd

Alyssa Ross
2025-10-29T11:36:56Z

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

Demi Marie Obenour <demiobenour@gmail.com> writes:

> Busybox provides a broken fdisk that doesn't support GPT, only MBR.
> The systemd built against musl doesn't include systemd-pull, so
> systemd-sysupdate doesn't work. Therefore, use all of util-linux's
> command-line tools, and use systemd built against glibc.

That's a problem that's going to need to be fixed. We're not mixing two
different libcs on the host.

> Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
> ---
> host/rootfs/default.nix | 43 ++++++++++++++++++-------------------------
> 1 file changed, 18 insertions(+), 25 deletions(-)

Okay idea overall. I like the idea of less busybox. Busybox →
util-linux should probably be a patch of its own.

> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
> index 0d79f7ca54ccc86eb0fa6e743f2011237d365f24..00052222507077b9e94a5ed0a3fbddd27caeefc3 100644
> --- a/host/rootfs/default.nix
> +++ b/host/rootfs/default.nix
> @@ -4,20 +4,20 @@
>
> import ../../lib/call-package.nix (
> { callSpectrumPackage, spectrum-build-tools, src
> -, pkgsMusl, pkgsStatic, linux_latest
> +, pkgsMusl, pkgsStatic, linux_latest, systemd
> }:
> pkgsStatic.callPackage (
>
> { busybox, cloud-hypervisor, cryptsetup, dbus, erofs-utils, execline
> , inkscape, inotify-tools, iproute2, jq, lib, mdevd, nixos
> , runCommand, s6, s6-linux-init, s6-rc, socat, spectrum-host-tools
> -, stdenvNoCC, util-linuxMinimal, virtiofsd, writeClosure
> +, stdenvNoCC, util-linux, virtiofsd, writeClosure

util-linuxMinimal = util-linux.override {
cryptsetupSupport = false;
nlsSupport = false;
ncursesSupport = false;
pamSupport = false;
shadowSupport = false;
systemdSupport = false;
translateManpages = false;
};

So how come we need the non-minimal version?

> # Weston doesn't support SVG icons.
> inkscape -w 20 -h 20 \
> -o $out/usr/share/icons/hicolor/20x20/apps/com.system76.CosmicFiles.png \
> ${cosmic-files}/share/icons/hicolor/24x24/apps/com.system76.CosmicFiles.svg
>
> - ln -st $out/usr/bin \
> - ${concatMapStringsSep " " (p: "${p}/bin/*") packages} \
> - ${xdg-desktop-portal}/libexec/xdg-document-portal \
> - ${xdg-desktop-portal-gtk}/libexec/xdg-desktop-portal-gtk
> + ln -sft "$out/usr/bin" \
> + ${concatMapStringsSep " " (p: "${escapeShellArg p}/bin/*") packages} \
> + ${escapeShellArg xdg-desktop-portal}/libexec/xdg-document-portal \
> + ${escapeShellArg xdg-desktop-portal-gtk}/libexec/xdg-desktop-portal-gtk
> ln -st $out/usr/share/dbus-1 \
> - ${dbus}/share/dbus-1/session.conf
> + ${escapeShellArg dbus}/share/dbus-1/session.conf
> ln -st $out/usr/share/dbus-1/services \
> - ${xdg-desktop-portal-gtk}/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service
> -
> - for pkg in ${escapeShellArgs usrPackages}; do
> - lndir -ignorelinks -silent "$pkg" "$out/usr"
> - done
> + ${escapeShellArg xdg-desktop-portal-gtk}/share/dbus-1/services/org.freedesktop.impl.portal.desktop.gtk.service

Unrelated changes. We don't need to escape Nix store paths, because we
rely on Nixpkgs, which would break if store paths had weird characters
in them.

> + # clobber any conflicting files from busybox
> + ln -sft "$out/usr/bin" ${escapeShellArg util-linux}/bin/*

The approach we've taken so far is to disable those tools in Busybox,
and avoid conflicting symlinks, and I like that better. Alternatively,
if you want to figure out which Busybox tools are actually needed, we
could switch to a minimal build and enable only what we use.

>
> ${concatStrings (mapAttrsToList (name: path: ''
> ln -s ${path} $out/usr/lib/spectrum/vm/${name}
> '') appvms)}
> -
> - # TODO: this is a hack and we should just build the util-linux
> - # programs we want.
> - # https://lore.kernel.org/util-linux/87zgrl6ufb.fsf@alyssa.is/
> - ln -s ${util-linuxMinimal}/bin/{findfs,uuidgen,lsblk,mount} $out/usr/bin
> -
> - # TODO: this is another hack and it should be possible
> - # to build systemd without this.
> - ln -s -- ${lib.escapeShellArg systemd}/bin/udevadm "$out/usr/bin"
> '';
> in
>
>
> --
> 2.51.2

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