### --- Locale & Keyboard --- d-i debian-installer/locale string en_US.UTF-8 d-i debian-installer/country string FR d-i debian-installer/language string en d-i localechooser/supported-locales multiselect en_US.UTF-8 d-i keyboard-configuration/xkb-keymap select us ### --- Network --- d-i netcfg/choose_interface select auto d-i netcfg/get_hostname string compute-node d-i netcfg/get_domain string policloud.io d-i netcfg/disable_ipv6 boolean true d-i netcfg/wireless_wep string d-i netcfg/link_wait_timeout string 10 ### --- Mirror --- d-i mirror/country string manual d-i mirror/http/hostname string deb.debian.org d-i mirror/http/directory string /debian d-i mirror/http/proxy string ### --- Time --- d-i time/zone string Europe/Paris d-i clock-setup/utc boolean true d-i clock-setup/ntp boolean true ### --- Accounts --- d-i passwd/root-password-crypted password $6$.gvGPqrKa5NewXQh$DVlcXKmFdalflmdJ4/gFlRAzM0l6Ofnj26x9sVSCeFWoWc3eG5Q54A.YcpwrFMFSRjwPYbgEcg996GuFU8Nyv/ d-i passwd/user-fullname string ops d-i passwd/username string ops d-i passwd/user-password-crypted password $6$.gvGPqrKa5NewXQh$DVlcXKmFdalflmdJ4/gFlRAzM0l6Ofnj26x9sVSCeFWoWc3eG5Q54A.YcpwrFMFSRjwPYbgEcg996GuFU8Nyv/ d-i passwd/user-default-groups string sudo d-i passwd/user-uid string 1001 ### --- Clear existing partitions (Enhanced) --- d-i preseed/early_command string \ echo "[*] Starting thorough disk cleanup"; \ # Kill any processes that might be using the disks \ for pid in $(lsof -t /dev/nvme0n1* /dev/nvme1n1* 2>/dev/null); do kill -9 $pid 2>/dev/null || true; done; \ # Wipe any existing RAID \ mdadm --stop --scan || true; \ # Completely wipe partition tables and any file system signatures \ wipefs -a /dev/nvme0n1 || true; \ wipefs -a /dev/nvme1n1 || true; \ # Zero the first and last 100MB of each disk to remove any partition table and backup tables \ dd if=/dev/zero of=/dev/nvme0n1 bs=1M count=100 || true; \ dd if=/dev/zero of=/dev/nvme0n1 bs=1M seek=$(( $(blockdev --getsize64 /dev/nvme0n1) / 1048576 - 100 )) count=100 || true; \ dd if=/dev/zero of=/dev/nvme1n1 bs=1M count=100 || true; \ dd if=/dev/zero of=/dev/nvme1n1 bs=1M seek=$(( $(blockdev --getsize64 /dev/nvme1n1) / 1048576 - 100 )) count=100 || true; \ # Create fresh partition tables \ parted -s /dev/nvme0n1 mklabel gpt || true; \ parted -s /dev/nvme1n1 mklabel gpt || true; \ # Wait to ensure changes are synchronized \ sync; \ sleep 5; \ echo "[*] Disk wiping complete"; # Complete removal of all existing metadata d-i partman/unmount_active boolean true d-i partman/filter_mounted boolean false d-i partman-md/device_remove_md boolean true d-i partman-lvm/device_remove_lvm boolean true d-i partman-lvm/device_remove_lvm_span boolean true d-i partman-md/confirm boolean true d-i partman-md/confirm_nooverwrite boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true ### --- Partitioning --- d-i partman-auto/method string raid d-i partman-auto/disk string /dev/nvme0n1 /dev/nvme1n1 d-i partman-auto/expert_recipe string \ multiraid :: \ 1000 1000 1000 free \ $primary{ } \ $bootable{ } \ method{ efi } \ format{ } \ . \ 122880 122880 122880 linux-swap \ $primary{ } \ method{ swap } \ format{ } \ . \ 1000 10000 -1 ext4 \ $primary{ } \ $raid{ } \ method{ raid } \ . # RAID configuration d-i partman-md/device_remove_md boolean true d-i partman-md/confirm boolean true d-i partman-md/confirm_nooverwrite boolean true # Define how the RAID will be used d-i partman-auto-raid/recipe string \ 1 2 0 ext4 / \ /dev/nvme0n1p3#/dev/nvme1n1p3 \ . # EFI and GPT configuration d-i partman-efi/non_efi_system boolean true d-i partman-partitioning/choose_label string gpt d-i partman-partitioning/default_label string gpt # Skip confirmation prompts d-i partman-partitioning/confirm_write_new_label boolean true d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true ### --- Kernel + base --- d-i base-installer/kernel/image string linux-image-amd64 d-i apt-setup/non-free boolean false d-i apt-setup/contrib boolean false ### --- Package selection --- tasksel tasksel/first multiselect standard # d-i pkgsel/include string sudo openssh-server ntp ethtool ipmitool util-linux lvm2 vim htop parted curl git lsscsi net-tools wget lshw mdadm docker.io python3-pip ifenslave d-i pkgsel/upgrade select full-upgrade d-i preseed/late_command string \ echo "[*] Setting up software RAID"; \ in-target apt-get update; \ in-target apt-get install -y --no-install-recommends linux-image-amd64 grub-efi-amd64 mdadm sudo openssh-server curl initramfs-tools; \ echo "[*] Ensuring RAID array is properly assembled"; \ in-target mdadm --assemble --scan; \ in-target mkfs.ext4 -F /dev/md0 || true; \ in-target mdadm --detail --scan > /target/etc/mdadm/mdadm.conf; \ echo "md" >> /target/etc/initramfs-tools/modules; \ echo "raid1" >> /target/etc/initramfs-tools/modules; \ echo "MDADM_MDDEV=/dev/md0" > /target/etc/initramfs-tools/conf.d/mdadm; \ echo "[*] Setting up fstab"; \ mv /target/etc/fstab /target/etc/fstab.backup; \ echo "# /etc/fstab generated by late_command" > /target/etc/fstab; \ echo "UUID=$(blkid -s UUID -o value /dev/md0) / ext4 defaults 0 1" >> /target/etc/fstab; \ echo "UUID=$(blkid -s UUID -o value /dev/nvme0n1p1) /boot/efi vfat umask=0077 0 1" >> /target/etc/fstab; \ echo "# Secondary EFI partition (not mounted by default)" >> /target/etc/fstab; \ echo "# UUID=$(blkid -s UUID -o value /dev/nvme1n1p1) /boot/efi2 vfat umask=0077 0 1" >> /target/etc/fstab; \ echo "UUID=$(blkid -s UUID -o value /dev/nvme0n1p2) none swap sw 0 0" >> /target/etc/fstab; \ echo "UUID=$(blkid -s UUID -o value /dev/nvme1n1p2) none swap sw 0 0" >> /target/etc/fstab; \ echo "[*] Setting up GRUB for RAID boot"; \ echo 'GRUB_DISABLE_OS_PROBER=true' >> /target/etc/default/grub; \ echo 'GRUB_CMDLINE_LINUX="root=/dev/md0 md=0,/dev/nvme0n1p3,/dev/nvme1n1p3 rootdelay=90"' >> /target/etc/default/grub; \ echo "[*] Setting up initramfs and GRUB"; \ in-target update-initramfs -u -k all; \ in-target grub-install --recheck /dev/nvme0n1; \ in-target grub-install --recheck /dev/nvme1n1; \ in-target update-grub; \ echo "[*] Creating EFI fallback directories"; \ mkdir -p /target/boot/efi/EFI/BOOT; \ cp /target/boot/efi/EFI/debian/grubx64.efi /target/boot/efi/EFI/BOOT/BOOTX64.EFI; \ echo "[*] Adding ops SSH Key"; \ mkdir -p /target/home/ops/.ssh; \ echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDn5GS/wzYNA2lyinPkYwrFyHDAH33NUJEMjGY+MwXNw ops@policloud.com" >> /target/home/ops/.ssh/authorized_keys; \ echo "[*] Configuring sudo for ops user"; \ echo "ops ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/ops; \ chmod 440 /target/etc/sudoers.d/ops; \ echo "[*] Create Hive User"; \ wget -O /target/tmp/setup-user.sh http://controller:8088/files/create-hive-user.sh; \ chmod +x /target/tmp/setup-user.sh; \ chroot /target /tmp/setup-user.sh; \ echo "[*] Updating APT sources"; \ wget -O /target/etc/apt/sources.list http://controller:8088/files/sources.list; \ echo "[*] Installing essential packages"; \ in-target apt-get install -y sudo openssh-server ntp ethtool ipmitool util-linux lvm2 vim htop; \ echo "[*] Installing additional utilities"; \ in-target apt-get install -y parted curl git lsscsi net-tools wget lshw mdadm build-essential; \ echo "[*] Installing Docker"; \ in-target apt-get install -y docker.io; \ echo "[*] Installing Python packages"; \ in-target apt-get install -y python3-pip; \ echo "[*] Installing networking packages"; \ in-target apt-get install -y ifenslave; \ echo "[*] Modify Login Motd"; \ wget -O /target/etc/profile.d/motd.sh http://controller:8088/files/motd.txt; \ echo "[*] Setting up network"; \ mkdir -p /target/etc/network/interfaces.d; \ echo 'bonding' >> /target/etc/modules; \ wget -O /target/etc/network/interfaces http://controller:8088/files/interfaces; \ echo "[*] Setup complete" ### --- Bootloader --- # Configure both disks for bootloader redundancy d-i grub-installer/bootdev string /dev/nvme0n1 /dev/nvme1n1 d-i grub-installer/force-efi-extra-removable boolean true ### --- Final reboot --- d-i finish-install/reboot_in_progress note