Installing Xen on NetBSD-5 on VMWare Player

July 26th, 2009

I gave up installing Xen since I can’t find any vmx|svm flags on my debian’s /proc/cpuinfo and/or since I have been unable to make Xen to work on it. The last installation hanged at booting domO process. I can’t remember what the error messages were.

Then I found this awesome page about netbsd/xen.  Combining the info from this page with some trial and error processes of getting the configuration files right, I finally managed to get NetBSD dom0 and domU running.

Installing dom0

  1. Install NetBSD-5 to vmware player as usual (use www.easyvmx.com to get vmplayer config and virtual disks)
  2. Install the followings using pkg_add:
    sysutils/grub
    sysutils/xentools3
    sysutils/xenkernel3
    sysutils/e2fsprogs
  3. cp /usr/pkg/share/examples/rc.d/xen* /etc/rc.d
  4. vi /etc/rc.conf
    xend=YES
    xenbackendd=YES
    xendomains=YES
  5. cd /dev
    sh MAKEDEV xen
  6. Get “netbsd-XEN3_DOM0.gz” from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
  7. Backup original netbsd kernel
    cp /netbsd /netbsd.old
  8. gunzip netbsd-XEN3_DOM0.gz
    mv netbsd-XEN3_DOM0 /netbsd
  9. cp /usr/pkg/xen3-kernel/xen.gz /
    cd /
    gunzip xen.gz
  10. mkdir /grub
    vi /grub/menu.lst
    default=0
    timeout=5
    title XEN3
    root(hd0,0)
    kernel (hd0,a)/xen dom0_mem=128M
    module (hd0,a)/netbsd bootdev=wd0a ro console=pc
    title NetBSD
    root (hd0,0,a)
    kernel /netbsd.old
  11. grub-install ‘(hd0)’
  12. grub –no-floppy
    root (hd0,a)
    setup (hd0)
    quit
  13. vi /etc/ifconfig.bridge0
    create
    !brconfig $int add pcn0 up    # replace pcn0 with your shared network interface.
  14. cd /dev
    sh MAKEDEV all
    sh MAKEDEV xen
  15. shutdown -r now

Installing self-made domU

  1. You need to mount the NetBSD-5 installation cd
    mkdir /mnt/cdrom
    mount /dev/cd0a /mnt/cdrom
  2. Make a directory to contain NetBSD-5 sets
    mkdir /root/lala
  3. Make a directory to contain domU kernel
    mkdir /root/kernels
  4. Get netbsd-XEN3_DOMU.gz from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-5.0/i386/binary/kernel/ or from netbsd installation iso/cdrom.
  5. cp netbsd-XEN3_DOMU.gz /root/kernels
    cd /root/kernels
    gunzip netbsd-XEN3_DOMU.gz
  6. Extract NetBSD sets:
    tar xzpfe /mnt/cdrom/i386/binary/sets/kern-XEN_DOMU… -C /root/lala
    tar xzpfe /mnt/cdrom/i386/binary/sets/base.tgz -C /root/lala
    tar xzpfe /mnt/cdrom/i386/binary/sets/comp.tgz -C /root/lala
    (… and the rest)
  7. cd /root
    makefs -M 1073741824 lala.ffs lala
    (Note. 1G=1073741824 and 2.5G=2684354560)
  8. A flat swap
    dd if=/dev/zero of=lala/swap bs=1024 count=400
  9. mv lala lala.old
    mkdir lala
    vnconfig vnd0 lala.ffs
    mount /dev/vnd0a lala
  10. vi lala/etc/fstab,
    /dev/xbd0a / ffs rw 1 1
    /swap none swap sw 0 0
    kernfs /kern kernfs rw
    procfs /proc procfs rw,noauto
  11. vi /etc/rc.conf
    rc_configured=YES
    hostname=blah
    dhclient=YES
    sshd=YES
    (… etc)
  12. vi /usr/pkg/etc/xen/nbsd
    kernel = “/root/kernels/netbsd_XEN3_DOMU”
    memory = 256
    name = “nbsd”
    vif = [ 'bridge=bridge0' ]
    disk = ['file:/root/lala.fs,0x01,w']
    root = “xbd0″
  13. To make nbsd domain start at boot
    vi /etc/rc.conf
    xendomains=”nbsd”   # edit this line  add your domains separated by space instead of “YES”
  14. shutdown -r now

Now, you should have NetBSD dom0 and domU running at boot. Use “xm list” to list domains and “xm console ID” to access domU console.

I am new to UNIX,  follow above instructions at your own risk.

References:
NetBSD/xen Howto : www.netbsd.org/ports/xen/howto.html
Xen on NetBSD : www.gutch.de/NetBSD/docs/xen.html
http://pbraun.nethence.com/doc/sysutils/xen_netbsd.html


Installing FreeBSD via FTP on VMWare Workstation 6

September 28th, 2008

For me, a UNIX/ Linux newbie, FreeBSD installer is a bit dodgy to use. So I want to share the successful FTP installation steps.

To get FreeBSD, go to http://www.freebsd.org/where.html. I’m using livefs version of FreeBSD ISO.

I created a new VMWare virtal machine with the following settings: NAT networking, 256MB RAM, 8GB HD, and CD-Rom pointing to the downloaded ISO.

Start up the Virtual Machine.

  1. On “Welcome to FreeBSD!” page, press Enter to choose default boot option.
  2. Select your “Country Selection”.
  3. Arriving at “Sysinstall Main Menu”, choose “Standard”.
  4. On “FDISK Partition Editor” page, choose “A” for “Use Entire Disk”, and “Q” to exit.
  5. On “Install Boot Manager” page, choose “BootMgr”.
  6. On “FreeBSD Disklabel Editor”, create 2 labels: 512M for “Swap” and the rest for root (/) “FS”. Press “Q” to exit.
  7. On “Choose Distribution”, choose Minimal and Custom: base, kernels, info, man, ports.
  8. On “Choose Installation Media”, choose “FTP Passive”.
  9. On “FTP distribution site”, choose “URL” and enter the “IP Address” of your nearest FreeBSD distribution site e.g. ftp://210.171.226.46/pub/FreeBSD (for ftp.jp.freebsd.org).
  10. On “Network interface information”, choose “le0″.
  11. Choose “No” for IPv6 configuration.
  12. Choose “No” for DHCP configuration.
  13. Enter your hostname, domain, IPv4 Gateway, Name Server, IPv4 Address, Netmask.

Step number 8, 9, 12, and 13 are critical. I never got the installer working, by choosing other choices on those steps.