Tuesday, November 13, 2018

How to make bootable ESXi 6.7 USB stick on Ubuntu 18

A.K.A. "Format a USB Flash Drive to Boot the ESXi Installation or Upgrade"

I got new hard drives for my home server and decided that it is a good time to update ESXi to version 6.7. The question came up: how to make a bootable USB stick with ESXi 6.7 iso image on Linux?

 There is no Windows PC at home. I don't have a Mac either. Luckily, VMWare prepared a doc about the topic - it is a part of ESXi 6.7 User Guide. My happiness didn't last for long. I followed the steps: created FAT32 partition, marked it bootable, installed syslinux and copied files, moved and updated syslinux.cfg. But it didn't work.

Apparently, VMWare 6.7 ISO image is not compatible with current syslinux used by Ubuntu 18.04:
syslinux -v
syslinux 6.03  Copyright 1994-2014 H. Peter Anvin et al
When I tried to boot the server from USB stick I started to see all kinds of error messages like:
Failed to load COM32 file menu.c32
I even tried to copy syslinux files as recommended here. But it didn't help. Then I tried some other options and got another error:
Loading -c... failed! No files found!"
The problem is clear. When I compared the steps for ESXi 5.1 and 6.7 - I found a difference. In 5.1 VMWare clearly states that they're using syslinux 3.86:
Verify that the machine opn which you are performing this procedure has access to syslinux version 3.86. This procedure requires syslinux version 3.86.

Let's try with syslinux 3.86:

1. Download syslinux-3.86 archive from here and unpack it.
2. If you've never done any development on your ubuntu machine, you may require to install multiple packages such as (maybe you will need something else as well):
sudo apt install nasm build-essential uuid-dev
3. When you're done installing dependencies, compile the installer:
~/Downloads/syslinux-3.86$ make installer
4. If everything goes fine, you're ready to install syslinux 3.86 binary on your ESXi USB stick. I'm assuming your USB stick device is /dev/sdb1. If you follow the steps in official VMware ESXi 6.7 documentation then you have to adjust step 4. In the manual you have this:
/usr/bin/syslinux /dev/sdb1
cat /usr/lib/syslinux/mbr/mbr.bin > /dev/sdb
Assuming, you have your syslinux-3.86 source code located in ~/Downloads/syslinux-3.86, do the following:
cd ~/Downloads/syslinux-3.86
mtools/syslinux /dev/sdb1
cat mbr/mbr.bin > /dev/sdb
5. In step 9 official manual recommends to add "-p 1" to APPEND line in syslinux.cfg. SKIP this step.
6. Follow other steps as usual and you should be able to boot from the USB stick.

1 comment: