When working with KVM virtualization on Ubuntu Oneiric Server (AMD64), you might encounter situations where guests appear to start successfully but fail to provide console output. The typical symptoms include:
- Guest shows as "running" in
virsh list
- Console connection hangs after displaying the escape character message
- Remote connections only show "Booting from Harddisk"
- Intermittent high CPU usage by KVM process
- Inability to perform clean shutdown (requires
destroy
command)
The Ubuntu Oneiric (11.10) era had several known issues with KVM:
# Check your current KVM version
kvm --version
QEMU PC emulator version 0.14.1 (qemu-kvm-0.14.1+noroms), Copyright (c) 2003-2008 Fabrice Bellard
Key potential causes:
- Missing or misconfigured serial console
- Storage driver compatibility issues with qcow2
- ACPI power management conflicts
- Outdated seabios implementation
For the serial console issue, edit your guest XML definition:
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
For storage issues, try converting the image format:
qemu-img convert -f qcow2 -O raw myguest.qcow2 myguest.raw
When standard installation fails, try this manual approach:
virt-install \
--name myguest \
--ram 2048 \
--disk path=/var/lib/libvirt/images/myguest.qcow2,size=12 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntuoneiric \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/oneiric/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Enable full QEMU logging:
# Edit libvirtd.conf
log_level = 1
log_outputs="3:file:/var/log/libvirt/libvirtd.log"
# Restart libvirt
service libvirtd restart
Monitor boot process:
virsh dumpxml myguest | grep 'lt;serial'
tail -f /var/log/libvirt/qemu/myguest.log
The package combination shown has known quirks:
# Recommended alternative packages
sudo apt-get install \
qemu-kvm=0.15.0-1ubuntu4 \
libvirt-bin=0.9.8-2ubuntu1 \
python-libvirt=0.9.8-2ubuntu1 \
virtinst=0.600.0-1ubuntu1
Remember to purge conflicting packages:
sudo apt-get remove --purge qemu-system qemu-user
Before declaring defeat, verify:
# KVM hardware acceleration
kvm-ok
# User permissions
groups | grep libvirt
# Kernel modules
lsmod | grep kvm
When attempting to launch KVM guests on Ubuntu Oneiric Server (64-bit AMD), I encountered a situation where virtual machines would appear to start (showing as "running" in virsh list
) but fail to produce any console output beyond the initial boot message. The key symptoms were:
- Blank console output when connecting via
virsh console
- Only "Booting from Harddisk" message visible in VNC
- Inability to properly shut down guests (requiring
destroy
command) - Occasional 100% CPU usage spikes
First, let's examine the VM configuration more closely. The vmbuilder
command used:
vmbuilder kvm ubuntu \
--suite oneiric --flavour virtual --arch amd64 \
--libvirt qemu:///system \
--ip 192.168.0.100 \
--hostname myguest \
--part vmbuilder.partition \
--user adminUser --name fullname --pass defaultPass \
--addpkg apache2 [...other packages...] \
--mem 2048 \
--bridge br0
And the alternative virt-install
approach:
virt-install \
--connect qemu:///system -n myguest -r 2048 -f myguest.qcow2 \
-s 12 -c ubuntu-11.10-server-amd64.iso --vnc --noautoconsole --os-type linux \
--os-variant ubuntuOneiric --accelerate --network=network:default
To properly diagnose this issue, several verification steps are essential:
- Check the VM XML configuration:
virsh dumpxml myguest
Pay special attention to the console and serial device configuration.
- Verify the disk image:
qemu-img info myguest.qcow2
Ensure the disk format is correct and the backing file (if any) is accessible.
- Examine alternative logs:
sudo cat /var/log/libvirt/qemu/myguest.log
This often contains more detailed boot information than libvirt.log.
After thorough testing, I found these approaches resolved similar issues:
1. Forcing Serial Console Configuration
Add explicit console configuration to your vmbuilder
command:
--serial pty --console pty
Or manually edit the domain XML:
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
2. Alternative Boot Methods
Try booting directly from ISO first to isolate the issue:
virt-install \
--name myguest-test \
--ram 2048 \
--disk path=/var/lib/libvirt/images/myguest-test.qcow2,size=12 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntuOneiric \
--network network:default \
--graphics vnc \
--cdrom ubuntu-11.10-server-amd64.iso \
--noautoconsole
3. Verifying KVM Acceleration
Check that KVM acceleration is properly enabled:
kvm-ok
# Expected output:
# INFO: /dev/kvm exists
# KVM acceleration can be used
# Check CPU virtualization flags:
egrep -c '(vmx|svm)' /proc/cpuinfo
# Should return > 0
When console connections fail, try these debugging commands:
# Check if getty is running on the guest
ps aux | grep getty
# Alternative connection method using socat:
sudo socat UNIX-CONNECT:/var/lib/libvirt/qemu/myguest-serial0 STDIO
After troubleshooting, this configuration proved reliable:
virt-install \
--name myguest-working \
--ram 2048 \
--disk path=/var/lib/libvirt/images/myguest-working.qcow2,size=12,bus=virtio \
--vcpus 2 \
--os-type linux \
--os-variant ubuntuOneiric \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/oneiric/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
The key differences being the explicit serial console configuration and using the network installer rather than a local ISO.