I have a Linux virtual machine in vmware workstation that I use to run scripts to setup a USB disk as a bootable vmware installation media. This works as intended.
When I do the same via a C# Windows forms project, the kickstart scripts specified for the vmware installer seems to fail. The logs that I am supposed to fetch via KS.CFG never get fetched, %firstboot gets executed forever on every boot and none of the commands in KS.CFG ever get through. Everything else works. The VMWare installer is booted via Syslinux, it seems to install, /var/log/weasel.log reports nothing new. I am out of ideas troubleshooting what might have gone wrong. Does anyone here have any suggestions on where I should look or why running the kickstart scripts fail? I have added sleep 30 after the %firstboot directive an before running the reboot command at the end of the %firstboot section.
I did two things to fix this. I don't know why the error only happened when creating the installer in the one environment and not in the other, but here is what fixed it:
1. In ks.cfg:
if [ -d "/vmfs/volumes/NO NAME/" ]; then
USBDIRECTORY="/vmfs/volumes/NO NAME"
else
USBDIRECTORY="/vmfs/volumes/CONFIG"
fi
echo "Decided to use $USBDIRECTORY as path to the USB Device" >> $LOG 2>> $LOG
The first boot script seems to fail or something similar when it fails at performing actions against files that should have been prepared from usb in the post install script. The FAT16 partition that the post install script is supposed to access is supposed be named CONFIG, but some times esxi maps it up as NO NAME. In order to get the correct path based on the name or NO NAME, I check for it and store it in a variable. This is enough to ensure that the post install and first boot scripts do what they are supposed to.
2. At the end of the first boot script I had this:
echo "#Host configuration done! Rebooting.." >> $FIRSTBOOTLOG 2>> $FIRSTBOOTLOG
sleep 30
reboot -n -f >> $FIRSTBOOTLOG 2>> $FIRSTBOOTLOG
It is now changed to sleep 180 seconds in stead of 30, to ensure that all whatever processes on the esxi are done doing whatever they are doing before boot.
I am not sure of all that is happening in the background that this affects, but it seems to do the trick and fix my problem.
I did two things to fix this. I don't know why the error only happened when creating the installer in the one environment and not in the other, but here is what fixed it:
1. In ks.cfg:
if [ -d "/vmfs/volumes/NO NAME/" ]; then
USBDIRECTORY="/vmfs/volumes/NO NAME"
else
USBDIRECTORY="/vmfs/volumes/CONFIG"
fi
echo "Decided to use $USBDIRECTORY as path to the USB Device" >> $LOG 2>> $LOG
The first boot script seems to fail or something similar when it fails at performing actions against files that should have been prepared from usb in the post install script. The FAT16 partition that the post install script is supposed to access is supposed be named CONFIG, but some times esxi maps it up as NO NAME. In order to get the correct path based on the name or NO NAME, I check for it and store it in a variable. This is enough to ensure that the post install and first boot scripts do what they are supposed to.
2. At the end of the first boot script I had this:
echo "#Host configuration done! Rebooting.." >> $FIRSTBOOTLOG 2>> $FIRSTBOOTLOG
sleep 30
reboot -n -f >> $FIRSTBOOTLOG 2>> $FIRSTBOOTLOG
It is now changed to sleep 180 seconds in stead of 30, to ensure that all whatever processes on the esxi are done doing whatever they are doing before boot.
I am not sure of all that is happening in the background that this affects, but it seems to do the trick and fix my problem.