Zen LoadBalancer on ESXi – Installing VmWare tools

Zen LoadBalancer: http://www.zenloadbalancer.com is a great appliance for deploying networking load balancing and high availability for server farms. It’s has a good web interface for defining and monitoring them, and it’s quick to deploy on a VMWare infrastructure, if built from the ISO file into a virtual appliance. This virtual appliance is based on Debian Squeeze and needs very low resources (512KB RAM).

For deploying on ESXi infra-structure there is the need to install the VMWare tools provided by ESXi, and these are steps to do so:

1) On Vsphere/VMware administration console, after deploying and booting up the appliance, select the usual Install Vmware tools.
Nothing should happen…
2) Access by SSH to the appliance, or use the console.
3) Make sure that you can use the apt-get command: apt-get update
4) If not, check your DNS settings, default gateway, and/or proxy/firewall.
5) if you’re behind a proxy, you can define the proxy by using the following commands:

export http_proxy=http://proxy_server:port
export https_proxy=http//proxy_server:port

6) if your proxy requires authentication, use the syntax: http://username:password@proxy_server:port
Check: http://blog.mypapit.net/2006/02/how-to-use-apt-get-behind-proxy-server-ubuntudebian.html for more info

7) Mount the virtual ESXi CD-ROM with the following command: mount /dev/cdrom /media/cdrom

8) Copy the tar file of VMware tools from the CDROM to the root home directory:
in my case: cp /media/cdrom/VMwareTools-8.3.12-493255.tar.gz ~

9) Expand the tools:

cd ~
tar xvzf VMwareTools-8.3.12-493255.tar.gz

10) Update the system:

apt-get update
apt-get upgrade

11) Install the basic tools for the VMWare tools to compile:

apt-get install gcc
apt-get install make

12) Find out the kernel version: uname -a
in my case:

root@zenlbapp:~# uname -a
Linux zenlbapp 2.6.32-5-686 #1 SMP Mon Oct 3 04:15:24 UTC 2011 i686 GNU/Linux

Install the corresponding Kernel headers:

apt-get install linux-headers-2.6.32-5-686

13) We are ready: goto the base VMware tools directory, in my case:

cd ~/vmware-tools-distrib/

14) Compile and install the tools:


15) Reboot.

Because the Zen LoadBalancer does not have X11 installed, the only way the manipulate the vmware tools is through the vmware-toolbox-cmd command.

Vmware ESX(i) Server with off-the-shelf components

VMWare’s ESXi server can be used for free for stand-alone servers. The problem is that the HAL list is pretty much defined for server room servers like HP, IBM, DELL and so on.

So what if I want to use off-the-shelf coumputer components? Not too much information around for this. so here it is my working setup:

  • ASUS P6T motherboard
  • I7 920 CPU
  • Two 1TB Samsung F3 SATA harddisks
  • 12GB of GSKILL memory
  • Corsair TX650W
  • ASUS EN210 graphic board
  • Antec 300 case
  • INTEL 82574L 10/100/1000 PCI-E network card

The most important of all is the INTEL 82574L 10/100/1000 PCI-E network card. This is essential, because ESX will only support this network card, not the builtin motherboard card.

The setup also has an LG drive, but for some reason it wouldn’t boot up from there even a Knoopix CD, drive problem?

So I’ve download the ESXi server from the VMWare’s site and using Ubuntu’s unetbootin built a bootable USB flash drive with the latest ESXi release.

But before installing I made the following changes to the P6T BIOS:

  • SATA mode using AHCI mode. This is important for using the SATA harddisk at full potencial
  • Power on after power failure. It will boot automatically if power fails.
  • Set the correct date and time
  • Set the priority boot devices as removable media first, hardisk second, so I can boot from USB flash drive at installation phase.

Booting up from the USB flash drive was fast, and installation went without any problems.

After instalation, I’ve just changed the following parameters:

  • Root password
  • Fixed IP defined instead of using DHCP
  • System Name

From a client machine accessing http://vmesxserver_ip, shows the initial page where the administration vsphere client can be downloaded and installed. Windows only…

To move VMWare’s workstation files to the server from the Workstation or Server product you must use the VMWare converter product. Uploading files and adding to the inventory will not work.

So download VMWare converter (Linux version available), and install the server and the client. From there you can upload your vm machines. If not when starting up the machines an error like this: Failed to open disk scsi0:0 Unsupported and/or invalid disk type 7. Did you forget to import the disk first ? will crop up.

EDIT: DO NOT BUY LG cd/dvd drives. These drives can be shipped with an adware/fishware/whatever software named bluebirds , bluebirds.exe that will appear in all your Windows Virtual Machines… Stay away from these drives. You will need to flash them to get rid of this crapware that is installed without your knowledge or authorization. I should have spend 5 more euros and bought an Asus drive. The problem booting the server with the ESXi cdrom was probably due to this issue….

This means that I will not ever again will buy anything from LG. Nice move.

VMware and host computer slow

Vmware can be configured to use all physical memory for VM’s or it can swap part or all of the memory needed to run them.

After upgrading to Karmic Koala and VMware 6.5.3, after 10/15 minutes of using the virtual machines, my work laptop computer (an HP nx9420) would grind to an halt as the internal disk was fully active. The Linux top command show some serious activity on the kswapd daemon, and the load average just jumped to above 8/9.

In practice the swapping made my laptop useless and sometimes had to pull the plug on the VM’s (!!!).  The HP NX9420 has an old chip set, I believe 945M so it can’t support 4GB of memory, and only shows around 3.3GB of RAM available despite having 4GB installed.

So the solution? Just run vmware as root: sudo vmware and change the Settings->Memory, to not allow any memory to be swapped. The number of virtual machines that can be run now must fit to the memory value defined in this tab, but at least there is no swap activity and machines run at full speed.

Vmware 6.5.3 on Karmic Koala

Installing: At least these instructions worked for me:

#sudo bash
#chmod +x VMware-Workstation-6.5.3-185404.x86_64.bundle
# vmware-modconfig --console --install-all

Voilá, installed Vmware without any issue. I’ve compiled the modules after installation because there are reports that it may hang by using the installer. Not sure, because I didn’t tried it. All VM Machines appear to be working.
Now for the other issues:

After upgrading from Kubuntu 9.04 to 9.10, I needed to upgrade to Vmware Workstation 6.5.3 as is the subject of this post… My previous version was 6.5.0. With this upgrade some older issues where back and new issues appeared…

– Keyboard mapping where again all wrong, with my Portuguese keyboard wrongly configured and some keys wouldn’t just work.

– The other annoying issue was the grab/ungrab mouse cursor problem. Kubuntu task bar area and the floating vmware toolbar area where unusable when the VM machines are in full screen. So for example the Windows task bar is, when the machine is full screen, at the same screen area than the KDE taskbar. The cursor on this area just flickered away like mad, and it was pretty difficult to do anything on this area. This also mean that Windows taskbar and systray where almost unusable and unacessible, and just couldn’t do anything on this area. The temporary workaround was to use machines not in full screen…
The solutions:
For the keyboard problem, on my home directory, just went to .vmware hidden directory (create one if it doesn’t exist) and add the following to the file named config:

xkeymap.nokeycodeMap = true
xkeymap.keycode.61 = 0x035
xkeymap.keycode.61 = 0x5f
xkeymap.keycode.47 = 0x027
xkeymap.keycode.47 = 0xc7
xkeymap.keycode.48 = 0x028
xkeymap.keycode.48 = 0xaa
xkeymap.keycode.51 = 0x02b
xkeymap.keycode.51 = 0xfe52
xkeymap.keycode.34 = 0x01a # +
xkeymap.keycode.34 = 0x2a # *
xkeymap.keycode.35 = 0x01b # ´
xkeymap.keycode.35 = 0xfe50 # `
xkeymap.keycode.20 = 0x00c # ‘
xkeymap.keycode.20 = 0x3f # ?
xkeymap.keycode.21 = 0xab # «
xkeymap.keycode.21 = 0xbb # »
xkeymap.keycode.49 = 0x029 # \
xkeymap.keycode.49 = 0x056 # |

xkeymap.keycode.108 = 0x138 # Alt_R
xkeymap.keycode.106 = 0x135 # KP_Divide
xkeymap.keycode.104 = 0x11c # KP_Enter
xkeymap.keycode.111 = 0x148 # Up
xkeymap.keycode.116 = 0x150 # Down
xkeymap.keycode.113 = 0x14b # Left
xkeymap.keycode.114 = 0x14d # Right
xkeymap.keycode.105 = 0x11d # Control_R
xkeymap.keycode.118 = 0x152 # Insert
xkeymap.keycode.119 = 0x153 # Delete
xkeymap.keycode.110 = 0x147 # Home
xkeymap.keycode.115 = 0x14f # End
xkeymap.keycode.112 = 0x149 # Prior
xkeymap.keycode.117 = 0x151 # Next
xkeymap.keycode.78 = 0x46 # Scroll_Lock
xkeymap.keycode.127 = 0x100 # Pause
xkeymap.keycode.133 = 0x15b # Meta_L
xkeymap.keycode.134 = 0x15c # Meta_R
xkeymap.keycode.135 = 0x15d # Menu

Now if you copy and past the above content, just make sure that x is an ‘x’ letter, because WordPress may change it to something else that looks like an x but it isn’t. If you don’t due this, when you press a mapped key on VMware, you will get a popup window with an error complaining about a key code.
For the mouse issue, it looks like that the solution is this:
Temporary fix (solution from http://communities.vmware.com/thread/240766):

Open a shell window and start vmware from it with as follow:


#export LD_PRELOAD=/lib/libglib-2.0.so.0


It seems that to make the first two lines permanent, you just, as root, edit the following file: /etc/vmware/bootstrap and add the first to lines to the end of the file.
I hope that all issues are covered now….

NTFS-3G, Vmware and 100% CPU

NTFS-3G can consume 100%CPU when a virtual machine is running on an NTFS partition and/or external disk (my case).

With this issue, using Vmware and using a VM machine can be a slow experience when doing high IO operations inside the VM machine. For example trying to uncompress a large zip file on the VM machine, just makes the host 100% CPU on the NTFS-3g process.

To solve this issue, just shutdown the VM machine and add the following line to the vmx file with your favorite text editor:

mainMem.useNamedFile = “FALSE”

Problem solved.

VMware machines – Extending disk size and boot to bios

To extend a virtual machine disk size, you have to follow this simple steps:

1) Make sure that all snapshots are deleted.

2) Take note of the filename which the disk you want to extend is using

3) Got to a command session (DOS or BASH), and execute the command: vmware-vdiskmanager -x 10Gb diskfile.vmdk where 10Gb is the new disk size. change it to the value that you want.

4) Let it run.

At the end you need to extend the partition so the operating system knows about the new space. If you don’t do this you need to create a new drive/mount point on the operating system.

Just donwload the latest ISO for Gparted live image, and make sure that the Vmware machine CD-Drive boots with this ISO.

Now you need to boot the VMware machine, but using the CD. The problem is normally the BIOS boot screen is too fast to stop and select the CD-ROM as the boot device.

You can do it in two different ways:

1) Add the following line to the machine VMX file at the end, so you can delete it later:  bios.bootDelay = “5000” This will delay the boot long enough so you can press ESCape and choose the CD as the boot device

2) Second you can boot directly to bios by adding the key:  bios.forceSetupOnce = "TRUE"

On this last option after booting the key will revert to false, and so the next boot will be normal.

After booting into Gparted, just increase the size of the partition, and don’t forget to choose apply.

[K]Ubuntu – Vmware server console only starts as root

If Vmware console seems to die if running as the normal [K]Ubuntu user it might be a permission issue on the vmware preferences file.

Just open a shell on your home directory and change directory to .vmware (note there is a . at the beginning).

Check the owner and group of the preferences file. If it’s not belong to your user, just run the command sudo chown user:group preferences where user and group is your user and group.

Running VMWare machines from NTFS filesystems on KUbuntu

I’ve tried to start a virtual machine using VMWare Server from an attached external disk that was formatted with NTFS.

Well it didn’t work. The Vmware server console just tried to start the machine and almost right away went back again to the original status. The machines didn’t start.

Looking at the vmware logs at /var/logs/vmware, it seems that the vmware server was complaining from the following error: VMware Server unrecoverable error: (vcpu-0) Failed to allocate page for guest RAM!

After a quick Google search, I hit this: http://www.desktop-virtualization.com/2008/03/31/failed-to-allocate-page-for-guest-ram/

So all you need to do is to go to your virtual machine directory and edit the .vmx file. Add the following line to end of it: mainmem.UseNamedFile = “FALSE”

Save the file, and it should work. This is only needed if you’re running your virtual machines in KUbuntu from a NTFS file system