Skip to content

Instantly share code, notes, and snippets.

@yonderbread
Last active August 31, 2021 05:11
Show Gist options
  • Save yonderbread/d25a17308bdc4a50986f4e02de238267 to your computer and use it in GitHub Desktop.
Save yonderbread/d25a17308bdc4a50986f4e02de238267 to your computer and use it in GitHub Desktop.

IMPORTANT: These steps are meant for use on most Arch, systemd based distrobutions. Please take care and backup your system and files you've edited before progressing. Better safe than sorry.

Steps:

  1. Update packages for distrobution. Typically on arch based systems you can run pacman -Syu --noconfirm with sudo privilidges to do this.

  2. Install grub.

  3. Edit /etc/defaults/grub (Make sure to back this file up beforehand)

  4. Look for the line option named GRUB_CMDLINE_LINUX_DEFAULT and prepend the following depending on what CPU make you have:

    • Intel: intel_iommu=on iommu=pt iommu=1 video=efifb:off
    • AMD: amd_iommu=on iommu=pt iommu=1 video=efifb:off
  5. Run sudo update-grub or sudo grub-mkconfig to regenerate your /boot/grub/grub.conf file. Make sure to reboot your system to apply the changes.

  6. Install the necessary packages with your package manager/AUR helper. With paru, you can run the following command:

    paru -Sy --noconfirm --cleanafter kvmtool-git libvirt bridge-utils virt-manager ovmf-git
  7. Edit/create the config located at /etc/libvirt/libvirtd.conf and uncomment these lines:

    unix_sock_group = "libvirt"
    unix_sock_rw_perms = "0770"

    ... or if the config variable does not exist, just append it to the end of the file.

  8. Set these values yourself somewhere at the end of the config:

    log_filters = "1:qemu"
    log_outputs="1:file:/var/log/libvirt/libvirtd.log"

    When you've uncommented and/or added these lines, save and close the file.

  9. Run the following command to add yourself to the libvirt group:

    sudo usermod -a -G libvirt $(whoami) # Or explicitly supply your username by replacing `$(whoami)`
  10. Start and enable the libvirtd daemon:

sudo systemctl enable libvirtd
sudo systemctl start libvirtd
  1. Add config values to the /etc/libvirt/qemu.conf:
user = "YOUR USERNAME"
group = "YOUR GROUP WHICH IS PROBABLY THE SAME AS YOUR USERNAME"
  1. Restart the libvirtd daemon:
sudo systemctl restart libvirtd
  1. Add yourself to the kvm and libvirt groups:
sudo usermod -aG kvm $(whoami)
sudo usermod -aG libvirt $(whoami)
  1. Reboot.
  2. Open virt-manager and create a new virtual machine.
  • Give it half of your CPU cores
  • 4 GB of ram is a decent amount
  • Make sure to check Copy host CPU configuration under the CPUs settings tab
  • DO NOT use UEFI (use SATA not IDE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment