I'm currently trying to automate Debian 11 template creation through Packer for Nutanix environment and need some advices about preseeding/automating Debian installation.
First of all, after reading this bible https://www.debian.org/releases/stable/amd64/apbs02.fr.html I went into using preseed.cfg file.
I started with the preseed.cfg file provided by Debian then adapt some stuff to fit my needs. Finally, I validate the syntax using debconf-set-selections -c preseed.cfg
command => everything is fine.
Now, i saw there's 3 differents ways to use preseed.cfg :
- through initrd : seems quite difficult to me and didn't find an easy tutorial/documentation
- through network : not an option at this moment due to some firewall restriction
- through file : seems the easiest and best option at the moment
When Packer starts the VM creation, it loads debian ISO as a CD-ROM in 1st position, and an empty virtual disk in the second position. I tell packer to load my preseed.cfg scripts as a cd-rom, so from an hypervisor perspective, a second cd-rom drive is mounted in the 3rd position.
BUT, in this case, VM boot on ISO (cd-rom 1st position), it doesn't mount the second cd-rom drive that have the preseed.cfg file and i can't access it unless I go to the debian console then mount the 2nd drive.
I saw a forum about uploading preseed.cfg into my original debian.iso folder and modifying the /isolinux/txt.cfg file like this (and then recreates the iso with OSCDIMG) :
label install
menu label ^Install
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz preseed/file=/cdrom/preseed/preseed.cfg --- quiet
My question is : is it fair to act like this ? is there something i missed or something easier to make it work easily ?
EDIT : i tried the initrd method, the only remaining thing is that i have to manually select Automated Install. How to get rid of this action ?
EDIT2: 02-01-2023
- i tried 2 more different things, 1st having this line in isolinux/txt.cfg
append auto=true priority=critical vga=788 initrd=/install.amd/initrd.gz preseed/file=/cdrom/preseed.cfg --- quiet
=> NOK, it still boot on boot menu (but ok if i select automated install manually, so it means preseed.cfg works pretty well) - and 2nd, test with
prompt 1 timeout 1
in isolinux.cfg => goes directly to select language manually...
EDIT3: 03-01-2023 here's the preseed.cfg i use :
# SETUP AUTO MODE
d-i auto-install/enable boolean true
d-i debconf/priority select critical
# LANGUAGE & KEYMAP
d-i debian-installer/locale string fr_FR
d-i keyboard-configuration/xkb-keymap select fr(latin9)
# NETWORK
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string template-debian-11-x64
d-i netcfg/get_domain string my_domain.net
d-i netcfg/hostname string template-debian-11-x64
# MIRRORS
d-i mirror/http/hostname string http://deb.debian.org/debian/
d-i mirror/http/hostname string http://security.debian.org/debian-security
# ACCOUNTS
d-i passwd/root-password password mypassword!
d-i passwd/root-password-again password mypassword!
d-i passwd/user-fullname string user
d-i passwd/username string user
d-i passwd/user-password password mypassword!
d-i passwd/user-password-again password mypassword!
d-i passwd/user-uid string 1010
d-i passwd/user-default-groups string si audio cdrom video
# LVM PART
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string 95%
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select multi
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
#APT
d-i apt-setup/cdrom/set-first boolean false
tasksel tasksel/first multiselect standard, ssh-server
# GRUB
d-i grub-installer/bootdev string /dev/sda
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
#FINAL
d-i finish-install/reboot_in_progress note
Thanks a lot
Gael