Razerblade Ubuntu

General

See Roland Guelle’s excellent Razerblade HOWTO and the various xipherzero pages, the Ubuntu community Razer page.

See the Ubuntu compatibility page for hardware info.

Keyboard, trackpad, mouse

See also non-Razer specific Ubuntu keyboard and mouse stuff.

Keyboard lights

Install the dorky keyboard drivers and the dorky GUI, polychromatic.

sudo add-apt-repository ppa:openrazer/stable
sudo add-apt-repository ppa:polychromatic/stable
sudo apt install openrazer-meta polychromatic
# sudo gpasswd -a plugdev user  ## no longer needed?

This is reasonably smooth, but you can get into various kernel-module difficulties. Also note that if you are running a custom user python (e.g. if you load up a virtualenv or anaconda python in your .bashrc) then this will not work, since openrazer inspects your path to find its python.

UPDATE: for some reason this doesn’t work on Ubuntu 19.10 for me. However the competing GUI RazerGenie works fine.

Anyway, after all that fussing, you now have a rainbow-coloured GUI to control your rainbow-coloured keyboard lights! Wheeeee!

Two finger right click

Use GNOME Tweaks.

Horizontal scrolling backwards

It is for me. Per default, vertical scrolling is “natural” and horizontal is “traditional”. Cognitive dissonance.

Here is a generic xinput fix.

xinput --list  # look for a "Synaptics" pointer
xinput --watch-props <id>

finds and dumps info about the erroneous thingy which for me is a Synaptics TM2438-005 at id=15, and

xinput --set-prop <id> "Synaptics Scrolling Distance" -94 -94

fixes it.

It turns out there is a special synaptics command synclient, which also does it.

sudo apt install xserver-xorg-input-synaptics

AFAICT this is deprecated because it doesn’t use the modern libinput although they seem to coexist peacefully on my system so maybe I should not care about that until something breaks nastily.

UPDATE: installing synclient on recent ubuntu seems to cause the backwards horizontal bug. No longer recommended.

The archlinux backgrounder might make it clear if I were inclined to read it.

synclient VertScrollDelta=-94 HorizScrollDelta=-94

This needs to be run after laptop resume also which gets complicated. I needed to set up a script that will talk to X, in /home/me/bin/scrollrite.sh:

#!/bin/bash
#title          :scrollrite.sh
#notes          :Script gets called from /lib/systemd/system-sleep
#==========================================================================
sleep 5
declare -x DISPLAY=":0.0"
declare -x XAUTHORITY="/home/me/.Xauthority"
synclient VertScrollDelta=-94 HorizScrollDelta=-94

Then I need to invoke it after waking.

UPDATE: This after-sleep thing seemed to work for me but as of now, does not. Since the whole problem was transient perhaps I was only imagining it

UPDATE UPDATE: On ubuntu ≥ 19.10 the entire problem seems to have sublimated away and scrolling is consistent.

Power management/suspend/hibernate

The arch guide to sleep/hibernate/standby etc explains the terminology. the TLP debugging guide and FAQ are also useful. Suspend is what I would normally call sleep where the computer just goes quiet and keeps the RAM powered up. Hibernate is when it suspends the whole state of the machine to RAM. It is unclear to me whether the default setup is safe for encryption. (i.e. can someone access your laboriously encrypted disk by making sure they steal your computer while it is in sleep mode?) It wasn’t, although various bugs have been closed now so maybe it is fine. Certainly encrypted hibernate is possible. Is it enabled per default on the modern config?

Fails to sleep when lid closed

Things seem to go weird for me, especially with nvidia drivers which apparently is common.

The problem produces the following error:

Freezing of tasks failed after 20.00 seconds (21 tasks refusing to freeze, wq_busy=21):
...<nvidia related stacktrace>

Keeps on suspending again after suspending once

After the laptop has gone to sleep one time it has narcolepsy and keeps sleeping again?

I found this fix somewhere: append button.lid_init_state=open to the value of GRUB_CMDLINE_LINUX_DEFAULT="" in /etc/default/grub then

update-grub

to add this to the boot conf.

My screen never powers off even when laptop is idle

Weird, mine too. But no longer. I fixed it using dpms:

xset dpms 0 0 600

Logs out on suspend on battery

Still diagnosing this one. See the settings in /etc/systemd/logind.conf.

Fan control

Fan control is weird and sounds like a jet aircraft sound only intermittently like a jet aircraft in the latest update. Perhaps fancontrol could help?

webcam

Notably webcam is broken. Webcam works fine in Ubuntu 19.10 in videoconferencing although weirdly not in the in-built webcam app Cheese.

If you are on an older version, try these? The archlinux page has some suggestions for the webcam thing. Specifically, put

options uvcvideo quirks=512

in /etc/modprobe.d/uvcvideo.conf.

That does not fix it for me.

NVMe drive not detected

Happens on certain drives

Add

nvme_core.default_ps_max_latency_us=200

to the boot string. This is something about power saving, plus possibly also firmware, which seems common. It also seems one can avoid this issue by buying the Samsung EVO SSDs.

Maybe also use nvme-cli to check drive health.

Make the fix permanent with /etc/default/grub then

sudo update-grub

Installer hangs

Add

nomodeset acpi_osi

to the kernel string. doesn’t seem necessary with kernels >4.10.

Migrating disks

See the ubuntu resize instructions.

Wifi does not reconnect after sleep/hibernate

This problem on Ubuntu 19.10 occasionally causes my laptop not to reconnect to the wifi after wacking from suspend. Toggling the buttons int he wifi manager doesn't fix it; I'm offline until reboot.

Nothing obviously wrong in the logs except that the network connection times out. I think that it is related to which Wifi network router I am connecting to. Since I cannot access the internet when the problem occurs, I will copy and paste various suggested solutions here so that I attempt fixes.

Restart network-manager.service

For systemd systems, try

sudo systemctl restart network-manager.service

If this works, you can create a script to automate it. Put the following in `sudo nano /etc/systemd/system/wifi-resume.service:

#/etc/systemd/system/wifi-resume.service
#sudo systemctl enable wifi-resume.service
[Unit]
Description=Restart networkmanager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
ExecStart=/bin/systemctl restart network-manager.service

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

Now to use it:

# activate
sudo systemctl enable wifi-resume.service
# check status
systemctl status wifi-resume.service

Without systemd, create a script in /etc/pm/sleep.d (any name), set the executable bit via chmod +x, and insert the following content:

case "${1}" in
    resume|thaw)
        # systemctl restart network-manager.service
        service NetworkManager restart
;;
esac

Other commands suggested:

# option 1
sudo iwlist $(ifconfig | grep -Po '^w\w+') scan
# option 2
sudo {
  service network-manager stop;
  sleep 5;
  sudo service network-manager start;
}`

Direct networkmanager intervention

nmcli nm sleep false

Or, perhaps it is the wmac spoofing bug? To /etc/NetworkManager/NetworkManager.conf add the line

[device]
wifi.scan-rand-mac-address=no

AFAICT this is not my problem.