More notes on ESXi 4.1 Kickstart

ESXi 4.1 kickstart is adequate for most things but I still have several issues with it that I consider ‘bugs’:

1.  If you’re not connected to a network, it doesn’t work.  This is fine since most people will be on a network with VMware anyway right?  Fine, I’ll let this one slide.  But if you just have a machine and a usb stick, then why do you need the network?  Sure you’ll have it eventually but I just want to test it on my server on my desk…

2.  The kickstart file likes to stop and give you alerts even if everything is ok.  As an example:  In the post install script if I don’t put the interpreter it stops and gives me a note:  “Interpreter not specified, using busybox”  That’s fine, that’s what the default is.  Why stop me?  The docs state clearly that the default is busybox.

3.  Name resolution doesn’t work in postscripts.  If you’re trying to get information from other hosts, it doesn’t work.  Forget it.  Just put in the IP address in your post install script.

4.  USB installations without kickstart don’t work.  You need to have a CD/DVD image.  This is lame.  In an era where most servers I deal with don’t have DVD roms, why make me buy a usb DVD drive?  A $10 usb stick should do this just fine.

5.  Lack of mount support.  This kills me.  I want to have a USB drive boot up ESXi 4.1 in kickstart and then boot up with a virtual machine.  Problem is my virtual machine is 60GB.  After digging around, I see that ESXi 4.1 can get files from a FAT32 filesystem by using the mcopy command.  (It doesn’t do a mount).  But what I really want is ext3 support so that I can copy 60GB files onto a hard disk.  I’m thinking about hacking an ext3 driver for busybox, but I don’t know how difficult that will be.   Right now, my options seem to break up my disk image into 2GB chunks so they fit on the FAT 32 partition… lame.  Anyway, please don’t tell me to consider NFS and all that stuff, because I know that’s the optimal solution.  This project is a little different than what you may be thinking of.

Anyway, I don’t want to keep complaining, so here are some nice things:

Enable SSH on the TSM.

We want SSH on our machines, even if its not supported.  So we add this to our kickstart file:

%firstboot –interpreter=busybox –unsupported –level=47

sed -ie ‘s/#ssh/ssh/’ /etc/inetd.conf

Mounting USB drives

As I mentioned you can’t mount USB drives on ESXi 4.1.  (At least I haven’t figured it out yet).  You can do passthrough with the USB drives so that the VMs can mount them, but you can’t actually mount it on the hypervisor.

However you can copy files from the FAT32 partition.  Here is an example of a command to use in a kickstart file:

mcopy -i /dev/disks/mpx.vmhba32:C0:T0:L0:1 \::IMAGEDD.BZ2 /install_cache/IMAGEDD.BZ2

(In fact, this is the exact command used by the installer to grab the bz2 image from the fat 32 partition)

So if you had a file named foo on there, you could substitute it in for the IMAGEDD.BZ2 file name and copy it onto your hypervisor.  I would do this for copying *vmx files or things like that.

There’s one catch:  The mcopy command is available during installation, but upon reboot, there is no mcopy command!  So if you want it, then a good idea is to copy it during the kickstart file to some place where you can get it after its installed.

Anyway, happy VMware VMworld to all you who are going.

  • Rich

    Great info–you seem to be the only one around that has addressed mcopy on esxi. Where does the mcopy line get placed to copy files before the host reboots? I have the following line in a kickstart file but it doesn’t copy the files. If I enter it at the keyboard before reboot it copies the entire PCNS directory to the host, but in the script it does nothing.
    mcopy -i /dev/disks/mpx.vmhba32:C0:T0:L0:1 ::PCNS

    Thanks!

    • Vallard

      Put the mcopy in the postscript. (This only works for 4.1 and greater) Example:

      %post –unsupported –interpreter=busybox
      LOG=/tmp/var/log/my.log
      mcopy -v -b -i /dev/disks/mpx.vmhba*:1 ::esxi4.1/mcopy /tmp/mcopy 2>&1 | tee -a $LOG /dev/tty2

      Hope that helps!!

      • Rich

        Thanks for the quick reply. My scripting is pretty weak so I could use a little more explanation that is more specific to what I’m trying to do. I have two files, call them file1 and file2, that I want to move off the thumb drive onto the esxi 4.1 install within the kickstart. They’re in a directory on the thumb drive called directory. To copy them in the post install, where do I put the words file1 and directory in the command you’ve provided. I won’t feel bad if you explain it to me like I’m 6; in fact, I might understand it better if you do :)
        Thanks so much for your help and patience!

        • Rich

          I think I’m set. This command worked for me with file1 at the root directory of the usb:
          mcopy -v -b -i /dev/disks/mpx.vmhba32:C0:T0:L0:1 ::file1 /PCNS223/file1.copy 2>&1

          Thanks for your help!

          • Rich

            Ok–spoke too soon. I checked before reboot and the files showed on the host, but after reboot, the files weren’t there. Any thoughts?

          • Rich

            Thanks for your help! This has been bugging me for too long.

            I ended up putting the files in oem.tgz and using mcopy to copy them in the %post section of the script.

            The key piece to all of this for me was the destination. By putting them in /vmfs/volumes/Hypervisor1 they were on the system after reboot and automatically expanded to the correct location since they were in oem.tgz.

            In the end, the command I used was:

            mcopy -v -b -i /dev/disks/mpx.vmhba32:C0:T0:L0:1 ::oem.tgz /vmfs/volumes/Hypervisor1/oem.tgz