How I Got Skyrim to Work on Linux

When I decided to convert my home computer environment to Linux, I focused intensely on how I would convert my writing and publishing workflow. Coming from a background of having used Linux, Ubuntu specifically, on and off for more than a decade, I casually assumed that gaming was not even worth investigating.

When I installed and began evaluating Linux this time around, I noticed Steam was available in my operating system's software center. Intrigued, I installed it and logged in. To my shock and amazement, most of my favorite games were available to install natively. Even more shocking, Steam now comes loaded with a Windows emulator called Proton, which allows running any Windows game in an emulation container on Linux. Performance degradation is generally not an issue. However, compatibility can be.

The Elder Scrolls V: Skyrim came immediately to mind. It has only ever been available on Windows, never on Mac. When I decided to delete the Windows partition of my iMac in 2012, I lost the ability to play Skyrim for good. And so, upon discovering Proton, I immediately set out to emulate the game.

In order to enable emulation for a game on Steam, you first have to see it. In your Steam Library, select "Games" in the Steam search filter to see all your games, instead of just the ones that run on your current operating system. Skyrim won't show up under the Linux filter until you've enabled it for emulation. Once you have the list of all games, find Skyrim, right click on it, and select "Properties".

Steam Properties Panel for *Skyrim*
Tick the checkbox next to "Force the use of a specific Steam compatibility tool". A dropdown should appear beneath it defaulting to "Proton #.#-#".

Skyrim should now have an install button, and you should also be able to see it when changing the Library filter back to "SteamOS + Linux".

You can now install and run Skyrim the way you would any other Steam game. Steam will automatically launch the Windows executable inside a Proton emulation shell.

However, emulation is not perfect. In the case of Skyrim running on Pop!_OS 19.04 and Steam with Proton 4.2-9, there is one big problem to solve before you can have a native-like experience. When you first launch Skyrim, you will notice a distinct lack of music, and, most jarringly, a distinct lack of character voices.

This is the result of the fact that Skyrim's music and voice acting files are saved with an encoding called WMA. The decoders for WMA are freely available from the vendor, but not freely distributable by a third party. This means that, while it's possible to freely obtain the decoders, it's not possible for Steam to give you a version of Proton with those encoders embedded.

There are two potential solutions to this problem:

  1. Force Proton to route WMA audio files through the native audio system of your operating system, rather than through Proton.
  2. Build a custom version of Proton's audio library, FAudio, which has WMA-decoding capability via the freely available ffmpeg module.
Multiple sources indicated that the first option has a high likelihood of causing the game to crash, whereas the second option would provide a more graceful playing experience. I opted for the second solution.

The best instructions on how exactly to achieve the build portion of the second solution I found here, but I found my situation differing somewhat, probably due to the version of Linux I am running and changes made to Steam and Proton since those instructions were written.

In the rest of this post, I'll describe the steps I took to get everything working.

Step 1: Install Dependencies

I had to fumble through this step myself, as all other documentation seemed to assume I'd just have all this stuff on my system. The source code we're going to build has dependencies, and those dependencies need to be installed for the build to work. Run the following command (which should work on most Debian-based Linux distributions like Ubuntu and Pop!_OS):
sudo apt-get install libsdl2-dev libavcodec-dev libavutil-dev libswresample-dev 
This Reddit thread was particularly helpful in uncovering the mystery.

Step 2: Build a Version of FAudio with FFMPEG

I decided to build FAudio in a temp folder I made inside my user directory.
mkdir temp cd temp 
All the commands from the Proton-FAudio instructions should now work. Importantly, though, be sure to add the make flags, which the Proton-FAudio instructions only include toward the bottom of the document.
git clone git://github.com/FNA-XNA/FAudio.git cd FAudio mkdir build cd build cmake .. -DXNASONG=OFF -DFFMPEG=ON make 
Use ls on the ~/temp/FAudio/build directory to check the name of the file that was built. In my case, I ended up with a file called libFAudio.so.0.19.06.

Step 3: Replace Proton's Version of FAudio with the One You Just Made

The instructions say to copy the built file to ~/.local/share/Steam/steamapps/common/Proton\ #.##/dist/lib64, but I ran into trouble when trying to navigate there. That directory didn't exist on my computer.

This is where an old Linux command line trick came in very handy. I ran find ~ -name "steamapps". This command searches my home directory (aliased as ~) for a file or folder called "steamapps". Lo, I uncovered ~/.steam/debian-installation/steamapps/common/Proton\ 4.2/dist/lib64.

Use the find command to figure out where your Steam installation is living, and then you can follow all the rest of these steps substituting your Steam path for mine. I'll also be using the path to my build directory. Again, substitute yours for mine if you did something different.

The .../Proton\ 4.2/dist/lib64 directory contents should look like this:

Partial contents of `~/.steam/debian-installation/steamapps/common/Proton\ 4.2/dist/lib64`
The actual libFAudio library is the file called libFAudio.so.0.19.06. The file libFAudio.so.0 is just a kind of pointer (called a "symbolic link") to the actual file, as indicated by the arrow. The same goes for libFAudio.so. Anyone calling either of those links will simply end up pointing to libFAudio.so.0.19.06.

The instructions call for changing the symbolic links, but that's unnecessary. We just need to replace libFAudio.so.0.19.06.

First, let's rename the ffmpeg-less libFAudio to something else. We want to keep it around as a backup, just in case. mv is the Linux command to move a file.

cd ~/.steam/debian-installation/steamapps/common/Proton\ 4.2/dist/lib64/ mv libFAudio.so.0.19.06 libFAudio.so.0.19.06.bak 
Now, we can copy in the version of FAudio we just built. Again, your exact directories may be different than mine. cp is the Linux command to copy a file.
cp ~/temp/FAudio/build/libFAudio.so.0.19.06 ~/.steam/debian-installation/steamapps/common/Proton\ 4.2/dist/lib64/libFAudio.so.0.19.06 
Now the symbolic links should be pointing to the libFAudio file we just created, rather than the one that came with Steam. Fire up Skyrim, and you should now have working voices and music.

If you're curious whether or not a particular favorite game of yours will run on Linux, check out ProtonDB. Anything marked "native" you can expect to just install via Steam and have it work out of the box. Skyrim is considered "gold." There's a bit of system finagling to do, but after that, it just works.

Categories:
Tags: