Lo que valgo

September 29th, 2009

“No sabrás todo lo que valgo hasta que no pueda ser junto a tí todo lo que soy.”
– Gregorio Marañón

Installing VMware ESXi 4 over PXE

September 19th, 2009

Let’s face it: installing VMware ESXi from a CD-ROM or from a USB key is painfully slow. Installing from the network is faster and more flexible. And preparing VMware to be installed from PXE turned out to be very easy.

The ISC DHCP configuration file could look like this:

# cat /etc/dhcpd.conf
default-lease-time 86400;
max-lease-time 604800;
option subnet-mask 255.255.255.0;
option broadcast-address 1.0.0.255;
option domain-name-servers 1.0.0.1;
option domain-name "example.com";

subnet 1.0.0.0 netmask 255.255.255.0 {
        range 1.0.0.100 1.0.0.254;
        option routers 1.0.0.2;
        option ntp-servers 1.0.0.3;
}

host esx {
        hardware ethernet 00:aa:bb:cc:dd:ee;
        fixed-address esx;
        next-server 1.0.0.4;
        filename "pxelinux.0";
}

The important bits are in the host esx section, where PXE boot support is enabled by means of the next-server and the filename directive. next-server specifies the IP address (or DNS name) of the TFTP server to be used to download the PXE boot loader and filename the file that stores the PXE boot loader code.

Looking inside the TFTP server, we can see that the tftpboot root directory is very simple: it consists of a standard pxelinux.0 PXE boot loader, a pxelinux.cfg directory where the configuration files are stored and a directory for all VMware-related files. pxelinux.0 is just part of the syslinux project. pxelinux.cfg has to be created by hand. vmware-esxi-4-0-0 contains files copied directly from the VMware ESXi 4 installable ISO image:

# ls -l /tftpboot
total 40
-rw-r--r--  1 root  wheel  14776 Sep 18 03:17 pxelinux.0
drwxr-xr-x  2 root  wheel    512 Sep 18 03:43 pxelinux.cfg
drwxr-xr-x  2 root  wheel    512 Sep 18 03:50 vmware-esxi-4-0-0

For all different naming options for configuration files stored under pxelinux.cfg, check the manual page for pxelinux or search the Internet. In my case, I just chose 01-${MAC} where ${MAC} is the MAC address of the Ethernet interface used to PXE-boot the machine where ESXi is to be installed. In this case, ${MAC} is 00-aa-bb-cc-dd-ee.

The contents of the configuration file are in fact a slightly modified copy of the contents of the isolinux.cfg file from the VMware ESXi 4.0 installable ISO image. The only differences are the default and label directives and the adjusted path names for the kernel and modules: all these files live inside their own directory to avoid polluting the tftpboot root.

# cat /tftpboot/pxelinux.cfg/01-00-aa-bb-cc-dd-ee
default esxi
label esxi
kernel vmware-esxi-4-0-0/mboot.c32
append vmware-esxi-4-0-0/vmkboot.gz
   --- vmware-esxi-4-0-0/vmkernel.gz
   --- vmware-esxi-4-0-0/sys.vgz
   --- vmware-esxi-4-0-0/cim.vgz
   --- vmware-esxi-4-0-0/ienviron.tgz
   --- vmware-esxi-4-0-0/image.tgz
   --- vmware-esxi-4-0-0/install.tgz

The files stored inside the vmware-esxi-4-0-0 directory were copied directly from the VMware ESXi 4.0 installable ISO image, as mentioned above:

# ls -l /tftpboot/vmware-esxi-4-0-0
total 694704
-r--r--r--  1 root  wheel   12730046 Sep 18 03:15 cim.vgz
-r--r--r--  1 root  wheel    5818848 Sep 18 03:15 ienviron.tgz
-r--r--r--  1 root  wheel  288629638 Sep 18 03:17 image.tgz
-r--r--r--  1 root  wheel      21456 Sep 18 03:17 install.tgz
-r-xr-xr-x  1 root  wheel      47404 Sep 18 03:44 mboot.c32
-r--r--r--  1 root  wheel   46184258 Sep 18 03:15 sys.vgz
-r--r--r--  1 root  wheel      16805 Sep 18 03:15 vmkboot.gz
-r--r--r--  1 root  wheel    2044368 Sep 18 03:15 vmkernel.gz

Creating an OpenSolaris LiveUSB

September 14th, 2009

Creating a bootable OpenSolaris LiveUSB might prove useful in some situations, for example when installing OpenSolaris on machines without a CD/DVD drive. First, download the OpenSolaris LiveCD image.

Next, install SUNWdistro-const:

$ pfexec pkg install SUNWdistro-const

Generate a USB image from the contents of the LiveCD image:

$ pfexec usbgen osol-0906-x86.iso osol-0906-x86-usb.img /var/tmp/solaris

Dump the USB image into the USB device, but first make sure the USB device is not already mounted (for example, automatically mounted by GNOME):

$ pfexec usbcopy osol-0906-x86-usb.img

When it is not possible to install VMware ESXi 4.0 from a CD/DVD drive, and if the machine supports booting from USB, one can easily install from a USB drive. Preparing the USB drive to install ESXi 4.0 from it is very easy:

Create a FAT32 partition on the USB drive:

# install-mbr /dev/sdX
# fdisk /dev/sdX
...
# mkfs.vfat /dev/sdX1

Make sure the FAT32 partition is tagged as bootable/active in the MBR and that preferably it has a valid Win32 FAT32 partition type.

Next, copy the contents of the ESXi 4.0 CD into the FAT32 partition from the USB drive:

# mount -o loop /path/to/VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso /mnt
# mount /dev/sdX1 /media
# cp /mnt/* /media
# mv /media/isolinux.cfg /media/syslinux.cfg
# umount /media
# umount /mnt

The last step consists of installing syslinux into the FAT32 partition:

# syslinux -s /dev/sdX1

Done!

Currently available version of Google Talk Video plug-in for Mac OS X (1.0.13.1284) might cause up to a 30-second delay while putting the computer to sleep under Snow Leopard.

This has been reported and discussed in the following Apple support thread. In the end, the solution typically requires to uninstall Google Talk Video. The solution was found and reported by Snoop Dogg in that same thread.

Basically, the misbehaving process can be found by running sudo pmset -g log then looking for the process with the highest response time. In my case:

$ sudo pmset -g log
...
 * Domain: applicationresponse.timedout
 - Message: Kernel GoogleTalkPlugin com.apple.powermanagement.applicationrespons
e.timedout 30000 ms
 - Time: 9/2/09 12:42:47 AM GMT+02:00
 - Signature: GoogleTalkPlugin
 - UUID: AD1E9199-B66D-41CB-BF4F-590EF232DE79
 - Result: Noop - Response time (ms): 30000
...