Minecraft on Linux

I’ve been a Minecraft player for several years now, and when it came to running it on Linux, I usually did not encounter much issue. I’ve come to realize recently that, while it’s generally fairly easy to setup, there are a few things that can go wrong, and a few extra steps that can be taken. I’ve decided to write up my own guide to accomplish this.

Basic setup

  1. Install Java

While this may be fairly straight forward, it’s not always a clear step to install java. There are several options for installation here, and most will do the job just fine. Whether it be Oracle or OpenJDK, either version should be sufficient to get the game running. It is recommended using the latest version of these, though anything higher than Java 6 is fine. While Java 6 is sufficient to run the game, some users will experience performance improvements using Java 7 or later. It is also noteworthy that OpenJDK 6 has been known to cause issues, and is not recommended.

2. Launch the game

The second step is to download and launch the game. The Linux/Universal launcher can be downloaded from the Minecraft Website. Once obtained it can be launched either by double-clicking the file, or executing the following in the terminal:

java -jar Minecraft.jar

Assuming all goes well, this will get the game launcher up and running. If double-clicking opens an archive manager instead, the filetype association must be adjusted (right-click on the file, and Open With), as a .jar file is a .zip with a different extension. If launching from the terminal gives an error message such as unable to access jarfile Minecraft.jar, then either the file is named something else (don’t forget about case sensitivity), or the command is being executed in the wrong directory. This is all that is required to get the game up and running

Custom setup

While the basic setup is sufficient to get the game going, there are a few more steps that can be performed to make it easier to launch the game, and to improve performance. Once the basic setup is completed, the following steps may be taken.

Install or Update Video Drivers

While most Linux distributions will include video driver, this is not always the case. The included drivers may also be out of date, or Open Source. While these are sufficient to run the game, updating drivers, and installing proprietary ones are recommended to improve performance, correct graphical bugs, and (in some cases) be required to allow the game to run. If integrated Intel drivers are being used, Mesa drivers are sufficient to run the game. Proprietary drivers are recommended with both AMD/ATI and Nvidia graphics hardware.

In the case that hybrid graphics setups are being used, a slightly different approach can be used. With Nvidia Optimus technology, the usage of the Bumblebee Project can allow the usage of the discrete graphics hardware by running optirun or primusrun before the intended command. While these may be added before the java launcher execution command, this has been know to have mixed results, sometimes crashing the JVM altogether. Personally, I open the launcher as per usual, and change the Executable field in the Edit Profile menu instead. I direct this to a bash script with the following contents:


#!/bin/bash
primusrun java "$@"

This will pass all of the arguments into the script, and run java with through primus.

Create a Desktop shortcut

While this is more useful for desktop integration, certain desktop managers in Linux, such as Gnome, can refer to application ‘sortcuts’, through .desktop files. It’s simple to create one, and have Minecraft show up in search results. Firstly, create a directory for Minecraft that contains the Minecraft.jar launcher, and a bash script with the following contents:


#!/bin/bash
cd ${0%/*}    #change to file directory
java -jar Minecraft.jar

Next, download the Grass Block Icon from the Minecraft Wiki to use as the application icon (any icon can be used in its place), and place it into the same directory. Finally, create a .desktop file in ~.local/share/applications with the following contents:

[Desktop Entry]
Terminal=false
Name=Minecraft
Exec=/dir/to/minecraft.sh
Type=Application
Categories=Game;
Icon=/dir/to/Grass.png

Once saved, this should automatically add Minecraft to the applications list. The desktop environment may need to be reloaded for this to occur.

Troubleshooting

While I have encountered very few issues with the installation and execution of Minecraft on Linux, there are a few problems I have experienced (or seen), so I will list them and explain how to correct them.

Certificates error

This issue occurs when the java certificates are not properly downloaded or installed. The error will resemble the following:

Exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Recognized exception: the likely cause is a set of broken/missing root-certificates. Check your java install and perhaps reinstall it.

I have only seen this issue occur with installations of Ubuntu, and it may apply to any Debian-based distribution (perhaps others too). To correct it, run the following command in the terminal:

sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure

Once the configuration of the certificates is complete, the launcher should run as expected.

Missing Display Modes

This issue occurs due to a missing xorg package required to allow the game (specifically the LWJGL) to determine what display modes are available. Details about the issue can be found on this blog post. The solution is fairly simple, install the xrandr package. In Ubuntu this is found with the X11-server-utils package. On Arch, it can be installed as follows:

sudo pacman -S xorg-xrandr

Again, with this, the game should run correctly.

Wayland Issues (various)

Currently, the libraries Minecraft uses (LWJGL) have not been updated to properly support Wayland. As such, the game must firstly be run in XWayland (so I’m told; I haven’t tested). There is apparently spotty support with the display modes, since the output of xrandr is different. As such, the game may or may not work, and there are bug reports suggesting various graphical bugs.

Advertisements

One thought on “Minecraft on Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s