Introduction
- Using Ubuntu Karmic Koala 9.10 as host.
- Using 32 bit kernel, so limiting guests to 32 bit kernels and 2GB ram.
- Will be using bridge support on host.
KVM Guest configuration
- The configuration of the guests are defined by xml files stored in /etc/libvirt/qemu/.
- The xml file is defined in detail here: http://libvirt.org/formatdomain.html
- The define or create commands imports the xml file into virsh.
- The xml files can be generated by virsh or ubuntu-vm-builder or edited manually.
Creating a guest with virt-install
Create a sparse disk image
- Create a disk image for the root install:
Running virt-install
- Run virt-install for ubuntu guest:
- For OpenBSD guest:
Connecting over VNC
- Check the vnc port in virsh:
- The output will be the vnc port number to connect to on the host server.
- Use ssh to tunnel into the server and make the vnc port available locally.
- If the output from vncdisplay was :0:
- If the output from vncdisplay was :4:
- Use Chicken of the VNC on OS X or RealVNV VNC Viewer Free Edition on Windows.
| Port 5910 is used to avoid collision with Screen Sharing on OS X. If not using OS X (or not running a local VNC server), port 5900 is safe to use. |
- Using Chicken of the VNC, don't specify the full port only the display.
| Eg for 5910 on OS X, use host: localhost and display 10 |
- Once connected over vnc, install as normal.
| Occasionally the Ubuntu install would hang on the at about 43% Scanning disks... partitioning screen and reboot was required.
No clear reason why this was happening and it was happening inconsistently. |
- Reference:
https://help.ubuntu.com/community/KVM/CreateGuests
http://scie.nti.st/2009/10/4/running-openbsd-4-5-in-kvm-on-ubuntu-linux-9-04
Updates to virsh xml
- These should not be necessary, but can be useful if cloning guests.
- Change interface to:
- To generate a new mac address:
- To generate a new UUID number:
- Remove any graphics reference
- Remove any input mouse references:
- Add device:
Finish Ubuntu guest install
- To have ubuntu guest respond to the shutdown command, install apcid:
- Run updates, upgrade and dist-upgrade:
- Setup static ip address, instructions.
- Install the grub serial and console code.
Grub 2 - setting up serial console
- The following is the complete replacement for the grub file.
- On guest run:
- Update grub with the new settings:
- Ubuntu already has ttyS0 in /etc/securetty.
- Setup ttyS0 to start:
- Content should be:
- Reference:
http://linux.xvx.cz/188/debian-with-grub2-and-serial-connection/
https://wiki.ubuntu.com/Grub2
http://ubuntuforums.org/showthread.php?t=1341462
Finish OpenBSD guest install
Disable mpbios
First boot
- After installation, reboot the guest vm and quickly reconnect the vnc client.
- At the boot> prompt type:
- If the guest vm has already started to boot it will hand and you will have to use virsh to destroy the vm.
Configure kernel
- The change made during boot will no persist, editing the kernel config is required.
- Login as root and type:
Networking
- There are recommendations to change the network card type to e1000 to avoid hang ups and performance problems.
- Using --os-variant openbsd4 in the virt-install resulted in the following config:
- The code was updated to:
Labels:
None
