Debian Squeeze (6.0) Xen 4.0.1 VM Server with HVM on LV

Installing Xen 4.0.1 onto Debian Squeeze has been a huge issue for me.  Mostly, I ran into problems because I’m a xen novice and really didn’t understand the ins and outs of the xen packages, but also because installing and manipulating xen in Lenny was so easy and manipulating xen in Squeeze was….

  1. I installed my Debian Squeeze base (aka. Dom0) in the normal fashion.  I ended up combining the instructions I found at this webdevster link, and this howtoforge link .  The webdevster link was very useful for general install pearls (aka. gotchas), but I elected to ignore the vnc and static ip address sections.  I wanted a gnome desktop w/ vnc and I also needed dhcp instead of a statically assigned ip address (my dd-wrt router assigns the static ip addresses).  Finally, I wanted to install at least one windows 7 HVM, and the network bridge example in the webdevster tutorial never worked for my windows host (see my solution below).
  2. The webdevster link shows how to install a VM onto a logical volume, but if you really want to understand how LVM and logical volumes work, this howtoforge link is fantastic.
  3. For windows specific Xen HVM instructions I found this howtoforge tutorial.  This xen HVM tutorial is for Debian Lenny (i.e. not Squeeze), but it does document the process of creating a windows install disk iso, and its respective xen configuration.
  4. The default network script is a huge issue for an automated install:  I finally found some help on this page. Apparently, the network-script that gets used by the xend-config.sxp file to create a bridge for use by the virtual interfaces that get created when you build a virtual machine leaves much to be desired.  The big issue that I had was that I could install a HVM virtual machine (VM), but the VM could only communicate with the host server (i.e. Dom0).  It was really strange, but thankfully some xen guru knew about this issue and just created their own network bridge (i.e. they didn’t rely on the “network-script” located in your /etc/xen/scripts folder. (Of note: others seem to be having the same issues. See: xen-users list-serve )  Creating a network bridge is really pretty easy as it only requires a few lines in your /etc/network/interfaces file.   Below is the “interfaces” file I’m currently using.
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    #allow-hotplug eth0
    #auto eth0
    #iface eth0 inet dhcp
    #Added by EBJ 2/27/2011
    auto xen-br0
    #iface xen-br0 inet static
    iface xen-br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

    Notice that I have commented out the static ip sections. I use dd-wrt to assign my ip addresses according to mac addresses so I like have non-static ips. Still the “ServerFault” example I found used static ip addresses.

  5. Comment out “network-script line in /etc/xen/xend-config.sxp file and include your bridge name (e.g. xen-br0) in the /etc/xen/xend-config.sxp “vif script”
  6. #added by EBJ 2/28/11
    (xend-http-server yes)
    #(xend-unix-server no)
    #added by EBJ
    (xend-unix-server yes)
    #added by EBJ
    (vif-script vif-bridge bridge=xen-br0)
    #added by EBJ
    #(network-script 'network-bridge antispoof=yes' )
    (dom0-min-mem 196)
    (enable-dom0-ballooning yes)
    (total_available_memory 0)
    (dom0-cpus 0)
    (vnc-listen '')
    (vncpasswd 'somePassword or empty string')
  7. The xen configuration file I ended up using is below:
  8. import os, re
    arch = os.uname()[4]
    kernel = "/usr/lib/xen-default/boot/hvmloader"
    memory = 1024
    shadow_memory = 8
    name = "xenwin7lv"
    vif=['type=ioemu, bridge=xen-br0,  mac=00:16:3e:00:00:01' ]
    # The number of cpus guest platform has, default=1
    # for a LVM use the location of your LV
    disk = [ 'phy:/dev/xen4lvg/win7lv,ioemu:hda,w', 'file:/RAID1A/xen/windows7.iso,ioemu:hdc:cdrom,r' ]
    #device_model = '/usr/lib/xen-default/bin/qemu-dm'
    device_model = '/usr/lib64/xen-4.0/bin/qemu-dm'
    # boot on floppy (a), hard disk (c) or CD-ROM (d)
    # default: hard disk, cd-rom, floppy
  9. TODO add VM creation/maniup instructions
Posted in 64 bit, Debian, Linux, networking, Squeeze, Uncategorized, Virtualization, Windows, Xen | 1 Comment

Debugging Java Heap Space Errors

Memory leaks are a pain. If you’re like me, the first thing you did when your application threw a “Java Heap Space Error” exception, was to increase your java virtual machine’s heap space parameters. There are a number of reasons why you should probably avoid doing this (worth googling), but nonetheless I tried this and it didn’t work (just prolonged the time to failure and slowed my application down).  After much googling, I learned that heap space errors should really not occur unless you’ve screwed up somewhere in your code. In my case, I had just finished creating a testing application which used a colleagues terminology service (I program health IT apps), and because my tester ran for a few days in duration, any small memory leak became a big one. To diagnose the cause of the memory leak(s) I spent a lot of time researching java memory analyzing tools (most were really expensive), but it was the FREE Java Visual VM tool that finally helped me solve my problem. The Java Visual VM application (i.e. the jvisualvm.exe executable stored in your java sdk’s installations bin folder) allows you to track applications resource utilization, and also take memory snapshots (aka. memory dumps) while your application is running. You can then drill down into your application and figure out which objects are taking up the most space. Usually, the objects/classes that are taking up the most space are the cause of your memory leak. My issue ended up being due to my colleagues code not closing db connections and prepared statement (a common cause of memory leaks in Java).  So after fixing my colleague’s code, my tester was running faster, and most importantly, it didn’t crash.


Posted in Java, Programming, Uncategorized | Tagged , , | Leave a comment

Installing Debian Lenny/Squeeze on GA-MA78G-DS3H

For some reason while using the net install (unetbootin) procedure to install debian lenny/squeeze via a usb drive onto my Gigabyte GA-MA78G-DS3H motherboard, the boot record couldn’t seem to be found by the BIOS (error message was “Missing Operating System”).  I was sure I had partitioned my boot drive correctly, and I was equally sure that I had set the debian drive as the first HDD to boot in BIOS. Still the same error message. Finally, after installing and reinstalling onto multiple HDDs, I realized that Grub (which controls the Master Boot Record, MBR) was setting my MBR to hd0.  I was pretty sure hd0 was not the drive I wanted to boot from (all my drives are attached to the SCSI controllers and thus begin with a “s”) and so it seemed I needed to address the MBR issue.  It had been a while since I had messed with GRUB so I did a quick goggle search and found the SUPER GRUB DISK utility (also installed via unetbootin onto a usb flash drive).  I booted from by usb flash drive (containing SUPER GRUB DISK) and chose the “Auto” option.  The application quickly found my lost debian operating system and gave it’s disk the correct MBR.  I’m still not sure why the default installation created an incorrect MBR, but I’m guessing some linux guru out there knows the answer.

Anyway, hopefully, someone else out there who is trying to build a linux machine w/ the GA-MA78G-DS3H mb will read this and it will save them some time.

Update:  Turns out the above description only worked because the super-grub disk was acting as my system’s grub proxy.  As soon as I removed the super-grub disk usb flash drive, the system displayed the “Missing Operating System” message again.  I then learned about three new issues based on some additional MBR/grub research:

  1. This mother board can not boot from its non SATA HDDs in AHCI mode (hence hd0 boot errors).  For some reason there is no way to set your system to boot from an old IDE HDD in bios even though your OS can mount a non-SATA HDD after starting up.
  2. If you get either the “Missing Operating System” message or the stall at “VMI Pooling” message, check that you installed a master boot record on the HDD you wish to boot from. When installing debian onto a machine which had a previous OS on it (windows) a dialog box asked if I wanted to install Grub.  I selected yes, but this just installed a new OS boot option on my previous HDDs MBR/grub bootloader.  If you’re not planning on using both OSs, just choose to install a fresh grub/MBR bootloader on your new HDD (i.e. the HDD that your old OS isn’t on).
  3. For some odd reason I needed to set my bios to boot from the “bootable add on card” even though I chose to install the MBR onto a SATA HDD which was directly attached to my motherboard.  I had the option of selecting this SATA HDD in bios as the 1st boot device, but I needed to select the “bootable add on card” for the system to boot correctly.  I’m still unsure why this is the case. Of note: I removed every add on card attached to my machine to test if any of these cards could be causing the issue.  No resolution was obtained.

Finally, after resolving my many boot issues, the installer did not install any of the desktop libraries (e.g. gnome) needed for a graphical display.  In an attempt to resolve this issue I reinstalled the Debian Squeeze OS three times.  Each reinstall I made sure to select the “desktop” radio button when prompted with my installation options.  This issue was resolved by using the command “aptitude install gnome,” following installation, and then starting up the desktop display with the command “gdm3.”  I’m not quite sure why the gui/desktop libraries were not installed using the Debian installer DVD, but I did notice there were issues with my KVM switch that simultaneously occurred during package download  problems.  For some reason, I needed to keep my KVM focus on the Debian machine in order to download packages successfully.

I used this computer Hope site and this Grub site to help diagnose my issues.


Posted in 64 bit, Debian, GRUB, Lenny, Linux, Squeeze | Tagged | Leave a comment