diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index 77a7a90..9612f5c 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -283,9 +283,18 @@ def configure_system(mount_root, partition_info, user_info=None, disk_device=Non with open(os.path.join(mount_root, "etc/kernel/layout"), "w") as f: f.write("bls\n") + # Cleanup existing systemd-boot files to ensure a fresh install since --force is not supported + for d in ["loader", "EFI/systemd", "EFI/BOOT"]: + path = os.path.join(mount_root, "boot", d) + if os.path.exists(path): + import shutil + if os.path.isdir(path): + shutil.rmtree(path) + else: + os.remove(path) + # Initialize systemd-boot - # We use --force to overwrite any existing entries and ensure it's the primary bootloader - run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot", "--force"]) + run_command(["chroot", mount_root, "bootctl", "install", "--path=/boot"]) # Sync kernels and generate BLS entries # Since we rsync'd, kernels are in /lib/modules and /boot