16 KiB
Okay, this is an excellent, detailed plan. It clearly outlines the shift to an installer-focused ISO and the integration of bootc via Calamares.
Let's refine this plan with even more nuance, addressing the atomic system requirements and the specific tools involved.
Detailed, Nuanced Plan: ParticleOS Atomic Installer ISO
Overall Goal: Create a minimal, bootable ISO that launches the Calamares installer. Calamares will then orchestrate the deployment of a pre-defined, immutable ParticleOS atomic image onto the target system using bootc.
Core Principles:
- Minimal Installer: The ISO environment itself will be lean, containing only what's necessary to run Calamares and
bootc. - Atomic Deployment: The core OS is treated as an atomic unit (an OCI image) deployed by
bootc, not built or modified on the fly during installation. - Security & Reproducibility: Leverage
mmdebstrapandbootcfor a secure and reproducible build.
Phase 1: Host-Side Script (build-iso-podman.sh) - Orchestration Layer
Role: This script remains the high-level orchestrator. It sets up the Podman build environment, copies the necessary build scripts and assets into the container, and initiates the containerized build.
Adjustments (Minimal):
check_prerequisites:- Forgejo Criticality: Reiterate that Forgejo must be accessible and contain
bootcandostree. The current critical checks for GPG key and package presence are correct and should remain. If these checks fail, the build must abort, asbootcis non-negotiable for the atomic system. - Calamares Repository Check (Optional but Recommended): If Calamares is sourced from a specific PPA/repository, add a similar check here to ensure its GPG key and packages are reachable. This prevents later failures inside the container.
- Forgejo Criticality: Reiterate that Forgejo must be accessible and contain
create_dockerfile: No changes needed. The Dockerfile's role is to provide the build tools for the container, not the OS components for the ISO.create_container_build_script: This function will now generate a significantly differentbuild-in-container.sh(detailed in Phase 3).run_container_build: No changes needed. It ensures the isolated container runs with necessary privileges and volume mounts.- Cleanup: Remains the same.
Phase 2: Container Base Image (Dockerfile) - Build Tool Environment
Role: This Dockerfile defines the environment inside the Podman container where build-in-container.sh will execute. It needs to provide all the tools required for mmdebstrap, ISO creation, and handling GPG keys.
Adjustments (Minor):
RUN apt install -y ...:- Ensure
curl,wget,ca-certificates,gnupg,gpgv,software-properties-commonare installed. These are essential for fetching GPG keys and packages from various repositories during themmdebstrapphase. - Keep
mmdebstrap,squashfs-tools,xorriso,grub-pc-bin,grub-efi-amd64-bin,isolinux,live-build. These are core ISO building tools. - No other changes are strictly necessary here, as this is the builder's environment, not the target OS.
- Ensure
Phase 3: Container Build Script (build-in-container.sh) - The Core Logic
Role: This script, run inside the Podman container, orchestrates the creation of the minimal Calamares installer chroot, configures it, and builds the final ISO.
Major Overhaul Required.
3.1. Initial Chroot Creation (mmdebstrap)
- Goal: Create a barebones chroot capable of booting into a graphical environment to run Calamares. This is not a full desktop.
mmdebstrapCommand Structure:mmdebstrap \ --architectures=amd64 \ --variant=minbase \ --include=systemd,systemd-sysv,dbus,curl,ca-certificates,gnupg,gpgv,locales,resolvconf,iproute2,net-tools,isc-dhcp-client,sudo,useradd,chpasswd,network-manager,plasma-nm,openssh-server,xserver-xorg-core,xinit,desktop-base,plymouth,sddm,calamares,calamares-settings-ubuntu,ostree,bootc,apt-ostree,firefox \ --mode=unshare \ --aptopt="Acquire::Check-Valid-Until \"false\"" \ --setup-hook="mkdir -p \"\$1/etc/apt/keyrings\"" \ --setup-hook="curl -fsSL https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/dists/noble/Release.gpg | gpg --dearmor -o \"\$1${MOZILLA_KEYRING}\"" \ --setup-hook="curl -fsSL https://git.raines.xyz/api/packages/robojerk/debian/gpg | gpg --dearmor -o \"\$1${FORGEJO_KEYRING}\"" \ # Add Calamares PPA/Repo key if needed (research required for Noble) # --setup-hook="curl -fsSL ${CALAMARES_PPA_RELEASE_GPG} | gpg --dearmor -o \"\$1${CALAMARES_KEYRING}\"" \ noble \ "$CHROOT_DIR" \ "deb [signed-by=${MOZILLA_KEYRING}] https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu noble main" \ "deb [signed-by=${FORGEJO_KEYRING}] https://git.raines.xyz/api/packages/robojerk/debian noble main" \ # "deb [signed-by=${CALAMARES_KEYRING}] ${CALAMARES_PPA_URL} noble main" # Add if Calamares has a PPA http://archive.ubuntu.com/ubuntu/ || print_error "mmdebstrap failed to create base system or add GPG keys."- Rationale for
--include:minbase: Provides a very minimal system.xserver-xorg-core,xinit,desktop-base: Minimal X server and basic desktop files needed for a graphical environment for Calamares.desktop-baseprovides themes/backgrounds.plymouth: For a nice boot splash.sddm: A display manager to launch Calamares.calamares,calamares-settings-ubuntu: The installer itself and its default configuration.ostree,bootc: Absolutely critical for the atomic deployment.apt-ostree: Likely needed for anyaptinteractions within the installer environment that might touchostreeconcepts (thoughbootcis the primary tool here).firefox: Useful for accessing documentation or reporting issues from the live installer environment.network-manager,plasma-nm: Essential for network connectivity in the installer, especially ifbootcneeds to pull an image from a registry.openssh-server: For remote debugging/access to the installer environment.
- GPG Key Handling: The
--setup-hookapproach is crucial for placing the GPG keys beforemmdebstrap's internalaptruns, preventing signature errors.
- Rationale for
3.2. Essential Chroot Configuration (Post-mmdebstrap)
- Goal: Ensure the chroot environment is fully functional for graphical display, networking, and security.
- Steps:
- Bind Mounts: Keep
mount --bind /dev,/run,/proc,/sys. (No change) /etc/resolv.confCopy: Keepcp /etc/resolv.conf "$CHROOT_DIR/etc/resolv.conf". (No change)- Device Node Permissions (
mknod): Keep themknodcommands for/dev/null,/dev/zero, etc. (No change) - APT Sources (Default Ubuntu): Keep the standard Ubuntu
sources.listentries. (No change) - APT Preferences (Forgejo for
ostree/bootc): Keep the99-forgejo-ostree-bootc.preffile creation. This ensuresaptwithin the installer environment prioritizes yourbootcandostreeversions. (No change) - Final
apt update:chroot "$CHROOT_DIR" apt update. This is to ensure all package lists are up-to-date after all repositories and preferences are set.
- Bind Mounts: Keep
3.3. Configure Calamares for Atomic Deployment
- Goal: Customize Calamares to perform a
bootc-driven installation. This is the most complex and critical part. - Calamares Configuration Files (
/etc/calamares/):- Calamares uses a modular YAML-based configuration. You'll need to create or modify several
.conffiles. - Branding: Create
/etc/calamares/branding/particleos/and placebranding.desc(for name/logo),slideshow.qml(if you want a custom slideshow), andsidebar.qml. settings.conf: This is the main sequence file.- Define the
sequenceof modules. - Disable/hide modules not relevant for an atomic install (e.g.,
packagesif you're not allowing user package selection). - Crucially, integrate a custom
bootcjob.
- Define the
partition.conf:- Calamares' default partition module might be sufficient for creating the basic
/boot,/boot/efi, and/partitions. - Nuance:
bootchas specific partitioning requirements (e.g.,xfsorext4for/, separate/bootand/boot/efi). Ensure Calamares' partition module is configured to create a compatible layout. - Alternatively, disable Calamares'
partitionmodule and handle partitioning entirely within a custombootcscript if more control is needed.
- Calamares' default partition module might be sufficient for creating the basic
users.conf: Configure user creation. Calamares can handle this, and you'll want to ensure it creates asudouser.- Custom
bootcJob (Critical): This is where the magic happens.- Create a custom Calamares module (e.g.,
atomic_install.conf) oftype: script. - This module will execute a shell script (e.g.,
/usr/local/bin/particleos-bootc-install.sh) that performs thebootcinstallation. particleos-bootc-install.sh(inside chroot):#!/bin/bash # This script is called by Calamares to perform the bootc installation. # Calamares passes parameters via environment variables or arguments. # Example: Calamares might set CALAMARES_TARGET_DEVICE=/dev/sda # # Forgejo has a oci image repo. See documentation here # https://forgejo.org/docs/latest/user/packages/container/ # # Existing images # https://git.raines.xyz/robojerk/-/packages/container/aurora-bootable/v1.0 # docker pull git.raines.xyz/robojerk/aurora-bootable:v1.0 # Digest: sha256:c3a52d917bf4ac32a5fdcd6de2c1165fbd3ba234fef82a1d35b8b56e2bb1103d # # https://git.raines.xyz/robojerk/-/packages/container/aurora-system/v1.0 # docker pull git.raines.xyz/robojerk/aurora-system:v1.0 # Digest: sha256:be75ad8f24e0b25d1d5f1d9fdd2b0bf2a5ed02a2e8646647a8e25ca83c5e6828 TARGET_DEVICE="${CALAMARES_TARGET_DEVICE}" # Or passed as $1 ATOMIC_IMAGE="registry.example.com/particleos:latest" # Your pre-built atomic OS image if [ -z "$TARGET_DEVICE" ]; then echo "Error: Target device not specified for bootc installation by Calamares." >&2 exit 1 fi echo "Starting bootc installation to $TARGET_DEVICE using image $ATOMIC_IMAGE" # Execute bootc install. This command needs to be precise for your atomic image. # It will: # 1. Pull the OCI image from the registry. # 2. Rebase the system onto that image (ostree operation). # 3. Configure bootloader (GRUB/systemd-boot) for the new atomic system. bootc install --target-device "$TARGET_DEVICE" "$ATOMIC_IMAGE" || { echo "CRITICAL ERROR: bootc installation failed! Check network, image, and target device." >&2 exit 1 } echo "bootc installation completed successfully." exit 0- Permissions: Ensure
/usr/local/bin/particleos-bootc-install.shis executable (chmod +x).
- Create a custom Calamares module (e.g.,
- Calamares uses a modular YAML-based configuration. You'll need to create or modify several
- Calamares Display Manager Integration:
- Configure
sddmto automatically start Calamares. This usually involves creating a custom X session file (.desktopfile) that launches Calamares, and then configuringsddmto use that session by default or auto-login a user that launches it. - Example: Create
/usr/share/xsessions/calamares.desktopand configuresddm.confto auto-loginrootor acalamaresuser and run that session.
- Configure
3.4. System Configuration (Installer Environment)
- Goal: Basic system setup for the installer environment itself.
- Steps:
hostname,hosts,localtime,locale-gen,update-locale. (Adjust hostname toparticleos-installerfor clarity).- User Creation: If Calamares handles user creation for the installed system, then the
useraddcommands for theparticleuser in the installer ISO might be simplified or removed, focusing only on a temporaryliveuser for the installer session if needed. - Service Enabling:
systemctl enable sddm NetworkManager ssh. apt-ostreeconfiguration:ref: particleos/installer/1.0.0(for the installer environment itself, not the target OS).
3.5. ISO Creation
- Goal: Package the configured installer environment into a bootable ISO.
- Steps:
- Kernel/Initrd: Copy the minimal kernel and initrd from the chroot. (No change)
- SquashFS: Create the
filesystem.squashfsfrom the chroot. This will now contain Calamares,bootc, and minimal system. (No change) - GRUB/ISOLINUX Configuration:
- Adjust
grub.cfgandisolinux.cfgto primarily offer an "Install ParticleOS" option. - The kernel boot parameters will need to include
live-installer/installer/language=en_US(or similar Calamares-specific options) to automatically launch Calamares. - Consider a "Boot to Shell" option for debugging.
- Adjust
- EFI Boot Image: Remains the same.
Phase 4: Atomic OS Image (Separate Build Process)
Role: This is the actual ParticleOS image that bootc will deploy. It's crucial that this image exists and is accessible from the installer environment.
Details:
- Technology: This image should be a
bootcOCI image. - Creation: It would be built using a separate
Containerfile(orDockerfile) that looks something like this:# Containerfile for ParticleOS Atomic Image FROM registry.fedoraproject.org/fedora-bootc:latest # Or a minimal Ubuntu base # FROM ubuntu:noble-base # If building from scratch with bootc-cli installed # Install core OS components for your atomic system # Example: RUN dnf install -y plasma-desktop firefox # Or apt install on Ubuntu base # RUN apt install -y kubuntu-desktop firefox # Example for Ubuntu base # Define your immutable system's configuration # (e.g., users, services, custom applications) # Set the default entrypoint for the installed system CMD ["/usr/lib/systemd/systemd"] - Registry: This image must be pushed to a publicly accessible or authenticated container registry (e.g.,
registry.example.com/particleos:latest). The Calamares installer will pull from this registry.
Implementation Considerations & Challenges
- Calamares Configuration Detail: The YAML files for Calamares are extensive. You'll need to study Calamares' documentation (especially for
settings.conf,partition.conf,users.conf, andscriptmodules) to tailor it precisely. bootcParameters: Thebootc installcommand has many options (--target-device,--target-image,--root-partition,--boot-partition,--boot-efi-partition,--kargs, etc.). Theparticleos-bootc-install.shscript needs to correctly map Calamares' chosen installation parameters tobootc's arguments.- Network Connectivity in Installer: Ensure the installer environment reliably gets network access (DHCP, DNS) so
bootccan pull the atomic image.NetworkManagerandplasma-nmare key here. - Error Reporting: Make sure the
particleos-bootc-install.shscript provides clear error messages that Calamares can display to the user if thebootcinstallation fails. - User Experience: Design the Calamares workflow to be intuitive for an atomic OS. For instance, the partitioning step might be simplified, or custom text added to explain the immutable nature.
- Testing Iterations: This will require multiple build-test cycles. Use QEMU to quickly test the ISO.
This detailed plan provides a solid roadmap for building your ParticleOS atomic installer ISO. The next step would be to start implementing the changes in build-in-container.sh, focusing on the mmdebstrap includes and the core Calamares/bootc integration.