My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
QemuSetup  
QEMU host setup for testing LACK
Updated Jan 24, 2012

Back to the MainPage...

QEMU Linux Host Setup

Notes on things you can set up in QEMU Linux hosts in order to help with development/testing of LACK.

Booting the installer

Install the OS. If you're using Debian, you can boot into serial console mode with console=ttyS0,9600n8. If you do install via serial console, the installed system will be set up to run via serial console only, you'll have to turn on normal consoles yourself after the install is completed.

Installing

You can also check the lack build in the Mercurial source, as there's a bunch of QEMU-specific files saved in there.

  1. As you're running the installer, when you start partitioning the hard drive, perform a Manual partition, then:
    1. add the small /boot partition (formatted as ext2), with the rest of the drive being given to LVM
    2. or, use Guided partitioning on the whole drive, no LVM
    3. Make sure you add a label to each partition as well
  2. Add the following user accounts:
    1. user root (you only need to set the password)
    2. user lack, password of lack
  3. Unselect the Desktop and Standard tasks when the task selection screen comes up
  4. When the machine reboots, log in as root
  5. Adjust /etc/apt/sources.list so that the CD-ROM install disc is no longer a source
  6. Install the following packages: sudo linuxlogo vim console-tools ssh cvs screen less bzip2 zip unzip mercurial
  7. For XWindows, install the following: xserver-xorg fluxbox gnome-terminal gdm libgtk2-perl gtk2-engines-pixbuf gtk2-engines-nodoka gtk2-engines-cleanice gtk2-engines-magicchicken gtk2-engines-murrine gtk2-engines-qtcurve gtk2-engines-wonderland gtk2-engines-xfce gtk2-engines gtk2-engines-sapwood gtk-smooth-themes gtk-chtheme
  8. For filesharing, install: nfs-kernel-server samba smbclient
  9. Run aptitude update; aptitude upgrade to bring the already installed packages up-to-date
  10. There may be an 'orphan' package called linux-image-2.6-686 left over from the upgrade; use dpkg -P to remove it
  11. Download the rcfiles tarball and place it in the /home directory so that multiple users can unpack it
  12. Move the lode-1at1u-16 font to /usr/share/consolefonts
  13. Edit /etc/console-tools/config and add that font at the bottom of that file
  14. Move the splashscreen image to /boot/grub
  15. Edit /boot/grub/menu.lst and add splashimage=(hd0,0)/grub/splash.xpm.gz
  16. In /etc/initttab:
    1. Enable console or serial port logins by uncommenting the ttyS0 getty line
  17. Add custom linux_logo.conf file to /etc, then run /etc/init.d/linuxlogo restart
    1. Add linuxlogo to all of the rest of the tty's (yank 5 words)
  18. Symlink /boot/grub to /etc/grub
  19. If you want grub to work over the serial port, add the following lines to the very top of /boot/grub/menu.lst
  20. serial --unit=0 --speed=9600 --word=8 -parity=no --stop=1
    terminal serial console
    splashimage=(hd0,0)/grub/splash.xpm.gz
  21. In the kopt line of grub's menu.lst, change console to console=ttyS0,9600 console=tty0, i.e. you add the second console line to make kernel boot messages appear both on the virtual console and the serial port
  22. Copy .bashrc, .vimrc, .dir_colors and .ssh/ from root's home directory to the user's home directory.
  23. Use visudo to add the demo user to the /etc/sudoers file

Using vmbuilder to create an image

sudo vmbuilder kvm ubuntu --user=lack --pass=kcal --suite=lucid \
--arch=i386 --libvirt qemu:///system --mem=1024 --rootsize=20000 
--swapsize=2048 --addpkg=openssh-server --addpkg=wget \
--dest=/local/kvm/kernel-builder --hostname=kernel-builder \
--cpus 6 --tmpfs=-

Mounting qcow2 disk images to the host

From http://wiki.debian.org/QEMU#qcow2 and http://tjworld.net/wiki/Linux/MountQemuQcowImages

sudo modprobe nbd
sudo qemu-nbd -c /dev/nbd0 disk1.qcow2
sudo fdisk -l /dev/nbd0
sudo mount -t ext2 /dev/nbd0p1 /mnt/nbd/

Creating a virtual block device with the FAT filesystem

 -hdb fat:/path/to/your/content

There's some notes on the QEMU docs page about not changing the contents of the directory shared while it's being shared. You can also add that there's a size limit to the directory, it must be smaller than 650 megs or so.

Running QEMU using the Graphical interface

To switch to the different QEMU screens, use Ctrl-Alt-[1-3] 1 is the virtual console on the machine 2 is the QEMU monitor 3 is a serial port, /dev/ttyS0

QEMU commands

Run a CD-ROM ISO image, GUS and SB16 soundcards, pcnet32 network card driver, with the filename of the ISO set in $1

/usr/local/bin/qemu \
    -m 256 \
    -name cdrom-demo \
    -pidfile qemu.pid \
    -serial telnet::4444,server,nowait \
    -monitor stdio \
    -boot d \
    -localtime \
    -soundhw sb16,gus \
    -redir tcp:28022::22 \
    -redir tcp:28000::8000 \
    -redir tcp:28200::4200 \
    -parallel none \
    -net nic,model=pcnet \
    -cdrom $1 \
    -usb

Run a disk image with VNC set as the viewer:

/usr/local/bin/qemu \
    -m 256 \
    -name lenny-base \
    -localtime \
    -monitor stdio \
    -vga std \
    -boot d \
    -pidfile $PIDFILE \
    -redir tcp:12022::22 \
    -vnc :1 \
    -usbdevice tablet \
    -cdrom \
    /local/mnt/sourcecode/ISOs/debian-505-i386-netinst.iso \
    -hda disk1.qcow2

Powered by Google Project Hosting