You’ll have to use other ways to pass the options you want to. In Debian, you do it with preseeding. There are several methods for accomplishing this. I suggest to check the Debian documentation and choose the one doable for you.
Hello Jose, how are you?
In this case, Nutanix does not actually support the "boot_command" option for the Packer build like vsphere or proxmox? If not, could you tell me if Nutanix is working on implementing something similar to "boot_command"?
Do you have any tutorials or suggestions on how I can build Debian 12 using Packer directly within Nutanix?
Hey, doing well, hope you too.
This command is not supported. You can track the feat here.
Check Debian 12 preseed methods here. You’ll have to create a custom ISO, or use DHCP option.
In addition to @JoseNutanix here’s how I made the trick :
- Download official Debian ISO you need (in my case it was 11 but now 12)
- Create a preseed.cfg file that contains every instructions you need for your custom configuration
- Compile your official ISO with the preseed.cfg file
- Upload the custom ISO to Prism Central
- Then from a Packer file, simply write a file with hardware you need and link it to the custom iso you’ve just upload.
- Finally, launch your Packer project, VM will be created, OS will be automatically configured (thanks to preseed.cfg) and once it’s done, Packer will shutdown, delete and create an image from your VM.
The Packer steps aren’t so difficult if you’re used to work with, but the preseed.cfg writing may be a tough part (spent many days/weeks to make all steps I wrote , working)
Note: for Windows people, steps beyond are the same, but you need to write and use an autounattend.xml file instead of preseed.cfg as well.
Thanks for chiming in @gael01.
Just a comment about Windows, unless I missunderstood you, there isn’t need to manipulate the ISO unless you are using UEFI. You can pass bootstrap config files (a.k.a. Sysprep) natively. An example for Windows in our official repo here.
@JoseNutanix you’re true.
In my case I needed UEFI (and I add VirtIO drivers as well, forgot to mention it in my previous post)
After double check in my Packer Windows Server 2019/2022 project, I’m doing the following :
cd_files = "./scripts/autounattend.xml", "./scripts/enable_winrm.ps1", "./scripts/sysprep.xml"]
image_name = "tpl-win_server_2022_autounattend"
image_description = "{{isotime `2006-01-02`}} - Packer Template Windows Server 2022 UEFI autounattended"
shutdown_timeout = "2m"
shutdown_command = "C:\\Windows\\system32\\sysprep\\sysprep.exe /unattend:E:\\sysprep.xml /quiet /generalize /oobe /shutdown"
autounattend.xml is loaded for the Windows auto-install and configuration, then, at the first boot, it launches enable_winrm.ps1 which configure WinRM and Windows Firewall to let Packer send the shutdown command.
About the shutdown command, i’m doing a single sysprep in mode “generalize oobe shutdown” in order to get a sysprep everytime a VM is deployed from the template.
Without this part, any VM deployment from the template leads to similar UUID (and it mays causes issues if you’re using WSUS for example)