Setup prismlauncher to play minecraft in qubes

There are a few qubes specific quirks that took me some time to figure out, so I thought I’d share them here. This guide is primarily for people with nvidia gpu’s, however the xrandr fix might be relevant for amd/intel too.

  1. Setup PCIe passthrough as described in this guide by neowutran, using a linux (in my case debian) guest

  2. Install prismlauncher and log in (I used the portable version)

  3. In prismlauncher, go to Settings > Minecraft > Environment Variables

Add these (the thing after ‘=’ being the value):

__NV_PRIME_RENDER_OFFLOAD=1 
__VK_LAYER_NV_optimus=NVIDIA_only 
__GLX_VENDOR_LIBRARY_NAME=nvidia
  1. Newer versions should now run without problems, however older versions that still rely on LWJGL2 crash with something like:
org.lwjgl.LWJGLException: No modes available

This is because LWJGL2 gets confused by the QB in front of the resolution that is outputted by the xrandr command, see the relevant source code here

the easiest workaround that I found is just put this at /usr/local/bin/xrandr:

#!/bin/bash

/usr/bin/xrandr "$@" | sed "s/QB//"

don’t forget to make it executable with

chmod +x /usr/local/bin/xrandr

Note: this might lead to issues with other programs, however if you only use this qube for minecraft, its probably fine.

I hope this saved someone some trouble