View on GitHub

razer-blade-stealth-linux

Install and run Linux on a Razer Blade Stealth (late 2016) and Razer Core.

Razer Blade Stealth Linux & Ubuntu 17.10

Razer Blade Stealth (late 2016, Intel 7500U, UHD / HiDPI) Ubuntu Linux 17.10.

1. Issues

Other tutorials reports issues for some topics/components, but on my machine these are running fine.

1.1. Suspend Loop

After resume, the system loops back in suspend. The system send an ACPI event where the kernel defaults are different.

Change kernel defaults:

sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open"

Update grub

sudo update-grub

1.2. Caps-Lock Crash

The RBS crashes randomly mostly if you hit “Caps Lock”, causes by the build-in driver.

Disable Capslocks:

Modify /etc/default/keyboard, replacing capslocks by a second ctrl:

sudo nano /etc/default/keyboard
XKBOPTIONS="ctrl:nocaps"

X11: Disable Built-In Keyboard Driver:

Only needed if you run X11 instead of Wayland and enabled Capslock.

Get your keyboard description and use it instead of “AT Raw Set 2 keyboard”:

xinput list | grep "Set 2 keyboard"

Config

Section "InputClass"
    Identifier      "Disable built-in keyboard"
    MatchProduct    "AT Raw Set 2 keyboard"
#   MatchProduct    "AT Translated Set 2 keyboard"
    Option          "Ignore"    "true"
EndSection

Re’disable keyboard after suspend:

#!/bin/sh
# http://askubuntu.com/questions/873626/crash-when-toggling-off-caps-lock

case $1 in
    resume|thaw)
        xinput set-prop "AT Raw Set 2 keyboard" "Device Enabled" 0
#       xinput set-prop "AT Translated Set 2 keyboard" "Device Enabled" 0
    ;;
esac

1.3. Touchpad Suspend

Touchpad fails resuming from suspend with:

rmi4_physical rmi4-00: rmi_driver_reset_handler: Failed to read current IRQ mask.
dpm_run_callback(): i2c_hid_resume+0x0/0x120 [i2c_hid] returns -11
PM: Device i2c-15320205:00 failed to resume async: error -11

Temporary fix:

sudo rmmod i2c_hid && sudo modprobe i2c_hid

Libinput-gestures solves the problem:

sudo gpasswd -a $USER input
sudo apt install xdotool wmctrl libinput-tools
git clone http://github.com/bulletmark/libinput-gestures
cd libinput-gestures
sudo ./libinput-gestures-setup install
libinput-gestures-setup autostart

My config. (If you prefer natural scrolling, change up/down)

Logout - Login

1.4. Touchpad Temporary Freezes

The touchpad temporary freezes with libinput. Manual update libinput & kernel make it less worse, but it is still buggy.

Switching from Wayland to X11 and libinput to Synaptics solves the problem.

sudo apt install xserver-xorg-input-synaptics

Edit Synaptics configuration: 50-synaptics.conf

Restart and login with X11.

1.5. Touchscreen & Firefox

Firefox doesn’t seem to care about the touchscreen at all.

Tell Firefox to use xinput2:

sudo nano /etc/environment
MOZ_USE_XINPUT2=1

Logout - Login.

1.6. Unstable WIFI

Wireless connection gets lost randomly.

Updating the firmeware:

wget https://github.com/kvalo/ath10k-firmware/raw/master/QCA6174/hw3.0/board.bin
sudo mv board.bin /lib/firmware/ath10k/QCA6174/hw3.0/board.bin
wget https://github.com/kvalo/ath10k-firmware/raw/master/QCA6174/hw3.0/board-2.bin
sudo mv board-2.bin /lib/firmware/ath10k/QCA6174/hw3.0/board-2.bin
wget https://github.com/kvalo/ath10k-firmware/raw/master/QCA6174/hw3.0/4.4.1/firmware-6.bin_WLAN.RM.4.4.1-00079-QCARMSWPZ-1
sudo mv firmware-6.bin_WLAN.RM.4.4.1-00079-QCARMSWPZ-1 /lib/firmware/ath10k/QCA6174/hw3.0/firmware-6.bin

1.7. Onscreen Keyboard

Everytime the touchscreen is used, an onscreen keyboard opens. Disable caribou (the on screen keyboard) in “Startup Applications”.

Display “hidden apps”:

sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop

Open “Startup Applications”, disable caribou (and maybe Desktop Sharing, Backup Monitor and some others).

Remove caribou from “Startup Applications” is not enough:

Blocks caribou (the on screen keyboard) from popping up when you use a touchscreen with a Gnome extension. Manual installation:

mkdir -p ~/.local/share/gnome-shell/extensions/cariboublocker@git.keringar.xyz
cd ~/.local/share/gnome-shell/extensions/cariboublocker@git.keringar.xyz
wget https://github.com/keringar/cariboublocker/raw/master/extension.js
wget https://github.com/keringar/cariboublocker/raw/master/metadata.json
cd
gsettings get org.gnome.shell enabled-extensions

Add Gnome extension (add the new extension to your existing extensions):

gsettings set org.gnome.shell enabled-extensions "['cariboublocker@git.keringar.xyz']"

Logout - Login.

1.8. Multiple Monitors

Using a HiDPI and “normal” monitor works on some applications with Wayland, but not in Firefox & Chrome.

Switch the internal HiDPI screen to 1920x1080 when using your RBS together with a non HiDPI external monitor. Gnome remembers the monitor and switch back to 4k when unplugging the screen.

2. Tweaks

2.1. Power Management

TLP is an advanced power management tool for Linux that tries to apply tweaks for you automatically, depending on your Linux distribution and hardware.

sudo apt-get install tlp tlp-rdw
sudo systemctl enable tlp

2.2. Touchpad

macOS touchpad feeling.

sudo apt install gnome-tweak-tool

2.3. Display Scaling

At native resolution, the internal HiDPI 4K display with 100% scale might be too tiny and frustrating for some, and with 200% scale is too large to be useful, luckily with Ubuntu 17.10 shipping with Gnome3, a native screen scaling solution is provided, however it’s limited to 2 options: 100% and 200%.

To enable more scaling options run the following command:

gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

After login/logout, you’ll get more scaling options under Settings > Devices > Displays.

If the fonts are blurry (on my setup), reset this setting:

gsettings reset-recursively org.gnome.mutter

2.4. “Capitaine” Cursors

2.5. Applicatioins Theme

Current Theme: Adapta-Eta

2.6. Dock & Top Bar

2.7. Fonts

2.8. Workspace Grid

Switch vertical though your workspaces.

Install Workspace Grid. My setup have just vertical workspaces, swipe left/right for switching workspaces:

# .config/libinput.conf
gesture swipe left      _internal ws_down
gesture swipe right     _internal ws_up

3. Razer Core

Running a thunderbolt 3 device like the Razer Core with Linux sounds like fun :)

3.1. Thunderbolt

The Razer Core is connected via Thunderbold 3 with your RBS.

3.1.1. Cable

This 2m cable works without problems. I measured no (performance) differences compared with the included very short cable (tested on Windows & Linux).

3.1.2. User Authorization

git clone https://github.com/01org/thunderbolt-software-user-space.git
cd thunderbolt-software-user-space
apt install cmake libboost-filesystem-dev txt2tags
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
cmake --build .
sudo cmake --build . --target install

tbtadm:

$ tbtadm devices
0-1 Razer Core non-authorized not in ACL
sudo tbtadm approve 0-1

Razer Core USB & Ethernet now works.

3.2. Discrete NVIDIA GPU

Goal is a setup like:

3.2.1. NVIDIA Prime

Install NVIDIA Prime and set it to “intel”:

sudo apt install nvidia-prime
sudo prime-select intel

3.2.2. NVIDIA GPU Driver

Update driver (I use the latest NVIDIA drivers & Ubuntu ‘pre-released updates’):

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo apt install nvidia-387

Add missing NVIDIA symlinks (? not sure if this is only my local problem)

ln -s /usr/lib/nvidia-387/bin/nvidia-persistenced /usr/bin/nvidia-persistenced
ln -s /usr/lib/nvidia-387/libnvidia-cfg.so.1 /usr/lib/libnvidia-cfg.so.1

3.2.3. Bumblebee

Install Bumblebee:

sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
sudo gpasswd -a $USER bumblebee

Update bumblebee config

sudo nano /etc/bumblebee/bumblebee.conf

Changes:

Driver=nvidia
KernelDriver=nvidia-387
LibraryPath=/usr/lib/nvidia-387:/usr/lib32/nvidia-387
XorgModulePath=/usr/lib/nvidia-387/xorg,/usr/lib/xorg/modules

3.2.4. Test GPU With optirun

Reboot with NVIDIA kernel drivers.

Check if NVIDIA driver is used:

$ optirun glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation

NVIDIA Settings

optirun -b none /usr/bin/nvidia-settings  -c :8

3.2.5. Run Extremetuxracer With primusrun

Replace “etr” (Extremetuxracer) with your favorite 3D application/game ;)

PRIMUS_SYNC=1 vblank_mode=0 primusrun etr

Tested with “Extremetuxracer” and different games on “Steam” (Saints Row IV, Life is Strange and others) with 4k resolution on Wayland & X11.

3.3. “razercore” Script

This (ugly) script helps with the typical tasks. Copy razercore into ~/bin or somewhere else in your path and make it executable.

Usage:

3.4. External Display

Use eGPU on external displays.

3.4.1. Connected At Laptop HDMI

Switch to “Single Display” for gaming:

Tested with Samsung TV, XBox 360 controller (plugged in Razer Core) and Steam.

3.4.2. Connected At External GPU

Unsolved: Dynamic expand external display

3.4.3. Expand Display

Permanent expand display with external screen, connected at GPU / Razer Core:

3.4.4. Run Applications ‘Only’ On External Screen

Check if your monitor is detected:

nvidia-xconfig --query-gpu-info
3.4.4.1. Automatic Setup

NOTICE:

Create/Copy/Modify additional bumblebee and NVIDIA configuration:

sudo cp etc/bumblebee/* /etc/bumblebee/

Install Synaptics Xorg driver:

sudo apt install xserver-xorg-input-synaptics

Start an application on the external display:

razercore extern etr

Extreme Tuxracer should now run on your external screen.

I run fluxbox on the external screen and start (mostly games) in this window manager. With a lightweight wm, games like ‘Counter Strike’, ‘Life is Strange’ or ‘Steam in Big Picture Mode’ runs fine.

razercore extern fluxbox

Modify and create your monitor settings, stored in /etc/bumblebee/xorg.conf.external:

optirun /usr/bin/nvidia-settings -c :8
3.4.4.2. Manual Setup

Modify bumblebee.conf:

KeepUnusedXServer=true
PMMethod=none

Modify xorg.conf.nvidia

# Option "AutoAddDevices" "false"
# Option "UseEDID" "false"

Run

/etc/init.d/bumblebee restart # 'razercore restart' is also possible, ignore error messages
export DISPLAY=:8 LD_LIBRARY_PATH=/usr/lib/nvidia-387:$LD_LIBRARY_PATH
optirun true # start X server
etr # replace this with steam or whatever

Extreme Tuxracer should now run on your external screen.

4. Unsolved Issues

4.1. Keyboard Colors & Openrazer

Currently Openrazer not used.

Issue: Settings are lost after suspend (Gnome, Wayland).

But maybe it works for you:

4.2. Webcam

Working only with 176x in cheese, or 640x480 in guvcview with 15/1 frames.

This fix not really helped:

/etc/modprobe.d/uvcvideo.conf

## fix issue with built-in webcam
options uvcvideo quirks=512