From 233f3ee21df4feed91b1f5efca6d91e90b809d57 Mon Sep 17 00:00:00 2001 From: Archipelago Date: Tue, 17 Nov 2026 09:52:53 +0000 Subject: [PATCH] Add KVM and shared Toolbx defaults; enforce Plymouth alpha --- adapters/build-iso.sh | 14 ++++++++++- adapters/container-runner-finalize.sh | 7 ++++++ adapters/container-runner-layer.sh | 3 +++ adapters/container-runner-package.sh | 12 +++++++++ adapters/gnome-package.sh | 3 +++ adapters/kde-package.sh | 3 +++ src/lib.rs | 36 +++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 1 deletion(-) diff --git a/adapters/build-iso.sh b/adapters/build-iso.sh index b5c06f0..90145b9 100644 --- a/adapters/build-iso.sh +++ b/adapters/build-iso.sh @@ -165,10 +165,22 @@ sed -i '/\[options\]/a HookDir = /job/core/etc/pacman.d/hooks' /job/core-pacman. # Same-version local packages can have different per-run lab signatures. # Prefer this run's exact archive/signature pair over the shared upstream cache. sed -i '/\[options\]/a CacheDir = /job/private-package-cache\nCacheDir = /var/cache/pacman/pkg' /job/core-pacman.conf -pacstrap -C /job/core-pacman.conf -c -G -M /job/core base linux linux-firmware linux-firmware-amd linux-firmware-amdgpu linux-firmware-atheros linux-firmware-broadcom linux-firmware-cirrus linux-firmware-intel linux-firmware-liquidio linux-firmware-marvell linux-firmware-mediatek linux-firmware-mellanox linux-firmware-nfp linux-firmware-nvidia linux-firmware-other linux-firmware-qcom linux-firmware-qlogic linux-firmware-radeon linux-firmware-realtek linux-firmware-ti linux-firmware-whence x11-ssh-askpass usb_modeswitch archipelago kmscon terminus-font 2>&1 | tee /job/evidence/core-transaction.log +pacstrap -C /job/core-pacman.conf -c -G -M /job/core base linux linux-firmware linux-firmware-amd linux-firmware-amdgpu linux-firmware-atheros linux-firmware-broadcom linux-firmware-cirrus linux-firmware-intel linux-firmware-liquidio linux-firmware-marvell linux-firmware-mediatek linux-firmware-mellanox linux-firmware-nfp linux-firmware-nvidia linux-firmware-other linux-firmware-qcom linux-firmware-qlogic linux-firmware-radeon linux-firmware-realtek linux-firmware-ti linux-firmware-whence x11-ssh-askpass usb_modeswitch archipelago kmscon terminus-font podman toolbox 2>&1 | tee /job/evidence/core-transaction.log if grep -Ei 'error:|==> ERROR:' /job/evidence/core-transaction.log; then echo 'Required Core transaction action failed' >&2; exit 1 fi +# D-076/D-118: Core ships Toolbx and rootless Podman, so Core-only hosts, +# Container Runner and every Desktop Purpose can create an Arch Toolbx container. +# The default is the upstream Arch image, never Fedora; users keep their own +# ~/.config/containers/toolbox.conf overrides. Desktop finalizers install the same +# content from the Purpose payload. +mkdir -p /job/core/etc/containers/registries.conf.d +cat > /job/core/etc/containers/toolbox.conf <<'TOOLBOX' +@@TOOLBOX_CONFIG@@ +TOOLBOX +cat > /job/core/etc/containers/registries.conf.d/60-archipelago-toolbox.conf <<'TOOLBOX_REGISTRIES' +@@TOOLBOX_REGISTRIES@@ +TOOLBOX_REGISTRIES for db in /job/evidence/*.db; do cmp "$db" "/job/core/var/lib/pacman/sync/$(basename "$db")"; done sha256sum /var/cache/pacman/pkg/*.pkg.tar.zst > /job/evidence/package-archives.sha256 sha256sum /job/private-package-cache/*.pkg.tar.zst > /job/evidence/private-cache-archives.sha256 diff --git a/adapters/container-runner-finalize.sh b/adapters/container-runner-finalize.sh index 65c7d97..ee87bd5 100644 --- a/adapters/container-runner-finalize.sh +++ b/adapters/container-runner-finalize.sh @@ -4,6 +4,13 @@ systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@tty1 a # getty on tty1; the packaged getty@tty1 drop-in runs onboarding. kmscon needs # mesa, which this image does not carry, so it is not enabled here. systemctl --root=/job/core enable NetworkManager cockpit.socket getty@tty1 +# Cockpit Machines runs guests through libvirt-dbus -> libvirtd. The Purpose +# preset records the same intent; enabling here also covers images composed from +# an older Core without a preset run. +systemctl --root=/job/core enable libvirtd.service +test -x /job/core/usr/bin/qemu-system-x86_64 +test -f /job/core/usr/lib/systemd/system/libvirtd.service +test -f /job/core/usr/share/cockpit/machines/manifest.json systemctl --root=/job/core set-default multi-user.target mkdir -p /job/core/etc/cockpit /job/core/etc/NetworkManager/conf.d /job/core/etc/sudoers.d # Cockpit's stock self-signed certificate; never allow plaintext or unauthenticated use. diff --git a/adapters/container-runner-layer.sh b/adapters/container-runner-layer.sh index 7f2ab43..e4f2360 100644 --- a/adapters/container-runner-layer.sh +++ b/adapters/container-runner-layer.sh @@ -152,6 +152,9 @@ mv /job/finalize-pacman.conf /job/core/etc/pacman.conf arch-chroot /job/core /bin/bash -euxc 'k=$(basename /usr/lib/modules/*); depmod "$k"; mkinitcpio -c /usr/lib/archipelago/mkinitcpio-container-runner.conf -k "$k" -g "/usr/lib/modules/$k/initramfs.img"; ldconfig; systemd-hwdb update --usr' arch-chroot /job/core /bin/bash -euc 'k=$(basename /usr/lib/modules/*); lsinitcpio "/usr/lib/modules/$k/initramfs.img"' > /job/evidence/container-runner-initramfs-files.txt test -x /job/core/usr/bin/podman +test -x /job/core/usr/bin/toolbox +test -f /job/core/etc/containers/toolbox.conf +grep -q 'quay.io/toolbx/arch-toolbox:latest' /job/core/etc/containers/toolbox.conf test -f /job/core/usr/lib/systemd/system/cockpit.socket test -f /job/core/usr/lib/systemd/system/tailscaled.service # Inventory is a read-only local DB query: do not initialize repository trust or diff --git a/adapters/container-runner-package.sh b/adapters/container-runner-package.sh index 5665be2..ba63cf5 100644 --- a/adapters/container-runner-package.sh +++ b/adapters/container-runner-package.sh @@ -10,6 +10,7 @@ printf 'purpose/server/container-runner\n' > "$pkg/runtime/usr/lib/archipelago/p mkdir -p "$pkg/runtime/usr/lib/systemd/system-preset" "$pkg/runtime/usr/share/archipelago/container-runner" cat > "$pkg/runtime/usr/lib/systemd/system-preset/10-archipelago-container-runner.preset" <<'PRESET' enable cockpit.socket +enable libvirtd.service enable systemd-binfmt.service disable tailscaled.service disable firewalld.service @@ -23,6 +24,17 @@ Container Runner defaults - firewalld is installed but intentionally disabled and carries no rules. The operator decides which zones, services and ports to open. - qemu-user-static binfmt registrations are enabled for foreign-architecture images. +- Toolbx is installed with the same upstream Arch default as Desktop Purposes + (quay.io/toolbx/arch-toolbox:latest). Create a mutable development environment + with `toolbox create`; `toolbox enter` opens it. Users may override the image in + ~/.config/containers/toolbox.conf, and containers persist in the user's home. +- QEMU/KVM and libvirt are installed for Cockpit Machines: qemu-system-x86, + qemu-img, libvirt (+ libvirt-dbus), dnsmasq for the default NAT network, + edk2-ovmf for UEFI guests, swtpm for emulated TPM 2.0 and virt-install for + creating new machines from Cockpit. libvirtd.service is enabled. +- Hardware virtualisation must be available: check for /dev/kvm. Operators who + manage machines from Cockpit need membership in the kvm group + (usermod -aG kvm ); without it only root can start guests. - Container data is workload state in /var; OS updates and rollback do not remove it. EOF diff --git a/adapters/gnome-package.sh b/adapters/gnome-package.sh index c37f5ad..9b89917 100644 --- a/adapters/gnome-package.sh +++ b/adapters/gnome-package.sh @@ -17,6 +17,9 @@ cmp -s "$plymouth_source/watermark.png" "$plymouth_theme/watermark.png" && { echo 'Plymouth Arch Linux watermark was not replaced' >&2 exit 1 } +# PNG color type lives at byte 25 (IHDR); 6 is RGBA. A RGB watermark would show +# the converter's white background on the splash screen. +test "$(od -An -tu1 -j25 -N1 "$plymouth_theme/watermark.png" | tr -d ' ')" = 6 mkdir -p "$pkg/runtime/usr/lib/systemd/zram-generator.conf.d" printf '[zram0]\n' > "$pkg/runtime/usr/lib/systemd/zram-generator.conf.d/20-archipelago-desktop.conf" sed 's/Archipelago Core/Archipelago GNOME/g' "$pkg/runtime/usr/lib/archipelago/defaults/os-release" > "$pkg/runtime/usr/lib/archipelago/defaults/os-release-gnome" diff --git a/adapters/kde-package.sh b/adapters/kde-package.sh index a79923c..41d9be3 100644 --- a/adapters/kde-package.sh +++ b/adapters/kde-package.sh @@ -21,6 +21,9 @@ cmp -s "$plymouth_source/watermark.png" "$plymouth_theme/watermark.png" && { echo 'Plymouth Arch Linux watermark was not replaced' >&2 exit 1 } +# PNG color type lives at byte 25 (IHDR); 6 is RGBA. A RGB watermark would show +# the converter's white background on the splash screen. +test "$(od -An -tu1 -j25 -N1 "$plymouth_theme/watermark.png" | tr -d ' ')" = 6 mkdir -p "$pkg/runtime/usr/lib/systemd/zram-generator.conf.d" printf '[zram0]\n' > "$pkg/runtime/usr/lib/systemd/zram-generator.conf.d/20-archipelago-desktop.conf" sed 's/Archipelago Core/Archipelago KDE/g' "$pkg/runtime/usr/lib/archipelago/defaults/os-release" > "$pkg/runtime/usr/lib/archipelago/defaults/os-release-kde" diff --git a/src/lib.rs b/src/lib.rs index 2c8d825..0a5bca5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -60,6 +60,8 @@ fn render_iso(kde: bool, replacements: &str) -> String { .replace("@@IMAGE_SIZE@@", include_str!("../adapters/image-size.py")) .replace("@@UPDATE_PROFILE@@", include_str!("../defaults/update.json")) .replace("@@UPDATE_PUBLIC_KEY@@", include_str!("../../system/archipelago-stable.asc")) + .replace("@@TOOLBOX_CONFIG@@", include_str!("../../purposes/common/desktop/toolbox.conf")) + .replace("@@TOOLBOX_REGISTRIES@@", include_str!("../../purposes/common/desktop/toolbox-registries.conf")) .replace("@@FLATPAK_IMPORT@@", include_str!("../../installer/adapters/flatpak-import.sh")) .replace(if kde { "@@KDE_FINALIZE@@" } else { "@@GNOME_FINALIZE@@" }, finalizer) } @@ -117,6 +119,8 @@ pub fn build_container_runner_script() -> Result { .replace("@@IMAGE_SIZE@@", include_str!("../adapters/image-size.py")) .replace("@@UPDATE_PROFILE@@", include_str!("../defaults/update.json")) .replace("@@UPDATE_PUBLIC_KEY@@", include_str!("../../system/archipelago-stable.asc")) + .replace("@@TOOLBOX_CONFIG@@", include_str!("../../purposes/common/desktop/toolbox.conf")) + .replace("@@TOOLBOX_REGISTRIES@@", include_str!("../../purposes/common/desktop/toolbox-registries.conf")) .replace("@@FLATPAK_IMPORT@@", "# Container Runner does not import a Flatpak seed") .replace("# CONTAINER_RUNNER_PACKAGE_LIST", &packages)) } @@ -198,6 +202,36 @@ mod tests { } } + #[test] + fn core_and_container_runner_ship_the_shared_toolbx_default() { + let config = include_str!("../../purposes/common/desktop/toolbox.conf"); + assert!(config.contains("quay.io/toolbx/arch-toolbox:latest")); + for script in [build_iso_script(), build_container_runner_script().unwrap()] { + assert!(script.contains("quay.io/toolbx/arch-toolbox:latest")); + assert!(script.contains("/etc/containers/toolbox.conf")); + } + assert!(build_iso_script().contains("archipelago kmscon terminus-font podman toolbox")); + assert!(include_str!("../adapters/container-runner-layer.sh").contains("usr/bin/toolbox")); + assert!(include_str!("../../purposes/proposals/container-runner.yaml").contains("- name: toolbox\n")); + assert!(include_str!("../../core/layers/arch.yaml").contains("- name: toolbox\n")); + } + + #[test] + fn container_runner_ships_a_complete_kvm_stack_for_cockpit_machines() { + let manifest = include_str!("../../purposes/proposals/container-runner.yaml"); + for package in ["qemu-system-x86", "qemu-img", "libvirt", "libvirt-dbus", "dnsmasq", + "dmidecode", "edk2-ovmf", "swtpm", "virt-install", "cockpit-machines"] { + assert!(manifest.contains(&format!("- name: {package}\n")), "missing {package}"); + } + let script = include_str!("../adapters/container-runner-package.sh"); + assert!(script.contains("enable libvirtd.service")); + assert!(script.contains("/dev/kvm")); + let finalize = include_str!("../adapters/container-runner-finalize.sh"); + assert!(finalize.contains("enable libvirtd.service")); + assert!(finalize.contains("qemu-system-x86_64")); + assert!(finalize.contains("share/cockpit/machines/manifest.json")); + } + #[test] fn desktop_profiles_use_bgrt_without_arch_firmware_branding() { let theme = include_str!("../../system/integrations/plymouth/archipelago-bgrt.plymouth"); @@ -219,6 +253,8 @@ mod tests { } let arch_watermark = include_bytes!("../../system/integrations/plymouth/watermark.png"); assert!(arch_watermark.len() > 256); + // PNG IHDR color type: 6 = RGBA. Without alpha the splash shows a white box. + assert_eq!(arch_watermark[25], 6, "Plymouth watermark must be transparent"); let encoded = base64(b"Archipelago"); assert_eq!(encoded, "QXJjaGlwZWxhZ28="); }