This post is aimed at making setting up KVM with virt-manager a breeze. If you havn’t already, set up X11 forwarding to a remote host or install some kind of a GUI on your Arch install then load up virt-manager via Pacman.
It is assumed that you have created a user, added them to at least the wheel group and have admin access for this. Also, don’t forget to setup your network bridge. If you’ve done this, you can start.
groupadd libvirt gpasswd -a user libvirt
Some info in this post is taken from the excellent KVM on OpenSUSE guide in this thread on the unRAID forums. Thanks go to it’s author, without whom this wouldn’t have happened, grumpybutfun! As per his thread I’ll be aiming to get unRAID up and running in this guide for you, with other OS’s following later.
Another useful resource is this thread on the Arch Forums.
For unRAID you’ll want this .vhd file to import into virt-manager later, set it downloading whilst you tinker.
KVM is turned on by default in the Arch kernel, so we haven’t got to compile a kernel or anything. It’s natively supported, so that’s neat. We do need a couple of packages though so grab these
pacman -S libvirt qemu
Then enable the libvirt daemon service.
systemctl enable libvirtd systemctl start libvirtd
We want to setup libvirt to communicate over SSH, uncomment the following lines:
listen_tls = 0 unix_sock_group = "libvirt" unix_sock_ro_perms = "0777" unix_sock_rw_perms = "0770" unix_sock_dir = "/var/run/libvirt" auth_unix_ro = "none" auth_unix_rw = "none"
Now uncomment for TCP these:
listen_tcp = 1 auth_tcp = "none" <---- Change the default from auth_tcp = "sasl"
Running without sasl is not recommended for real world use.
CTRL+X will ask you to save and quit.
It is also necessary to make a modification to /etc/conf.d/libvirtd adding –listen.
LIBVIRTD_ARGS="-p /var/run/libvirtd.pid --listen"
user = "root" group = "root" <---- change this from "kvm"
CTRL+X will ask you to save and quit.
Reboot so these changes take effect at this point.
Configure virt-manager to connect
Load up virt-manager.
File > Add connection... Hypervisor: QEMU/KVM Tick connect to remote host Method: SSH Username: root Host: <ip address>
Then when asked about this OpenSSH auth passphrase request type YES (all 3 letters) then press OK.
Then enter your root password and you should be connected!
Create a new unRAID VM
This post here tells you all you need to know!
However, if you’re doing this over X11 forwarding like I am you’ll need to setup a libvirt storage pool before going any further or you won’t be able to import the unRAID.vhd file.
Create a libvirt storage pool
Open virt-manager, right click on your server once connected and hit details. Then navigate to the storage tab and click the + then follow the wizard. I put my .vhd in /root/virtmanpool but you can place it where. Once you have the pool setup I change directory to /root/virtmanpool and used wget to pull the vhd from dropbox.
cd /root/virtmanpool wget https://dl.dropboxusercontent.com/u/6775695/unraid/Files/KVM-unRAID-5.0.4.vhd
Then click refresh next to volumes on the storage tab and you should be good to go!
Enable PCI passthrough for KVM
This process differs only a little to that I have previously documented for Xen. First you need to find your device ID by running
lspci 07:00.0 RAID bus controller: Marvell Technology Group Ltd. MV64460/64461/64462 System Controller, Revision B (rev 01)
This will give a whole ton of crap, but you need to sift through and find your SATA controller to pass through to unRAID. I passed through my USB stick successfully in the virt-manager interface, if you can’t just added your USB controller to the passed through list.
So the device ID I want is 07:00.0. You then need to convert this to a stub pci-id (which will change when you add or remove hardware). I don’t like this fact, and if anyone knows how to make it more permanent then I’m all ears.
lspci -n 07:00.0 0104: 11ab:6485 (rev 01)
So my pci-stub.id is 11ab:6485 – I need to add this my default grub.
Modify the default line to look like this.
GRUB_CMDLINE_LINUX_DEFAULT="quiet ipv6.disable=1 intel_iommu=on pci-stub.ids=11ab:6485"
Then update grub.
Now you need to add the pci-stub module into initramfs via mkinitcpio.
mkinitcpio -p linux
You can check if the passthrough worked or not by running lspci -k and check for the driver in use like this…
Finally, add your PCI host device using the virt-manager interface and you should be done. With a working, booting unRAID (with passed through drives!).