GeekSocket Plug in and be Geekified

How to play Steam games on Fedora

In Steam Summer sale of 2017, I had bought Left 4 Dead 2 just for Rs. 64. I played it once or twice and after that never played it again, as it was installed on Windows. I no longer use Windows on my laptop. Left 4 Dead 2 is also available for Steam OS (works on other Linux distros too), so I decided to install it on Fedora.


Installing Steam on Fedora

SimoneCaronni who is the author of negativo17.org has already packaged Steam for Fedora and it works perfectly. If you already have RPM Fusion repos enabled, you can just run the following command to install Steam. You can read more about this Steam repo at negativo17.org/steam

$ sudo dnf install steam

If you don’t have RPM Fusion repos, you can enable them by following the instruction from rpmfusion.org/Configuration

Steam System Information


Let’s play Left 4 Dead 2

The game was lagging and I was getting 20 to 30 FPS even with low settings. While reading negativo17.org I realized that the game was not using dedicated GPU, which is AMD Radeon™ 8000 M. It was using integrated GPU instead.


Running games with Dedicated Graphics Card

First check if your machine has drivers for your Graphics Card, you can check this by going to Settings -> Details, it should show two graphics card one is integrated and other is dedicated.

fedora details about

You can check this by running the following command too,

$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD OLAND (DRM 2.50.0 / 4.13.13-300.fc27.x86_64, LLVM 4.0.1)


$ DRI_PRIME=0 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile

If it shows just integrated graphics card try to search for the drivers for your card. (Most of the cards are supported by default) source


Once you get your card working, go to Properties of game -> SET LAUNCH OPTIONS...

and set the options as DRI_PRIME=1 %command% this will force the game to use dedicated graphics card. source, Read more about PRIME

setting dedicated graphics

After doing this I got nearly 60 FPS and game was not lagging.


Playing Insurgency

This month during Autumn sale, HemRobotics gifted me the game Insurgency. As described above, I changed the launch options but the game failed to start, even though Steam was showing it as running. It was running fine without DRI_PRIME=1 or with DRI_PRIME=0, doing ps and grep showed the actual command used to launch the game

$ ps -aux | grep /opt/steam
bhavin1+ 4159  0.0  0.0 173320  6900 tty2     S+   22:05   0:00 /bin/bash /opt/steamlibrary/steamapps/common/insurgency2/insurgency.sh -console
bhavin1+ 4162  2.5  0.3  58616 29952 tty2     Sl+  22:05   0:00 /opt/steamlibrary/steamapps/common/insurgency2/insurgency_linux -game insurgency -console

The shell script is used to set the required paths and launch the binary of game. Running the whole command in terminal, showed some error related to radeonsi_dri.so after searching for a while and trying all the available solutions with no success, I found this forum post.

The solution provided there (deleting the libgcc_s.so.1 provided with game files) was working fine, which means it was using libgcc_s.so.1 from somewhere else.


Finding the solution

After searching, found this question on Stack Overflow,

ldd shows the all the files on which the current binary is depending, but it does not show the exact path to the files.

$ ldd /opt/steamlibrary/steamapps/common/insurgency2/insurgency_linux
    linux-gate.so.1 (0xf7fae000)
    libm.so.6 => /lib/libm.so.6 (0xf7e46000)
    libdl.so.2 => /lib/libdl.so.2 (0xf7e41000)
    libstdc++.so.6 => /lib/libstdc++.so.6 (0xf7cbd000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xf7c9e000)
    libc.so.6 => /lib/libc.so.6 (0xf7add000)
    /lib/ld-linux.so.2 (0xf7fb0000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7ac0000)

While game is running we can get list of all libraries it uses with the following command. (Stack Overflow answer)

$ lsof -P -T -p 4162

COMMAND    PID      USER   FD      TYPE             DEVICE  SIZE/OFF    NODE NAME
insurgenc 4162 bhavin192  cwd       DIR                8,9      4096 1843423 /opt/steamlibrary/steamapps/common/insurgency2
...
insurgenc 4162 bhavin192  mem       REG                8,8   1373800 8658095 /usr/lib/libm-2.26.so
insurgenc 4162 bhavin192  mem       REG                8,8    112368 8658142 /usr/lib/libgcc_s-7-20170915.so.1
insurgenc 4162 bhavin192  mem       REG                8,8    186792 8654428 /usr/lib/ld-2.26.so
insurgenc 4162 bhavin192    0r      CHR                1,3       0t0      17 /dev/null
...

So the file is /usr/lib/libgcc_s-7-20170915.so.1

$ ls -ll /usr/lib/libgcc_s.so.1
lrwxrwxrwx. 1 root root 24 Sep 15 16:57 /usr/lib/libgcc_s.so.1 -> libgcc_s-7-20170915.so.1

libgcc_s.so.1 is symlink of libgcc_s-7-20170915.so.1, if we load this file while starting the game, it will use correct library without modifying any game files.


Launch options for Insurgency

LD_PRELOAD='/usr/lib/libgcc_s.so.1' DRI_PRIME=1 %command%

Read more about LD_PRELOAD


Using steamcmd

Steam has command line tool which is used to setup servers for some games. This tool can be used to download games for other platforms too.

If you want to download games for Windows machine you can do by using this tool.

Simply follow the instructions given on official page. You will need app_id of the game which can be found by visiting the game page on Steam.

Let’s try it on DiRT Rally,

URL: http://store.steampowered.com/app/310560/DiRT_Rally

$ ./steamcmd.sh [email protected] windows +login <steam_id> <password> +force_install_dir ../dirt-rally +app_update 310560 validate +quit

Once you get the files, copy dirt-rally folder to the steamlibrary folder on Windows machine where all the games are present.

Copy the appmanifest_310560.acf file from the dirt-rally to the SteamApps folder, where all other .acf files are present. Rename dirt-rally folder to the name which is given in theappmanifest_310560.acf file, in this case it will be DiRT Rally
source


Comments

comments powered by Disqus