UNFINISHED Creating a VM using virt-manager on Arch Linux/CachyOS
Installing and configuring virt-manager
Installing virt-manager
-
Install
virt-managerand other necessary packages.sudo pacman -Syu virt-manager qemu-full libguestfs guestfs-tools iptables-nft -
Enable
libvirtd.socketandvirtlogd.socketsystemctl enable --now libvirtd.socket systemctl enable --now virtlogd.socket -
Ensure the variable is
firewall_backend=iptablesin/etc/libvirt/network.conffor NAT to function. -
Enable
defaultNAT adaptersudo virsh net-start default sudo virsh net-autostart default
Configuring virt-manager
- Open
Virtual Machine Manager. - Goto
Edit > Preferencesfrom the tab bar on top.- Under
General- Enable
Enable XML Editing - Enable
Enable libguestfs VM Introspection
- Enable
- Under
New VM- Set
x86 FirmwaretoUEFI - Set
CPU Defaulttohost-passthrough - Set
Storage FormattoQCOW2(optional)
- Set
- Under
- If QEMU/KVM doesn’t exist like the pic above, Goto
File > Add Connectionand configure as follows (Make sure you are using the system instance of qemu by ensuring the Generated URI field readsqemu:///system) - Double-click on QEMU/KVM if it shows Not Connected.
virt-manageris now ready for creating and running VMs.
Creating VMs
Linux Guests
Generally, Linux guests should work OOTB. IF you are facing any issues, consult your distro documentation.
Windows Guests
- Finally, click the shiny monitor icon near the top-right and create a new VM
- While using the wizard, choose the installed OS manually by unticking the auto detect checkbox ENSURE OS TYPE IS THE SAME OS YOU ARE GOING TO INSTALL
- On the last screen, select
Customize configuration before install - (Windows Guests) Download the VirtIO guest tools iso for Windows so we can have disk and network drivers.
- (Windows Guests) Add an emulated CD-ROM drive with our VirtIO drivers from
Add Hardware > Storage (In the sidebar) > Device Type: CDROM Deviceand select the VirtIO driver ISO file, then click Ok to close the dialog box - On default configurations,
virt-managerwill default to an emulated SATA disk as your storage drive. To enjoy better performance, selectSATA Disk 1from the sidebar and changeDisk Bus:toVirtIO - Similarly, you can select
NIC:(random characters)from the sidebar and changeDevice Model:toVirtIO - Finally, select
Begin Installationon the top-left corner and begin installation - (Windows Guests) At the disk partitioning screen, the installer will complain about having no disks to install to. Click
Load Drivers, thenBrowseand goto(VirtIO disk) > vioscsi > (windows version) > AMD64and click Ok to let the installer find the driver. Afterwards, our main disk should be visible in the disk partitioning screen - Continue the installation as normal
- You can customize the VM after installation by switching from the Graphical Console view to the Hardware Details view on the top-left
Installing Spice and VirtIO guest tools (Windows Guests)
- After installation has finished, navigate to the emulated CDROM drive with the VirtIO drivers in Windows Explorer and install the guest tools
- Afterwards, visit these two links inside the VM and install the Spice guest tools
Setting up RDP
- Enable Remote Connections inside your Windows guest. Google how to.
- While the VM is running, Goto Hardware Details view, click on the
NIC:(random characters)device from the sidebar and take a note of the IP Address - Note that the user account you want to RDP to in the Windows guest must have a password set
- Install a RDP client,
krdcis a very nice and robust client. - Enter the IP Address in the address field and connect to it
- On the login prompt, enter your Windows username and password to connect
Setting up GPU Passthrough
- While the VM is powered off, Goto the Hardware Details view, then
Add Hardware > PCI Host Deviceand select one of the vGPUs/GPU you want to passthrough to the VM. - (Intel iGPUs) To avoid the Code 43 error with the i915 sriov dkms drivers, follow this thread and add a <vendor_id> tag
Setting up USB Passthrough
- While the VM is powered off, Goto the Hardware Details view, then
Add Hardware > USB Host Deviceand select one of the USB Devices you want to passthrough to the VM.