QEMU Virtual Machine Installation - LeandroTheDev/arch_linux GitHub Wiki

Downloading

  • sudo pacman -S qemu-full virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat ebtables iptables

Confirm overwrite

  • sudo pacman -S libguestfs

Enabling

  • sudo systemctl enable libvirtd
  • sudo systemctl start libvirtd
  • sudo usermod -a -G libvirt $(whoami)
  • sudo systemctl restart libvirtd

GPU In Virtual Machine

Unfortunately to this works you will need a secondary gpu, integrated counts as gpu

  • go to BIOS in your system
  • enable virtualization
  • enable IOMMU

Get the GPU id and GPU audio id, find than and save it, this is the gpu used for the main linux

  • lspci -nn / NVIDIA simple: lspci -nn | grep "NVIDIA"

ID Example

[0030]: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] [10de:1b06] <-- this is the graphics id
[0030]: NVIDIA Corporation GP102 HDMI Audio Controller [10de:10ef] <-- this is the audio id

Enabling IOMMU in grub

  • sudo vim /etc/default/grub
#AMD for AMD intel for intel..., change the id by the one you get from previous section
GRUB_CMDLINE_LINUX_DEFAULT="amd/intel_iommu=on vfio-pci.ids=graphicsId,audioId"
  • sudo update-grub
  • reboot

Now pickup the id from your integrated gpu or secondary gpu, this is the gpu used for virtual machine Add the ids in vfio

  • sudo vim /etc/modprobe.d/vfio.conf
options vfio-pci ids=graphicsId,audioId
#This is not necessary but if you having problems try this, i dont know what this does but maybe your games outside the VM stop working
softdep nvidia pre: vfio-pci

Rebuilt init

  • sudo mkinitcpio -p linux
  • reboot

Open your virtual manager and check somethings

  • chipset: Q35
  • firmware: UEFI

Add new PCI Host device

Graphics

  • 0000:001:... [NVIDIA]...

Audio

  • 0000:002:... [NVIDIA]...
  • have fun

Finish