When working with KVM virtualization in a headless environment, connecting to the guest console during installation requires specific configuration that many tutorials overlook. The key issue manifests when running commands like:
virt-install --name=FE --ram=756 --vcpus=1 \
--file=/var/lib/libvirt/images/FE.img --network bridge:br0 \
--nographics --os-type=linux \
--extra-args='console=tty0 console=ttyS0,115200n8' -v \
--cdrom=/media/usb/Fedora-14-x86_64-Live-Desktop.iso
Several components must align for successful console access:
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
If you're stuck with an unresponsive installation:
1. First verify the domain is running:
virsh list --all
2. Connect to the console with proper escape sequence:
virsh console FE --force
3. For persistent issues, modify the XML configuration:
virsh edit FE
# Add these kernel parameters to the <os> section:
<kernel>/boot/vmlinuz-version</kernel>
<cmdline>console=ttyS0,115200n8</cmdline>
When serial console fails, consider these approaches:
# Using VNC as fallback
virt-install --name=FE ... --graphics vnc,port=5901
# Or connect via SSH if networking works:
ssh -p 2222 root@localhost
- Verify kernel supports serial console:
grep CONFIG_SERIAL_8250 /boot/config-$(uname -r)
- Check for TTY device conflicts:
ls -l /dev/ttyS*
- Ensure proper SELinux context:
chcon -t virt_image_t /var/lib/libvirt/images/FE.img
When performing a headless KVM installation using virt-install
, accessing the guest console requires proper configuration of both the host and guest. Here's why your console might not be showing installation output:
# Common mistake: Missing proper console arguments
--extra-args='console=ttyS0,115200n8' # Should replace 'console=tty0'
The key elements needed for successful console access:
- Serial console configuration in the guest XML:
<serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console>
- Boot parameters for the installer:
--extra-args='console=ttyS0,115200n8 inst.text'
Here's the corrected virt-install
command:
virt-install \
--name=FE --ram=756 --vcpus=1 \
--disk path=/var/lib/libvirt/images/FE.img,size=10 \
--network bridge=br0 \
--nographics \
--location /media/usb/Fedora-14-x86_64-Live-Desktop.iso \
--extra-args='console=ttyS0,115200n8 inst.text'
After launching the VM, connect using:
virsh console FE
If you get stuck at a blank screen, try these troubleshooting steps:
# Check if the guest actually booted
virsh domstate FE
# Force reset if needed
virsh destroy FE
virsh start FE --console
If serial console proves problematic, consider using VNC instead:
virt-install \
--name=FE --ram=756 --vcpus=1 \
--disk path=/var/lib/libvirt/images/FE.img,size=10 \
--network bridge=br0 \
--graphics vnc,listen=0.0.0.0 \
--noautoconsole \
--cdrom /media/usb/Fedora-14-x86_64-Live-Desktop.iso
Then connect using any VNC client to the host IP on port 5900.