Troubleshooting Virsh VM Console: Why No Output Appears and How to Fix Serial PTY Configuration
2 views
When working with KVM/QEMU virtual machines managed through libvirt's virsh, a common frustration occurs when the VM console shows no output despite proper configuration. Let's analyze the key symptoms from the case:
The lsof output reveals the critical difference between working and non-working cases:
If the issue persists, try these alternative connection methods:
# Method 1: Using screen
screen /dev/pts/6
# Method 2: Direct socat connection
socat - /dev/pts/6,rawer
# Method 3: Using virsh with force option
virsh console --force VM1
To see exactly how libvirt launches QEMU, check the generated command:
ps aux | grep qemu
cat /var/log/libvirt/qemu/VM1.log
Key parameters to verify include:
-chardev pty,id=serial0
-device isa-serial,chardev=serial0
-monitor stdio (missing in problematic case)
Check these common permission-related issues:
# Check libvirt qemu user permissions
ls -la /dev/pts/6
# Check SELinux context
ls -Z /dev/pts/6
# Temporarily test with SELinux in permissive mode
setenforce 0
virsh start VM1
setenforce 1
When attempting to connect to a KVM virtual machine using virsh console, you might encounter a blank screen despite the VM being in running state. This typically indicates a serial console configuration mismatch between the host and guest environments.