Passing SMBIOS Information to the Windows Subsystem in KVM
In this article, we will see how to configure KVM to allow the transfer of SMBIOS information, such as UUID and serial numbers, to the Windows subsystem. This process is essential to ensure that the virtualized operating system can access the correct hardware information and perform operations that depend on this data.
Prerequisites
Before starting, make sure you have:
- A VM running with KVM and libvirt.
- Root access or a user with sudo privileges.
- The
OVMF
package installed to enable UEFI support.
1. Creating UEFI Variable Files
First, we need to create a copy of the UEFI variable file specific to the VM. This avoids conflicts between VMs and allows you to retain personalized UEFI settings.
1 2 |
sudo cp /usr/share/OVMF/OVMF_VARS_4M.fd /var/lib/libvirt/qemu/nvram/MNGMT_VARS.fd sudo chmod 644 /var/lib/libvirt/qemu/nvram/MNGMT_VARS.fd |
2. Editing the VM’s XML File
Edit the XML configuration of your virtual machine using the command virsh edit VM_NAME
. Add or modify the <os>
section as follows:
1 2 3 4 5 6 |
<os> <type arch="x86_64" machine="pc-q35-8.2">hvm</type> <loader readonly="yes" type="pflash">/usr/share/OVMF/OVMF_CODE_4M.fd</loader> <nvram>/var/lib/libvirt/qemu/nvram/MNGMT_VARS.fd</nvram> <smbios mode="sysinfo"/> </os> |
3. Verifying Disk and Boot Order Configuration
Ensure that the boot disk is correctly configured in the XML file:
1 2 3 4 5 6 |
<disk type="file" device="disk"> <driver name="qemu" type="raw"/> <source file="/SDD4TB/vm/MNGMT.img"/> <target dev="sda" bus="sata"/> <boot order="1"/> </disk> |
Access the VM BIOS during startup and check that the boot order is correct.
4. Restarting the libvirt Service
After making the changes, restart the libvirt service:
1 |
sudo systemctl restart libvirtd |
5. Starting the Virtual Machine
Start the virtual machine with the following command:
1 |
sudo virsh start MNGMT |
6. Troubleshooting UEFI Boot Issues
If the VM does not boot the operating system, follow these steps for troubleshooting:
- Check the boot order in the UEFI configuration menu.
- Verify the presence of system partitions and boot files by mounting the disk image.
- Try restoring the UEFI boot loader using a Windows recovery disk.
7. Verifying the Transfer of SMBIOS Information
After properly configuring the VM, boot into Windows and verify the transfer of SMBIOS information by running the following commands:
1 2 |
wmic csproduct get UUID wmic bios get serialnumber |
Conclusion
By following these steps, you can enable the transfer of SMBIOS information from your KVM virtual machine to the Windows operating system. This is essential to ensure that applications and services that rely on this information function correctly within the VM.