When attempting to create a KVM guest inside a VirtualBox VM running RHEL 6.0, many developers encounter the puzzling error:
ERROR No 'Guest' class for virtualization type 'lxc'
This occurs because VirtualBox doesn't enable virtualization extensions (VT-x/AMD-V) by default for guest VMs. Here's how to properly configure nested virtualization.
Before proceeding, verify your host system supports virtualization:
grep -E 'vmx|svm' /proc/cpuinfo
If no output appears, you'll need to:
- Enable virtualization in BIOS
- Configure VirtualBox to pass through these extensions
First, shut down your RHEL 6.0 VM and run this command on the host:
VBoxManage modifyvm "VM_NAME" --nested-hw-virt on
For VirtualBox 6.0+, you may alternatively use:
VBoxManage modifyvm "VM_NAME" --cpu-profile "host" --hwvirtex on
After booting your RHEL VM, check KVM modules:
lsmod | grep kvm
If modules aren't loaded, install them:
sudo yum install kvm kmod-kvm qemu-kvm
sudo modprobe kvm
sudo modprobe kvm_intel # or kvm_amd
The original command had several issues:
# Working example:
sudo virt-install \
--name=kvm_client1 \
--ram=2048 \
--disk path=/var/lib/libvirt/images/kvm_client1.qcow2,size=10 \
--vcpus=2 \
--os-type=linux \
--os-variant=rhel6 \
--network network=default \
--graphics spice \
--cdrom=/dev/cdrom \
--console pty,target_type=serial
Key differences from the original:
- Modern RAM allocation (256MB is too small for RHEL)
- Proper disk format specification
- Correct CPU and OS parameters
- Added console redirection
If you still encounter issues:
# Check libvirtd logs
sudo tail -f /var/log/libvirt/libvirtd.log
# Verify KVM acceleration
kvm-ok
# Alternative installation method using qemu-img
qemu-img create -f qcow2 /var/lib/libvirt/images/kvm_client1.qcow2 10G
Nested virtualization carries significant overhead. For better performance:
- Allocate sufficient CPU cores (at least 2 for host, 2 for guest)
- Use virtio drivers for network and disk
- Consider paravirtualization (--virt-type kvm)
- Disable graphical console when not needed
Running KVM inside VirtualBox is technically possible through nested virtualization, but requires specific configuration. The error message you're seeing suggests your current setup doesn't support this architecture.
Before attempting nested virtualization, ensure:
- Your physical CPU supports VT-x/AMD-V AND nested virtualization
- VirtualBox is configured correctly
- The host OS has KVM modules loaded
First, enable nested virtualization in VirtualBox:
VBoxManage modifyvm "YourVMName" --nested-hw-virt on
For Intel processors:
VBoxManage modifyvm "YourVMName" --cpu-profile "Intel Xeon"
Inside your VirtualBox guest (RHEL 6.0), verify KVM modules:
lsmod | grep kvm
modprobe kvm-intel # For Intel CPUs
# OR
modprobe kvm-amd # For AMD CPUs
The error No 'Guest' class for virtualization type 'lxc'
suggests libvirt is misconfigured. Try:
yum install qemu-kvm libvirt virt-install bridge-utils
service libvirtd restart
Modify your original command to explicitly specify QEMU/KVM:
virt-install \
--connect qemu:///system \
--name kvm_client1 \
--ram 256 \
--disk path=/var/lib/libvirt/images/kvm_client1.img,size=5 \
--network network=default \
--cdrom /dev/cdrom \
--virt-type kvm
If you still encounter issues:
- Verify VT-x is exposed to the VM:
egrep -c '(vmx|svm)' /proc/cpuinfo
- Check dmesg for KVM initialization errors
- Consider using virt-manager for GUI-based troubleshooting
Nested virtualization carries significant overhead. For production workloads, consider:
- Allocating more RAM to both VMs
- Using virtio drivers for disk and network
- Disabling unnecessary graphical interfaces