This repository provides a temporary standalone SaltStack environment for provisioning and managing a pre-built Windows 11 VM using QEMU / KVM / Libvirt on both RHEL and Debian-based systems. It is designed as a transitional structure before merging into the main /data/salt architecture.
NOTE: The .qcow2 image referenced at /var/lib/libvirt/images/Windows11.qcow2 in this setup is NOT configured, and will not provide an operating version of windows. In production it will be replaced with the fully configured windows 11 pro .qcow2 image located at /data/repo/software/linux/win11-pro.qcow2 on stl-prod-ops-adm-01.sjultra.com.
If you are attempting to use this repository to launch a working version of windows 11 make sure to take the win11-pro.qcow2 on stl-prod-ops and copy / rename it to /var/lib/libvirt/images/Windows11.qcow2
The Salt states automate installation, validation, image registration, and network configuration—but every automated step can also be executed manually (documented below) for direct troubleshooting or replication.
- Repository Layout
- Environment Overview
- Salt Usage
- Manual Procedures
- RDP Access and VirtIO Drivers
- Troubleshooting and Validation
/srv/
├── salt/
│ ├── kvm/
│ │ ├── init.sls # Install and enable virtualization stack
│ │ ├── verify_hw.sls # Hardware & firmware validation
│ │ ├── tpm_uefi.sls # Configure swtpm + OVMF
│ │ ├── images.sls # Validate qcow2 images exists
│ │ ├── define.sls # Define VM via XML
│ │ ├── network.sls # Define persistent libvirt bridge
│ │ ├── manage.sls # Start/stop/status orchestration
│ │ └── templates/
│ │ ├── win11-base.xml
│ │ └── qemu.conf.j2
│ └── top.sls
└── pillar/
├── virt_common.sls
├── windows_vms.sls
└── top.sls
- Target Hosts: RHEL 9 / Rocky 9 / Debian 12
- Guest OS: Windows 11 (pre-built
.qcow2) - Network Mode: Bridged (
br0→edge-bridge) - Access Method: RDP (via DHCP-assigned IP)
- Firmware & TPM: OVMF Secure Boot + swtpm 2.0
This setup intentionally lives under /srv/ to isolate it from production Salt trees (/data/salt/).
Dry-Run
sudo salt-call --local state.apply test=TrueApply Full Stack
sudo salt-call --local state.applyTarget Specific Steps
sudo salt-call --local state.apply kvm.init
sudo salt-call --local state.apply kvm.verify_hw
sudo salt-call --local state.apply kvm.tpm_uefi
sudo salt-call --local state.apply kvm.images
sudo salt-call --local state.apply kvm.define
sudo salt-call --local state.apply kvm.networkManage VMs
salt-call --local state.apply kvm.manage pillar='{"action": "start"}'
salt-call --local state.apply kvm.manage pillar='{"action": "stop"}'
salt-call --local state.apply kvm.manage pillar='{"action": "restart"}'
salt-call --local state.apply kvm.manage pillar='{"action": "status"}'RHEL / Rocky:
sudo dnf install -y qemu-kvm libvirt virt-install swtpm edk2-ovmf
sudo systemctl enable --now libvirtd virtqemud virtlogd virtlockdDebian / Ubuntu:
sudo apt install -y qemu-kvm libvirt-daemon-system virtinst swtpm ovmf
sudo systemctl enable --now libvirtd virtqemud virtlogd virtlockdVerify:
egrep -c '(vmx|svm)' /proc/cpuinfo
lsmod | egrep 'kvm(_intel|_amd)?'
systemctl status libvirtd --no-pager
virsh -c qemu:///system list --allConfirm the host can run Windows 11:
egrep -c '(vmx|svm)' /proc/cpuinfo
ls -l /dev/kvm
mokutil --sb-state || true
swtpm socket --version
rpm -q edk2-ovmf || dpkg -l | grep ovmfConsolidated Report:
sudo salt-call --local state.apply kvm.verify_hw
cat /var/log/virt_support_report.txtsudo mkdir -p /var/lib/libvirt/swtpm
sudo chown root:root /var/lib/libvirt/swtpm
# Verify TPM emulator
swtpm socket --tpm2 --ctrl type=unixio,path=/tmp/swtpm-test.sock &
ps aux | grep swtpm
kill %1UEFI Firmware Check
ls /usr/share/OVMF/OVMF_CODE.secboot.fd
ls /usr/share/OVMF/OVMF_VARS.secboot.fdEnsure qcow2 image exists:
ls -l /var/lib/libvirt/images/Permissions
sudo chown qemu:qemu /var/lib/libvirt/images/Windows11.qcow2
sudo chmod 660 /var/lib/libvirt/images/Windows11.qcow2Optional Conversion
qemu-img convert -f raw -O qcow2 Win11_25H2.iso /var/lib/libvirt/images/Windows11.qcow2Copy the XML definition and register:
sudo cp win11-base.xml /etc/libvirt/qemu/
sudo virsh define /etc/libvirt/qemu/win11-base.xmlNOTE: win11-base.xml only allocated 4G of RAM to the VM. If you want / need more then change the amount in the XML file before utilizing it.
sudo virsh list --allExpected:
Id Name State
----------------------------
- win11-base shut off
Create Bridge with NetworkManager
nmcli connection add type bridge ifname br0 con-name br0 ipv4.method auto
nmcli connection add type bridge-slave ifname enp1s0f0 con-name br0-slave-enp1s0f0 master br0
nmcli connection up br0-slave-enp1s0f0
nmcli connection up br0Validate
brctl show br0Libvirt Persistent Network
virsh net-define /srv/salt/kvm/templates/edge-bridge.xml
virsh net-autostart edge-bridge
virsh net-start edge-bridge
virsh net-info edge-bridgeExpected:
Name: edge-bridge
Active: yes
Persistent: yes
Autostart: yes
Bridge: br0
# Start VM
virsh start win11-base
# Stop VM
virsh shutdown win11-base
# Restart
virsh reboot win11-base
# Delete
virsh undefine win11-baseService Enablement
systemctl enable --now virtqemud.socket virtnetworkd.socket virtstoraged.socketOnce the VM is started:
- Use
virsh domifaddr win11-baseto find the IP. - Connect via RDP:
rdp://<vm_ip> - Default Windows user: vmuser pass: S-2025 (If using the production image located at
/data/repo/software/linux/win11-pro.qcow2) - If you need to reinstall drivers:
- Download VirtIO ISO: https://fedorapeople.org/groups/virt/virtio-win/
- Mount with:
virsh attach-disk win11-base /usr/share/virtio-win/virtio-win.iso hdc --type cdrom --mode readonly
| Issue | Fix |
|---|---|
/dev/kvm missing |
Enable VT-x / AMD-V in BIOS; modprobe kvm_intel or kvm_amd |
| User not in libvirt group | usermod -aG libvirt $USER then re-login |
| OVMF files missing | dnf install edk2-ovmf or apt install ovmf |
| TPM socket error | Recreate /var/lib/libvirt/swtpm; restart libvirtd |
| VM no network | Verify bridge (br0) is up and attached in virsh domiflist |
| Unknown host IP | Use arp -n or check router DHCP leases |
| Salt state fails | Run state.apply test=True for syntax then apply modules individually |
qemu-kvm(1),virsh(1),virt-install(1)- Libvirt Networking Guide
- OVMF Secure Boot Firmware
- Fedora VirtIO Drivers for Windows