Ubuntu setup in Macbook Pro for Steam Proton

Note: I have used Ubuntu 18.04 with Macbook Pro 2017 version.

After hearing so many news about Linux users being able to play games through proton, I could not resist. My laptop that could play decent enough game is a Macbook pro. Therefore I wanted to setup Linux in it. In this article I talk about my setup experience of Ubuntu in Macbook pro. I will also cover my Steam with Proton gaming experience.

Ubuntu Installation in Macbook Pro

I tried booting Ubuntu and Arch and immediately found out that both would not work out of the box. When I first booted Ubuntu, it would not recognize keyboard. Therefore, I was not be able to connect to wifi or edit any settings. Although I could configure grub, as the function keys were not enabled I could not exit out of the edit menu or boot using any of the function keys. Although, Arch was little bit easy on editing grub, but it would freeze during boot.

I started researching about installing Linux in Macbook pro, and found a really good article called Nixaid’s Linux on Macbook Pro. This article goes through most of the setup instructions required for installing Ubuntu. Instead of going through the pain of what the author went through, I took a more easier route. I downloaded remastered iso he created after patching different settings, and used that to boot into Ubuntu. When I booted using the remastered version, keyboard was working out of the box. Couple of issues mentioned in that article is related to audio and network support in Macbook. However, author explained what he did to remedy that. During setup I connected wired connection with my router and for audio I used an external audio player (Fiio X3) which has a built-in DAC, that could work as a sound card. There are cheaper options in Amazon as well for external audio drivers.

After I was comfortable with above settings, I rebooted into Mac, freed up some storage space and started installing Ubuntu. I used around 1 GB space for /boot and everything else for / (root). Since the author had patched all the necessary drivers for the setup to work with Macbook pro, once I rebooted everything worked as expected as pointed out in the article.

EFI

I did not setup a separate efi partition (and was not able to add mac osx as separate boot option in grub). However, my workaround is to use Alt key to wait for Mac boot to let me select proper drive to boot. To save one or the other settings as default for next boot, I used efibootmgr in Linux and bootoption in Mac.

Network

I have not been able to use 5GHz wifi connection, but have been able to use 2.4GHz connection. For that after login I would setup wifi tower power to 10 with following command, and reconnect wifi.

sudo iwconfig wlp3s0 txpower 10

Probably the last value depends upon how far the router is.

Since my router is not too far from where I use my laptop, a value of 10 was enough. However, I did not like doing this all the time, so I ended up editing firmware file as pointed out in this kernel bugzilla discussion. I installed GHex, copied brcmfmac43602-pcie.bin from /lib/firmware/brcm directory to my desktop, edited the file as mentioned in the bugzilla link. After edit radiff2 showed following changes.

$ radiff2 -r brcmfmac43602-pcie.bin brcmfmac43602-pcie.bin.orig
wx 5830 @ 0x0007c82f
wx 3135 @ 0x0007c839

Note: If you also want to edit this file, make sure to not delete any character while editing. Change value of ccode=X0 to ccode=0. and rgrev=15 to rgrev=0.

Don’t forget the dot(.) in both ccode and rgrev values

If you delete any characters instead of overriding, you will get many more lines in radiff2 output than the 2 lines shown above. Once you load the file in GHex editor, browse to 0x0007c82f address and you will find ccode and rgrev next to each other in the output section. Select the value, replace them with appropriate values and save them. It is a good idea to do radiff before copying it back to proper location. Also ,backup original file before replacing it with the changed file. After wifi should connect automatically, without the need to set up txpower again.

Brightness

After every reboot, Ubuntu would always change brightness settings to max. To fix that, I edited /etc/default/grub and changed following line and executed grub-update

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

After above change, brightness settings was saved for each boot. To make sure I can browse different kernels during boot, I also commented out following lines.

#GRUB_TIMEOUT_STYLE=hidden
#GRUB_TIMEOUT=10

Steam

After above setup I installed steam, and was able to play few games. I enabled Proton, and installed Tekken 7. As it was one of the supported games, I used to play in old generation of playstation. However, when I tried to launch the game, it did not start and complained about my graphics driver.

Graphics

I installed amdgpu-pro beta version for Ubuntu. After setup, Tekken would start, but it was flickering on one side and was unplayable. I changed from FullScreen to Windowed mode, turned off VSync, and changed the graphics settings to low. I had watched some youtube videos about similar settings in another game for Steam proton. Therefore tried these settings, before thinking about researching more. After these changes, I was able to start the game without any problem. It crashed couple of times though. After some research, I ended up removing amdgpu-pro and re-enabled default radeon drivers through oibaf/graphics-drivers ppa. I also added following settings to /etc/X11/xorg.conf

Section "Device"
    Identifier "AMDGPU"
    Driver "amdgpu"
    Option "AccelMethod" "glamor"
    Option "TearFree" "on"
    Option "DRI" "3"
EndSection

When I relaunched Tekken, I did not notice any difference compared to amdgpu-pro drivers and was able to play the game without any problems.

IMG_0213

Controller

I have PS4 controller. I wanted Ubuntu to recognized it through bluetooth. In default installation I was not able to connect the controller through bluetooth. However, I was hoping it would be recognized by steam. When I connected it through USB, Steam showed no signs of recognizing the controller. After some research, I found out that I had to install steam-devices package. After installing the package, Steam immediately recognized the controller. The controller worked in big picture mode, however not in any of Proton games. It even worked in native games. After going through few articles, I found out that I had to un-check PlayStation Configuration Support in the controller settings page. After that change, controller worked perfectly in Tekken.

Kernel

Since the patch in remastered image has hook for adding modules for new kernels, I could experiment with few new kernels without breaking the patched modules. However there were couple of issues with newer kernels. Kernel version 4.18 froze in normal boot probably because of incorrect graphics setting and 4.17 would throw some warnings before booting. I was able to boot both kernels in recovery mode. Therefore, I think I might be missing some necessary settings here. I ended up using 4.17, as it recognized my bluetooth controller. I would love to use 4.18, because it sets up desktop resolution and scaling perfectly and I did not need to use GDK_SCALE=2 command before launching steam.

Final Thoughts

I am very happy with the setup. Couple of issues I would like get solved are related to wifi (being able to connect to 5GHz wifi connection), out of the box audio and laptop sleep/suspend support. I am happy with how stable Ubuntu LTS release is. Except couple of issues, everything else works pretty well for me.

References

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s