Having problems with an Antergos installation with windows VM

When the GTA V on linux video was released on the Tek Linux chanel, I thought it was really interesting and decided to try it out . I had some problems that with the help of that thread was able to overcome. I have recently however changed some of my hardware and tried to make the setup a bit more useful by purchasing a KVM switch and installing this as my primary OS and removing windows from my drive.

I am having a few problems with it and help with any of them would be appreciated.

1) when I shut down the windows VM it can lock up my PC causing me to have to restart the PC. This happens when ever I change the power state of the VM and does it no matter how I do this. (if i shutdown, sleep, hibernate from windows or the qemu console) This sometimes happens when the vm has been Idle for a while and sleeps itself but not every time

2) I would like to have steam installed on the linux part however am having issues.
When I load steam by clicking on it nothing happens, from a terminal this happens
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

I get these errors and after googling it I see posts talking about how installing GPU drivers can break the sym links that cause this. however following the instructions in these posts does not fix the issue

3) When i press my kvm switch sometimes my mouse or keyboard doesnt connect to the linux machine and i have to press it twice more to connect back to the windows machine and then back to the linux machine for it to be detected. (Im not sure if this is a fault with the KVM switch or the PC or the OS as the KVM switch was quite cheap)

My system info - I dont know if this will help
Motherboard: MSI X99 Gaming 7
CPU: Intel 5820K
RAM: 16GB corsair vengeance DDR4
GPU (HOST): Nvidia GTX650TI
GPU (VM): Nvidia GTX780

VM
The vm is setup in qemu and uses Intel_iommu and VFIO to pass the graphics card and the USB controller.

I installed the system and setup the VM with help from guide on this site and a reddit post
https://teksyndicate.com/videos/gta-v-linux-skylake-build-hardware-vm-passthrough
https://www.reddit.com/r/linux_gaming/comments/3lnpg6/gpu_passthrough_revisited_an_updated_guide_on_how/

If you bothered to read this far (Im going to be honest I probably wouldnt have), Thanks and if you have any Ideas about how to fix any of these problems that would be great. If you need any information to help decide what is wrong I will try my best to provide it.

well nobody seemed interested, but i can help with the steam not working in arch at least... the issue is that steam is 32bit, but all of the driver's and libraries on your system are aimed at solely 64-bit scenarios.

if you dont have the nvidia driver do "pacman -S nvidia nvidia-libgl lib32-nvidia-libgl"
if you do have the nvidia driver lib32-nvidia-libgl should suffice, and then steam should work on linux

This is a very difficult topic to troubleshoot, that's why nobody responded. As far as the lockup, there are a number of things that could cause it. Often, you can't get it 100% stable. That said, let's give it a try:

Are you getting any errors in the journal? (journalctl -b -1 to see the prior boot's journal)

What kernel command line options are you using?

What modules are you specifying in mkinitpcio.conf?

Are you using vfio or pci-stub?

Are you using virt-manager or is it just a shell command to run the VM?

What version of windows is in your VM?

EDIT: As far as the steam issue, @deathright82 is partially correct, you do need the lib32 GPU drivers, but that wasn't the only issue I had. For the libGL errors, check this out:

I've gotten it to work by executing the steam command from a shell script after setting LD_PRELOAD='/usr/$LIB/libstdc++.so.6'.

From there, you might need to install a couple packages. If it's complaining about a couple libraries not being installed, just search for arch $LIBNAME and you'll be able to find the official name for the package, which you can then run yaourt -S $PKGNAME against. At least that's how I did it. (Sorry I don't have the names of the missing libraries, haven't had to do it for a while.)

Installing these and then rebooting has fixed the steam problem. It had been bothering me that I had to load the windows VM and to check if anyone was online.

Thanks for your help

Thanks for the response

I cant see any errors in the journal I would paste it here but it is about 2000 lines long :(

I am using this in /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=8833330d-b104-45ce-b69d-d5cdfd8840e2 quiet pcie_acs_override=downstream intel_iommu=on pci-stub.ids=10de:0e1a,10de:1007,1106:3483"

The first 2 pci ids are my 780 and its audio and the last one is one of the usb controllers on my motherboard.

I have this in /etc/mkinitcpio.conf

MODULES="pci-stub"

I use VFIO

To run the vm i run the script below

#!/bin/bash
sudo vfio-bind 0000:03:00.0 0000:03:00.1 0000:08:00.0
sudo cp /usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd
sudo qemu-system-x86_64 \
  -enable-kvm \
  -m 12048 \
  -cpu host,kvm=off,check \
  -smp sockets=1,cores=4,threads=1 \
  -vga none \
  -device vfio-pci,host=03:00.0,multifunction=on \
  -device vfio-pci,host=03:00.1 \
  -device vfio-pci,host=08:00.0 \
  -soundhw hda \
  -drive if=pflash,format=raw,readonly,file=/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd \
  -drive if=pflash,format=raw,file=/tmp/my_vars.fd \
  -hda /home/ellis/.bin/win.img \
  -hdb /mnt/games/games.img

The vfio-bind command at the start is this script

#!/bin/bash
modprobe vfio-pci
for dev in "$@"; do
        vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
        device=$(cat /sys/bus/pci/devices/$dev/device)
        if [ -e /sys/bus/pci/devices/$dev/driver ]; then
                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
        fi
        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
done

The virtual machine is running windows 10 Pro because I had issues loading drivers during the install of Windows 7 Pro

For /etc/default/grub, try adding the following arguments in the GRUB_CMDLINE_LINUX_DEFAULT line:

kvm.allow_unsafe_assigned_interrupts=1 kvm.ignore_msrs=1

If you're using VFIO, you shouldn't be using pci-stub. They're two different methods and shouldn't be working as well as they are in combination.

Try changing in your GRUB_CMDLINE_LINUX_DEFAULT the pci-stub.ids to vfio-pci.ids and adding in /etc/mkinitcpio.conf's MODULES line the following:

vfio vfio_iommu_type1 vfio_pci vfio_virqfd

You can remove pci-stub from the MODULES line as well.

For the VM and vfio-bind scripts, everything looks good.

Don't forget to run mkinitcpio -p linux (or whatever your kernel name happens to be) after changing things in the config. :) Also are you binding their IDs in an /etc/modprobe.d/vfio.conf file? That's how I did mine.

1 Like

If you look at the second line of his vm run script, he binds them before starting the VM.

#!/bin/bash
sudo vfio-bind 0000:03:00.0 0000:03:00.1 0000:08:00.0

Ok so at the moment the only thing I have done is to install the nvidia 32 bit packages to fix the steam issue. I wanted to get the computer to crash so I could apply the suggested changes and see if they help, I am struggling to reproduce the crashing now though. Is it possible that installing the nvidia package solved myu problem or is it just unfortunate that now that I have asked for help the problem seems to have gone away. I will still make the suggested changes as I agree that they should help stability.

Thanks

EDIT: I have now applied these changes and it seems to be stable, granted I cant tell you which changes helped but something here seems to have. I also cant be sure that it wont happen again in the future but for now I am happy that this is working.

Thanks for the all the help. :)

PS: I dont really spend much time on forums so i dont know if I have to close this or just leave it or mark it as solved I am more than happy to do one of those I just dont know what the correct thing to do is.

Once again Thanks that really helped.

Because he's using 2 nVidia cards it would probably be better to bind them with the vfio conf, it will bind automatically even before the nVidia driver module has been loaded. If it's all working then it's all good.

Hmm true. I've had issues getting my devices to bind that way, so I wasn't sure if that would cause issues for others.