ESXi
From CafeWiki
Contents |
Setup and Configuration
The initial configuration of the box is performed directly on the ESXi server at the end of the installation process and is pretty much limited to setting the root password, configuring the network and keyboard and viewing logs, see the figure below:
After the basics are set in the console, the Virtual Infrastructure Client (VI Client) is used for all other setup and configuration tasks. The VI Client is downloaded from the ESXi server by browsing to the ip address of the server and selecting Download VMware Infrastructure Client from the webpage. Install the VI Client (only for Windows) and then log into the VI Client as root using the password set in the console.
There are two tasks to do immediately, first provide the license key for the VI Client (provided by email when you downloaded ESXi). Some options will disappear as the free client has few features than the paid version. The second task is to set up a datastore for the ESXi box. This is fairly straight forward as there is little that can be done until this is set up and the VI Client sort of nags you to get the datastore set up.
Datastore Setup
I used an iSCSI target on the Openfiler box (see iSCSI Target Configuration).
- With the host selected in the left hand navigation tree, select Add Storage on the Configuration tab, the Add Storage Wizard will appear.
- Select Storage Type of Disk/LUN
- Select an available LUN (as set up on Openfiler), use the search box (set to LUN) to find the IQN.
- Set the disk layout
- Properties, defaults seem fine
- Formatting, use the VMFS file system type
Next, create a directory in the datastore to hold installation ISOs that will be used for installing VM operating systems. Right click on the datastore and select Browse Datastore, this will pop open a browser where a new folder can be created and then ISO images can be uploaded. I called the folder ISO Repository and uploaded the latest ubuntu server and desktop images.
Create VMs
Once the datastore setup, VMs can be created. From the host Summary tab, select New Virtual Machine, the wizard will pop open. I've found it helpful, to keep things straight, to adopt the convention of adding a prefix to the VM names to help me to remember which machines perform what functions:
vwMachineName virtual web server vdMachineName virtual desktop vmMachineName virtual mail server vhMachineName virtual host server (i.e. dhcp server) vvMachineName virtual vpn server vtMachineName virtual teamspeak server
In the wizard:
- Select the wizard type, Typical seems to work fine.
- Name the new VM
- Select the datastore where the VM will reside
- Select the operating system type used on the VM
- Select the number of CPUs available to the VM
- Select the amount of memory available to the VM
- Configure the network settings (defaults are OK)
- Select the amount of disk space needed by the VM
- Check Edit the virtual machine settings before submitting and "Finish the wizard
- The Virtual Machine Properties dialogue will open and from the Hardware tab:
- Select CD/DVD Drive 1 and:
- Set Connect at power on
- Set Device Type to Datastore ISO file and browse to the ISO image for your server that has been uploaded into the datastore
- (Optional) Remove the Floppy Drive, since it's not likely to be needed
- Select CD/DVD Drive 1 and:
- From the Options tab:
- Select Boot Options and check the Force BIOS Setup
- Select OK
The new VM will appear in the navigation list.
Start VM and Install OS
Since the option to go to the BIOS was selected in the setup, the first time the new VM is powered on, the BIOS configuration page will be displayed in the Console tab for the VM. Set the boot device order in the BIOS to boot from the CD/DVD ahead of the hard disk. Save and exit the BIOS and when the VM restarts, the machine will boot from the ISO image specified in the setup.
Install and configure the OS as desired to support the intended purpose of the VM. For some of the common servers, see the Servers section of Wiki-agrippa:Community_Portal.
Install VMWare Tools on VM
VMWare Tools should be installed on each VM created to help improve the performance of the VM. (SEAN: Can you elaborate on this??)
Prep for installing VMWare Tools
The first time that VMWare Tools are installed on a machine, or after an upgrade to a new release of ubuntu, the linux kernel source may not exist and will have to be installed prior to installing the VMWare Tools. Usually this isn't apparent until you get an error during the install of the tools at a point where the networking has been stopped. So, if you get to the install question:
What is the location of the directory of C header files that match your running kernel? [/usr/src/linux/include]
and the default doesn't work, do the following
$<ctrl-c> $/etc/init.d/networking restart $apt-get install linux-headers-`uname -r`
This will install the linux header for the current kernel version and then the VMWare Tools should install properly.
Desktop
For an ubuntu desktop virtual machine, start from the VIClient and check the VMTools status for the VMs by selecting the ESXi server on the LH pane and then the Virtual Machines tab in teh RH pane. If the status of the VMWare Tools is not "ToolsOK" then right click on the VM in the LH pane and select "Install/Upgrade VMWare Tools". This will cause the VM to mount a CD image containing the install tarball on /media/cdrom0. Start a console session on the VM and then open a terminal window and run the following commands:
$cd /usr/src $sudo cp /media/cdrom0/<VMWareTools-[version].tar.gz> ./ $sudo tar -xvzf <VMWareTools-[version].tar.gz> $cd vmware-tools-distrib/ $sudo ./vmware-install.pl
Use the defaults offered during the installation of the VMWare Tools. Once the installation completes, set up the vmxnet driver:
$sudo /etc/init.d/networking stop
If you aren't on a console session, but used puTTY or something, this would be a good time to start a console session :-)
$sudo rmmod pcnet32 $sudo rmmod vmxnet $sudo depmod -a $sudo modprobe vmxnet $sudo /etc/init.d/networking start
The cdrom can be unmounted (by right click menu item on the VM desktop cdrom icon). Check that the the VM now shows "ToolsOK" in the VI Client and that the IP address is reported correctly.
Server
For a ubuntu server VM, the process is the same except that the cdrom image needs to be mounted from the command line:
$mount /dev/cdrom /mnt $cp /mnt/<VMWareTools-[version].tar.gz> /usr/src/ $umount /dev/cdrom
From here it is the same as for the desktop machine; open the tarball, run the installer and enable the vmxnet driver. Check the VI Client for the "ToolsOK" message and IP address for the server. Note that the vmxnet module doesn't appear to be working in ubuntu 9.10
Problems and Troubleshooting
One tip to prevent problems with corrupted VMs is to ensure that the ethernet link between the ESXi server and the Openfiler SAN server is protected from dropouts caused by power bumps. The switch connecting the two servers should be powered from the battery back-up side of the UPS.
ESXi box can't find iSCSI storage
Scenario: found ESXi box powered down (kids playing in the "server room") so I rebooted the box and then the VMware Infrastructure Client (VI Client) says it can't find any storage.
To fix this, I had to:
- Go to Configuration | Storage Adapters
- select the iSCSI Software Adapter and choose Properties
- Select Configure on the General tab and then Enabled under general properties
- Select Add... on the Dynamic Discovery tab and enter the IP address of the iSCSI Server (i.e. target)
- OK out of the dialogue
- Rescan the iSCSI Software Adapter
This should result in the iSCSI storage from the openfiler box being visible once again
The bad news is that the virtual machine that was previously running is just missing.
ESXi box can't find VMs
After recovering the datastore, the VM can be recovered as follows:
- On the Summary tab for the ESXi host the available data stores are listed, in this case there is one: ESX_Storage
- Double click the datastore icon and open the datastore browser
- Find the Virtual Machine file (.vmx extension) for the missing VM
- Right click the VM file and select Add to Inventory
- Follow the wizard and add the VM to the host
The VM can then be powered on and administered as desired.
A VM Hangs on the ESXi box
It is possible that a VM can hang in such a state that the VIClient software can no longer access or control one of the VMs. If this happens then the VM needs to be shut down by force. Unfortunately, this can't be done from the VIClient (as far as I can tell). The unsupported Tech-Support Mode needs to be invoked to forcibly kill the VM based on it's VMID. This site provides information on how this is done. Here is a summary:
When you use the vm-support command to shut down a VM, you must first find the virtual machine ID (VMID) and then use the vm-support command to forcibly terminate it. This method does more then shut down the VM – it also produces debug information that you can use to troubleshoot an unresponsive VM. On ESXi hosts the vm-support command can be using the special tech support mode which provides access to its Busybox, Posix-based management console.
- On the ESXi console, press Alt-F1.
- Type the word unsupported (text will not be displayed while typing) and press Enter. A password prompt will appear, enter the root password for the ESXi host and you will be at a # prompt in the root partition.
- The vm-support command is a multi-purpose command that is mainly used to troubleshoot host and VM problems. You can use the -X parameter to forcibly shut down a VM and also produce a file with debug information. As with ESX hosts, running this command will create a .tgz file but it will not be located in the directory that you run the command in. Instead it will be created in the /var/tmp directory which points to the 4 GB Virtual File Allocation Table (VFAT) system swap partition. You can also set a Virtual Machine File System (VMFS) volume as your working directory for the .tgz file. First, type vm-support -x to get a list
- To forcibly shut down the VM and generate core dumps and log files, type vm-support -X <VMID>. If you wish to specify an alternate directory for the .tgz file that is created also add the -w <vmfs volume path> parameter. You will receive prompts asking if you want to take a screenshot of the VM. This can be useful if you want to see if there are any error messages. You will also be prompted about whether you wish to send an non-maskable interrupt (NMI) and an ABORT to the VM, which can further aid in debugging. You must say yes to the ABORT prompt for the VM to be forcibly stopped. Once the process completes, which can take 10-15 minutes, a .tgz file will be created in the /var/tmp directory that you can use for troubleshooting purposes.
- You can check the state of the VM again by typing vm-support -x. You should not see the VM listed at this point. Be sure and delete the .tgz file that is created when you are done to avoid filling up your host disk.
- You can leave tech support mode by typing ‘exit’ and pressing Alt-F2 to return to the normal console mode.

