Fixing Minecraft on Linux

- 2 mins read

Introduction

While running Minecraft on Linux I’ve faced several issues, here I’m collecting my fixes or workarounds.

Complete crash on AMD RX Vega 64 with Sodium

Running Minecraft with Sodium on the latest Mesa version causes corruption or a full system freeze/crash. This is due to a regression with Mesa 23.1 tracked here.

Possible Workarounds

Downgrading Mesa

Using a Mesa version before 23.1 fixes the crash, but you will have to downgrade other components as well to not break the rest of the system. I’ve found mesa-vdpau to be the only one required, but there might be others.

On Arch Linux, you can do:

sudo pacman -U \ 
https://archive.archlinux.org/packages/m/mesa-vdpau/mesa-vdpau-23.0.3-1-x86_64.pkg.tar.zst \
https://archive.archlinux.org/packages/m/mesa/mesa-23.0.3-1-x86_64.pkg.tar.zst

Vulkan will be unaffected by this, since it rests in the vulkan-radeon package. Running different Mesa versions for OpenGL and Vulkan is supported and also done by platforms such as the Steam Deck.

Using Zink

Zink is a driver that implements OpenGL on top of Vulkan. With the latest Mesa updates, this gets pretty close to native performance and fixes our issue with the crash. To run an OpenGL program through Zink, the MESA_LOADER_DRIVER_OVERRIDE=zink environment variable has to be set. On Prism Launcher, you can set this directly in the instance or global settings.

Screenshot of setting the Zink environment variable in a Prism Launcher instance


Segfault after loading screen on PipeWire

Occassionally I’ve had Minecraft segfault out of nowhere after the loading screen on libopenal.so. I haven’t been able to consistently reproduce it, but I could fix it every time by creating ~/.alsoftrc and putting

drivers=pulse

to force OpenAL to use the PulseAudio backend. Alternatively, you can set the ALSOFT_DRIVERS=pulse environment variable.


Running natively on Wayland

There can be multiple reasons why you would want to ditch XWayland, but the good news is that it’s very possible now. Since the GLFW 3.4 release, Minecraft is natively supported if you point it to your system library instead of letting it use the bundled version.

To do so in any launcher, use the -Dorg.lwjgl.glfw.libname=/usr/lib64/libglfw.so Java argument. For Prism Launcher, you only have to tick two checkboxes in the instance or global settings:

Screenshot of enabling the usage of native GLFW on a Prism Launcher instance

To fix the issue of the cursor not centering when opening menus or inventories, you will unfortunately still need to patch GLFW, a good set of patches is BoyOrigin/glfw-wayland.

On Arch Linux, you can install it via my glfw-wayland-minecraft-cursorfix AUR package. On other distros, download the latest release and point either the Java argument or the Prism Launcher setting to the path of the downloaded .so file.