RVL VMware HOWTO

Jump to topics in this page:


Which hosts are VMware hosts?


Installing VMware


VMware is already installed! However, as a reference:


Where are the VMware components on the host OS?


Note that we have GSX Version 3.1 Server, and there are three components:


Monitoring VMware virtual machines with the graphical interface

Note -- not working yet!



How are the guests configured for networking?



How are the guests configured for user accounts and file systems?



How can I create a new virtual machine?


The following is a brute-force method, which takes advantage of the assumption that an existing machine is the product of a lot of careful configuration work. It assumes that two machines have been created, and we are making the third. And of course, all this must be done on the host OS!

First, clone the filesystem images and do some reconfiguration:

  1. Create a new directory:
    # cd /var/lib/vmware/Virtual\ Machines
    # mkdir "Virtual 03"
  2. Copy the files over. The following scripting trickery changes filename components as needed. Change the "01" and "03" as needed, and watch the direction of those quote marks!
    # for F in Virtual\ 01/*
    > do
    >    cp -av "$F" "`echo $F | sed 's/Virtual 01/Virtual 03/g'`"
    > done
    Be patient, this will take a while...
  3. Change the first of two files that specify the disk images:
    # cd Virtual\ 03
    # vi Virtual\ 03.vmdk
    Globally change "Virtual 01" to "Virtual 03" by typing:
    :%s/Virtual 01/Virtual 03/g
    Save your changes and exit the editor.
  4. Now edit the other file:
    # vi Virtual\ 03.vmx
    Globally change "Virtual 01" to "Virtual 03" by typing:
    :%s/Virtual 01/Virtual 03/g
  5. Delete the write-lock file, if it exists:
    # rm Virtual\ 03.vmdk.WRITELOCK
  6. Edit the file /etc/vmware/vm-list to add the obviously needed line:
    config "/var/lib/vmware/Virtual Machines/Virtual 03/Virtual 03.vmx"

Now, bring up the new machine to single-user mode only:

  1. Go to the console of the host OS. If it is not in graphical mode, first login as root and run:
    # init 5
  2. Login under X using your personal account.
  3. Become root:
    $ su
  4. Run VMware as root. Be patient, it will take several seconds for the graphical interface to appear!
    # vmware &
  5. When you get the "Connect to host" window, make sure that the "Local host" button is selected, then click "OK".
  6. You will see the virtual machine you just created at the end of the list in the inventory in the left-most pane (click the "Show/Hide Inventory" button if needed). It will have a name that is a duplicate of a name above. Right-click that last entry, select "Rename", and give it the appropriate name.
  7. Click Start this virtual machine, and agree to "Create a new identifier".
  8. When the VM starts to boot, you must quickly click within the black console window (to get focus inside that window), and then be ready to hit the down and up arrow keys when the LILO screen appears, so the system does not boot in the normal way.
  9. Tell LILO to boot into single-user mode:
    linux S
  10. It will boot into single-user mode, so you are root on the console. You will be editing a couple of files, ignore the warning about being unable to write to $HOME.
  11. Edit /etc/sysconfig/network and change this line:
    HOSTNAME=oldname.ecn.purdue.edu
  12. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and change this line:
    IPADDR=128.46.144.123
  13. Shut it down cleanly with halt so all file system changes are flushed to the virtual disk. It will be ready for starting from the web-based administrative interface.

Starting the new machine

  1. You should be able to start the new machine with the graphical interface, see above
  2. Alternatively, careful reading of /etc/init.d/vmware revealed that if you correctly made the change to /etc/vmware/vm-list, then the new machine should be started by the vmware-serverd daemon. Send it a kill signal, forcing it to restart:
    # killall vmware-serverd
    Have patience, it may take up to three minutes to start the process of booting each guest. You could investigate what's running with this:
    # ps axuw | grep vmware-vmx
  3. Finally, here is a really brute-force way of getting a virtual machine up and running. Again, change the "03" as needed:
    # /usr/lib/vmware/bin/vmware-vmx \
            -C /var/lib/vmware/Virtual\ Machines/Virtual\ 03/Virtual\ 03.vmx -@ "" &

What to do after rebooting the host OS?


When Mandrake boots, it re-creates /boot/kernel.h, which normally is a very good thing. However, it makes VMware believe that it has not yet been configured under this kernel, even though it is likely the very same kernel that was running before the last shutdown. This means that the guest machines probably will not come up after a reboot of the host OS without manual intervention -- probably not that big of a deal because the host OS should not need frequent rebooting. To work around this issue:

  1. First verify that no guest machines are running -- if you do see the expected set of guest OS processes, do nothing!
    # ps axuw | egrep 'PID|vmware-vmx'
  2. Make sure that the VMware software is really shut down. First, stop the VMware services with the boot script:
    # /etc/init.d/vmware stop
  3. You will likely find that some process survives the shutdown, probably vmware-serverd -- shut down any surviving processing, changing vmware-serverd as needed in the following:
    # ps axuw | egrep 'PID|vmware'
    # pkill -TERM vmware-serverd
    # pkill -KILL vmware-serverd
  4. Reconfigure VMware for operation under the "new" kernel. You should be able to simply agree with all the choices, but do make sure that it builds and loads the kernel modules as needed:
    # vmware-config.pl
  5. At this point you should find that VMware has been started, but check with the following command and use the boot script if needed:
    # ps axuw | egrep 'PID|vmware-vmx'
  6. The guest machines will come up one at a time, a new one starting every three minutes in the reverse of the order they're listed in /etc/vmware/vm-list. While you're waiting, you could type the following at a shell prompt to monitor their process:
    # while true
    > do
    >     clear
    >     uptime
    >     ps axuw | egrep 'PID|vmware-vmx | grep -v grep
    >     sleep 10
    > done


What to do if the virtual machine processes die?


One alternative is to re-start one machine with the above command. But that's not really the best way if it's a general die-off....

To really shutdown down all of them cleanly and restart, at least until I get the vmware-mui interface running correctly:

  1. Shut down all the running machines:
    # for I in 1 2 3 4 5 6 7 8
    > do
    >    ssh 128.46.144.21${I} halt
    > done
  2. Make sure the VMware daemons are shut down:
    # /etc/init.d/vmware stop
  3. Note that the above will not kill off all the VMware processes, I think this is due to differences between the expected boot scripts and those found on Mandrake 10.X. So make sure:
    # pkill -TERM vmware-serverd
    # pkill -KILL vmware-serverd
    # ps axuw | grep vm
    You should see nothing here.
  4. There may be a bunch of lock files left laying around, get rid of them now if needed. Be careful with the last two commands!
    # cd /var/run/vmware
    # rm %2f*
    # rm serverd-rendezvous
    # rm vmware%2dserverd
    # rm -r root/*
    # rm -r httpd/*
  5. OK, now you should be ready to restart the VMware daemons:
    # /etc/init.d/vmware start
  6. Now you need to be very patient. There should be a process vmware-serverd which will have read the file /etc/vmware/vm-list and will be starting the specified virtual machines. However, it will only start one every three minutes, to keep from overwhelming the host OS by trying to start all the daemons and all the guest operating systems simultaneously. Give it about five minutes, and see if any are running:
    # ps axuw | grep vmx
  7. Now wait another three to five minutes and look again:
    # ps axuw | grep vmx
  8. You should see the virtual machines starting, in the reverse of the order that they're listed in /etc/vmware/vm-list. If so, good, just continue to be patient! If not, well, go back to the first step...

Another trick for general troubleshooting is to use top to watch the running virtual machine emulators, the processes running the command vmware-vmx. Here's a useful trick:

  1. Find the list of numeric PID's:
    # ps axuw | grep vmware-vmx
  2. Now ask for just those PID's, changing the numeric PID's as needed in the following:
    # top -p 22824,22865,22907,22948,23010,23049,23093,23102

How big of a compute load is all of this?



How can I find out even more?