If you install ESXi via a Kickstart script and make use of the %firstboot option to execute commands on the first boot of the ESXi host after installation, you should be aware of its incompatibility with the Secure Boot feature. If you install ESXi where Secure Boot is enabled, the Kickstart will install ESXi normally only execute up to the %post section. However, it will not execute the %firstboot scripts and if you look at the /var/log/kickstart.log after the host boots, you should see the following message:
INFO UEFI Secure Boot Enabled, skipping execution of /var/lib/vmware/firstboot/001.firstboot_001
If you have Secure Boot enabled, %firstboot is not supported. The reason for this is Secure Boot mandates only known tardisks which can hold executable scripts, and a kickstart script is an unknown source so it can not run when Secure Boot is enabled. If you wish to continue using %firstboot scripts, the only option is to disable Secure Boot and then re-enable it after the installation. A preferred alternative is to convert your %firstboot logic into an external script which can then be applied using the vSphere API (recommended method) and this way you can still customize your ESXi host after the initial installations. I have already filed an internal documentation bug to add a note regarding Secure Boot and %firstboot, hopefully that will roll out with the net documentation refresh.
Not a bug but secure boot also disables running code from /etc/RC.local.d/local.sh which is what I'm using to load persistent firewall rules.
Any ideas how to achieve this in the a secure boot world?
William Lam says
I don't have a solution, but out of curiosity, what firewall rules are you having to create to create by hand?
Martin Gavanda says
Just covert your FW rules into the vib and slipstream them into the esxi profile or adjust your update manager baselines.
Did the same in the past but keeping the rules consistent was pain in the ass.
In my case custom FW rules ware used for VNC connection to the VMs (custom self service portal and guacamole as a VNC proxy)
Do you know how to disable secure boot. My VM setting already uses BIOS, not EFI boot. But seems like /etc/rc.local.d/local.sh still not invoked. Also when I got in shell and ran SecureBootCheck, it shows 'Disable'. Very weird behavior.
Vijay Bhatt says
Thanks for this blog throwing light on the work-around.
Do we have example/sample/insights around how to go around this:
"A preferred alternative is to convert your %firstboot logic into an external script which can then be applied using the vSphere API (recommended method) and this way you can still customize your ESXi host after the initial installations."
Background: We need configure Esxi host DNS/Network settings after initial installation which is currently in %firstboot section.
Suham Roy says
I know it has been very long but still curious to know if you could find a solution for it?