From aa1f3b88ffd93c36fd6b19db80e52ab40bc298d2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 29 Nov 2025 22:08:59 +0000 Subject: [PATCH] Add systemd configuration to fix boot and match official archiso The ISO was failing with "Failed to start Switch Root" because we were missing critical systemd configuration that the official archiso releng profile includes. Added to airootfs/etc: - systemd/system/getty@tty1.service.d/autologin.conf (official format) - systemd/system/pacman-init.service (initializes pacman keyring) - systemd/system/multi-user.target.wants/ symlinks for: - NetworkManager.service - iwd.service - sshd.service - pacman-init.service - hostname (archiso) - locale.conf (en_US.UTF-8) The autologin.conf now uses the official archiso format with proper agetty options: -o '-p -f -- \\u' --noclear --autologin root Removed dynamic file creation from build scripts since these configs are now properly stored in the repository. --- .github/workflows/build-iso.yml | 35 ------------------ archiso/airootfs/etc/hostname | 1 + archiso/airootfs/etc/locale.conf | 1 + .../getty@tty1.service.d/autologin.conf | 3 ++ .../NetworkManager.service | 1 + .../multi-user.target.wants/iwd.service | 1 + .../pacman-init.service | 1 + .../multi-user.target.wants/sshd.service | 1 + .../etc/systemd/system/pacman-init.service | 13 +++++++ build-docker.sh | 24 ------------- build-iso.sh | 36 ------------------- 11 files changed, 22 insertions(+), 95 deletions(-) create mode 100644 archiso/airootfs/etc/hostname create mode 100644 archiso/airootfs/etc/locale.conf create mode 100644 archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf create mode 120000 archiso/airootfs/etc/systemd/system/multi-user.target.wants/NetworkManager.service create mode 120000 archiso/airootfs/etc/systemd/system/multi-user.target.wants/iwd.service create mode 120000 archiso/airootfs/etc/systemd/system/multi-user.target.wants/pacman-init.service create mode 120000 archiso/airootfs/etc/systemd/system/multi-user.target.wants/sshd.service create mode 100644 archiso/airootfs/etc/systemd/system/pacman-init.service diff --git a/.github/workflows/build-iso.yml b/.github/workflows/build-iso.yml index 2969809..0eb9a1e 100644 --- a/.github/workflows/build-iso.yml +++ b/.github/workflows/build-iso.yml @@ -108,41 +108,6 @@ jobs: # Copy target package list for installer cp archiso/target-packages.x86_64 archiso/airootfs/root/ - # Create auto-login service - mkdir -p archiso/airootfs/etc/systemd/system/getty@tty1.service.d - cat > archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF - [Service] - ExecStart= - ExecStart=-/sbin/agetty --autologin root --noclear %I \$TERM - EOF - - # Create installer launch script - cat > archiso/airootfs/root/.bash_profile << 'EOF' - #!/bin/bash - - # Auto-start installer on login - if [[ -z \$DISPLAY ]] && [[ \$(tty) = /dev/tty1 ]]; then - clear - echo "Welcome to Hyprland Minimal Installer" - echo "" - echo "Type 'installer' to start the installation process" - echo "Type 'help' for more options" - echo "" - fi - - alias installer='/usr/local/bin/installer.sh' - alias help='echo "Available commands: - installer - Start the installation process - iwctl - Configure WiFi manually - nmtui - Network configuration UI - fdisk -l - List available disks - lsblk - Show block devices - reboot - Restart the system - poweroff - Shutdown the system"' - - source ~/.bashrc - EOF - # Set correct permissions chmod +x archiso/airootfs/usr/local/bin/installer.sh chmod +x archiso/profiledef.sh diff --git a/archiso/airootfs/etc/hostname b/archiso/airootfs/etc/hostname new file mode 100644 index 0000000..2dbe21e --- /dev/null +++ b/archiso/airootfs/etc/hostname @@ -0,0 +1 @@ +archiso diff --git a/archiso/airootfs/etc/locale.conf b/archiso/airootfs/etc/locale.conf new file mode 100644 index 0000000..01ec548 --- /dev/null +++ b/archiso/airootfs/etc/locale.conf @@ -0,0 +1 @@ +LANG=en_US.UTF-8 diff --git a/archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf b/archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf new file mode 100644 index 0000000..b9d22eb --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root - $TERM diff --git a/archiso/airootfs/etc/systemd/system/multi-user.target.wants/NetworkManager.service b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/NetworkManager.service new file mode 120000 index 0000000..e874a9b --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/NetworkManager.service @@ -0,0 +1 @@ +/usr/lib/systemd/system/NetworkManager.service \ No newline at end of file diff --git a/archiso/airootfs/etc/systemd/system/multi-user.target.wants/iwd.service b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/iwd.service new file mode 120000 index 0000000..3625abd --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/iwd.service @@ -0,0 +1 @@ +/usr/lib/systemd/system/iwd.service \ No newline at end of file diff --git a/archiso/airootfs/etc/systemd/system/multi-user.target.wants/pacman-init.service b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/pacman-init.service new file mode 120000 index 0000000..d09eec6 --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/pacman-init.service @@ -0,0 +1 @@ +../pacman-init.service \ No newline at end of file diff --git a/archiso/airootfs/etc/systemd/system/multi-user.target.wants/sshd.service b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/sshd.service new file mode 120000 index 0000000..d21ebd9 --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/multi-user.target.wants/sshd.service @@ -0,0 +1 @@ +/usr/lib/systemd/system/sshd.service \ No newline at end of file diff --git a/archiso/airootfs/etc/systemd/system/pacman-init.service b/archiso/airootfs/etc/systemd/system/pacman-init.service new file mode 100644 index 0000000..725b5b4 --- /dev/null +++ b/archiso/airootfs/etc/systemd/system/pacman-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Initializes Pacman keyring +Before=sshd.service cloud-init-local.service +ConditionDirectoryNotEmpty=!/etc/pacman.d/gnupg + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/pacman-key --init +ExecStart=/usr/bin/pacman-key --populate + +[Install] +WantedBy=multi-user.target diff --git a/build-docker.sh b/build-docker.sh index 81639b1..0e98f4d 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -77,30 +77,6 @@ cp .chezmoi.toml.tmpl archiso/airootfs/root/dotfiles/ 2>/dev/null || true # Copy target package list for installer cp archiso/target-packages.x86_64 archiso/airootfs/root/ -# Create auto-login service -mkdir -p archiso/airootfs/etc/systemd/system/getty@tty1.service.d -cat > archiso/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear %I \$TERM -EOF - -# Create installer launch script -cat > archiso/airootfs/root/.bash_profile << "EOF" -#!/bin/bash - -if [[ -z \$DISPLAY ]] && [[ \$(tty) = /dev/tty1 ]]; then - clear - echo "Welcome to Hyprland Minimal Installer" - echo "" - echo "Type '\''installer'\'' to start the installation process" - echo "" -fi - -alias installer="/usr/local/bin/installer.sh" -source ~/.bashrc 2>/dev/null || true -EOF - # Set permissions chmod +x archiso/airootfs/usr/local/bin/installer.sh 2>/dev/null || true chmod +x archiso/profiledef.sh 2>/dev/null || true diff --git a/build-iso.sh b/build-iso.sh index f654d92..af5c673 100644 --- a/build-iso.sh +++ b/build-iso.sh @@ -51,42 +51,6 @@ cp "$SCRIPT_DIR/.chezmoi.toml.tmpl" "$PROFILE_DIR/airootfs/root/dotfiles/" # Copy target package list for installer cp "$PROFILE_DIR/target-packages.x86_64" "$PROFILE_DIR/airootfs/root/" -# Create auto-login service -print_step "Creating auto-login service" -mkdir -p "$PROFILE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d" -cat > "$PROFILE_DIR/airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf" << EOF -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear %I \$TERM -EOF - -# Create installer launch script -cat > "$PROFILE_DIR/airootfs/root/.bash_profile" << 'EOF' -#!/bin/bash - -# Auto-start installer on login -if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then - clear - echo "Welcome to Hyprland Minimal Installer" - echo "" - echo "Type 'installer' to start the installation process" - echo "Type 'help' for more options" - echo "" -fi - -alias installer='/usr/local/bin/installer.sh' -alias help='echo "Available commands: - installer - Start the installation process - iwctl - Configure WiFi manually - nmtui - Network configuration UI - fdisk -l - List available disks - lsblk - Show block devices - reboot - Restart the system - poweroff - Shutdown the system"' - -source ~/.bashrc -EOF - # Build the ISO print_step "Building ISO (this will take some time)..." mkarchiso -v -w "$WORK_DIR" -o "$OUT_DIR" "$PROFILE_DIR"