Ubuntu – Crash when toggling off CAPS LOCK

16.10capslockcrashlightdmxorg

Installed Ubuntu 16.10 on a Late 2016 Razer Blade Stealth. When I hit CAPS LOCK, the light indicator for it comes on, and it works. But when I hit it again to toggle it off, the screen gets covered in rectangular glitches, sometimes static plays on the speakers, and the device becomes unresponsive but does not reboot. A crash of some sorts.

I'm not sure if this is related to X server, lightdm, or even a kernel crash? I'm not really sure what logs to look at to even begin to start debugging.

If I disable lightdm with:

sudo systemctl stop lightdm.service

then hit ctrl+alt+F1 (no fn key) to get a text prompt, CAPS LOCK has no issue.

What could possibly be going wrong, and how do I start triaging this?

Edit 1: dupe of Uncheck caps lock crashes Ubuntu installation, insufficient answer

Edit 2: some other things I've tried:

  • ssh into the box to see if I can collect dmesg and xorg logs as per here. ssh session becomes unresponsive after host crashes.
  • try different desktop environments
  • try different window managers

Best Answer

I also have a New Razer Blade Stealth and I had the same problem but fixed it installing the razer keyboard driver for linux which you can find here on GitHub and disabling the built in keyboard driver.

There's a PPA for Ubuntu (16.04 and newer):

sudo add-apt-repository ppa:openrazer/stable
sudo apt update
sudo apt install openrazer-meta

If you get dependency errors when trying to install these driver packages make sure that you have enabled the universe repository in Software & Updates. There is also a development PPA (ppa:openrazer/daily).

Reboot, or insert the new module from the terminal:

sudo modprobe razerkbd

After installing the driver you should see it

lsmod | grep "razerkbd"

Second disable the built-in keyboard driver that causes the problem. First find the name of the driver.

xinput list

Disable it ("AT Raw Set 2 keyboard" in my case)

xinput set-prop "AT Raw Set 2 keyboard" "Device Enabled" 0

If this no longer produces an error, make the changes permanent.

cd /etc/X11/
sudo mkdir xorg.conf.d
cd xorg.conf.d/
sudo touch 20-razer.conf
sudo xed 20-razer.conf 

Copy the following to 20-razer.conf

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

Reboot and check that the CAPS-lock key no longer produces the crash.