While catching up on some news over the weekend, I had noticed a VMware Reddit thread asking a pretty interesting question on how to prevent the physical CD-ROM tray from ejecting after installing or upgrading ESXi? This behavior occurs whether you are using a physical CD-ROM media or a "Virtual" ISO image via an out-of-band interface like an iDRAC or iLO. If you are automating the installation or upgrade using Auto Deploy or network installation such as Kickstart, this is not a problem.
However, I was a bit surprised to hear that this was still a pain point in 2019, as many of the new servers in market do not even include an option for CD-ROM. Some of the suggestions really brought me back to the early 2000's including physically taping up the CD-DROM tray, which I have definitely seen customers doing but this is not a scalable solution and it requires a visit to the datacenter.
One easy solution that I had suggested was to take advantage of ESXi's scripted installation capability also known as Kickstart and use the supported ESXi --noeject option after reboot. Since the install/upgrade was being done manually, the added benefit of this solution is that you can now have it automated 🙂 The other nice thing about this option is that you can specify the kickstart using the default ESXi ISO or you can take it a step further and embed the Kickstart with a custom ESXi ISO.
Step 1 - Here is a sample Kickstart which includes the --noeject command as part of the reboot option. Simply host ks.cfg on an internal webserver which is accessible by the ESXi host that is being installed and/or upgraded.
vmaccepteula install --firstdisk=local --overwritevmfs reboot --noeject network --bootproto=static --ip=192.168.30.99 --netmask=255.255.255.0 --gateway=192.168.30.1 --hostname=noeject-esxi.primp-industries.com --nameserver=192.168.30.1 --addvmportgroup=1 rootpw VMware1! %firstboot --interpreter=busybox # enable & start SSH vim-cmd hostsvc/enable_ssh vim-cmd hostsvc/start_ssh # enable & start ESXi Shell vim-cmd hostsvc/enable_esx_shell vim-cmd hostsvc/start_esx_shell # Suppress ESXi Shell warning esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i
Step 2 - Boot the ESXi ISO like you normally would but edit the boot option (Shift+O) and replace it with the following: ks=https://[SERVER]/ks.cfg and then hit enter for installation and/or upgrade to automatically start.
Once the installation has finished, the ESXi host will automatically reboot and the CD-ROM tray will not be ejected.
Since I did not have a physical host with CD-ROM, I was able to validate this by simply using a Nested ESXi VM and as you can see, the CD-ROM device is still "Connected" after installation.
If we install or upgrade ESXi normally via the ISO image, you will see the CD-ROM device is automatically "Disconnected" afterwards which is the equivalent of ejecting the physical CD-ROM tray.
Thanks for the comment!