Ubuntu Linux on Lenovo Yoga 900-13ISK

Hardware

Model: Lenovo Yoga 900-13ISK (80MK)
Processor: Intel Core i7-6500U dual, 2.5 GHz
Graphics: Intel Skylake GT2 (HD 520), shared mem, 3200x1800 on 13"
Audio: Intel Sunrise Point-LP HD
Network (wired): no
Network (wireless): Intel Wireless 8260 (600 Mbit, N)
Bluetooth: 4.1
Webcam: 1280x720
Media: SDcard
BIOS: F2, boot menu: F12

Lenovo Yoga 900-13ISK
Lenovo Yoga 900-13ISK

Related: [Lenovo Support] [iFixit] [arch] [Anne van Rossum]

Abstract

In 2017-04, I bought a 13" Yoga 900 ISK (not ISK2, those have RAID mode only, which requires a BIOS update before installing Linux). Though missing an OpenCL-capable Nvidia or AMD GPU, the keyboard made up for it by including programmer-friendly Pos1/End/PgUpDown keys (sadly missed in the 920, C930 or C940 models).

I tried using the 3200x1800 touch screen with 150% scaling, but ended up switching to 1920x1080 instead. Monitor out with USB Type C port (3.0 only; includes DisplayPort) worked well out-of-the-box. Unlike my previous Sony Vaio S12, the fan actually shuts up when not needed. And the watch-band hinge is just super aesthetic to use.

Overall I am well pleased with the device; minor remaining issues are:

First install was Ubuntu 16.04 (Xenial Xerus). Currently, I run Ubuntu 18.04 (Bionic Beaver) under a 4.15 kernel. Throughout this guide, I assume that you do sudo su to become root whenever necessary.

Bootup

There is only one slight surprise -- F12 for boot menu will not start your USB stick. For that, F2 into the BIOS and change the boot order, with the USB stick already present.

The M.2 disk manages partitions with GPT, so for backup do [forum1]:

cd /boot/efi
mkdir yoga900_bootsect && cd yoga900_bootsect
sgdisk -b yoga900_gpt.sda /dev/sda

... and restore with sgdisk -l yoga900_gpt.sda /dev/sda if necessary.

Keyboard

On all my previous notebooks, Pos1-PgUp-PgDown-End was the key order on the right side; for some reason this got changed toPos1-End-PgUp-PgDown (the Microsoft Sculpt external keyboard has the same fault).

On Windows, the user-space AutoHotkey app can fix this; on Linux, we can solve the key mapping on the console level or X11 level. Starting with the hardware, a physical key goes through the chain of scancodekeycodekeysym to arrive at either console or X11. As root:

If we were to handle things on console level, directory /usr/share/X11/xkb/keycodes/ contains config files. However we rather opt for X11 level [forum1] [forum2] with directory /usr/share/X11/xkb/symbols/ and its files:

nano -w /usr/share/X11/xkb/symbols/pc
    key <CAPS> { [ ISO_Level3_Shift ] };
    key <HOME> { [ Home  ] };
    key  <END> { [ Prior ] };
    key <PGUP> { [ Next  ] };
    key <PGDN> { [ End   ] };

A re-login or reboot might be necessary for the changes to take effect.

You can also remap X11 keys manually with xmodmap, e.g. depending on which keyboard you have connected at the moment.

xmodmap -e "keycode 66 = ISO_Level3_Shift"
xmodmap -e "keycode 115 = Prior"
xmodmap -e "keycode 112 = Next"
xmodmap -e "keycode 117 = End"

Related: [Andries Brouwer] [Rajinder Sidhu] [thinkpad]

Laptop Lid

Closing the notebook lid leads to a suspend, which is not what I want when there is a large download, e.g. a new Linux distro. With systemd we can modify the login parameters [forum1] [forum2]:

nano -w /etc/systemd/logind.conf
    HandleLidSwitch=ignore

... and it prevents suspend, but blanks screen and touchpad nonetheless, so it is only a partial success.

Touchpad

Under Ubuntu, I could not get Fn+F6 to disable the touchpad to work [arch]:

nano -w /lib/udev/hwdb.d/71-yoga900.hwdb # useless
    evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*:pvrLenovoYOGA900*
     KEYBOARD_KEY_bf=f21

systemd-hwdb update # useless

Palm detection for the rather large touchpad would be useful [forum1], but does not work. However restricting taps on the right side helps already:

nano -w .bashrc
    synclient PalmDetect=1 PalmMinWidth=5 PalmMinZ=20
    synclient AreaLeftEdge=100 AreaRightEdge=1200

... and so at least my right-hand thumb-side palm (opponens pollicis) does not cause accidental mouse clicks.

Screen Auto-Rotation

Under Windows, the screen flips vertically when the hinge exceeds 180°, and at 360° (tablet mode) the screen rotates 90° when held in portrait mode. All of this does not work out-of-the-box under Linux [arch] [nish] [forum1]. But we can do it manually:

apt-get install iio-sensor-proxy

xinput --list # => "Synaptics TM3066-002" id=10
xinput --list-props 10 | awk '/Device Enabled/{print $NF}' # => 0 in tablet mode, 1 normal

nano -w /opt/sbin/yoga_tablet.sh
    #!/bin/bash
    # export TOUCHPAD='SYNA2B29:00 06CB:77C6' # 16.04
    export TOUCHPAD=10 # 18.04
    
    if [ $(xinput --list-props "$TOUCHPAD" | awk '/Device Enabled/{print $NF}') == 1 ]; then
      # keyb already disabled when in tablet mode
      xrandr -o left
      xinput disable "$TOUCHPAD"
      onboard &
    else
      xrandr -o normal
      xinput enable "$TOUCHPAD"
      killall onboard
    fi

Then under Settings->Devices->Keyboard ("+" at bottom of list) or System Settings->Keyboard->Custom Shortcuts, add a new entry "Tablet mode" with Shift+Ctrl+O and command /bin/bash /opt/sbin/yoga_tablet.sh; so we have the tablet mode at least on hotkey.

Ubuntu Malware

Unfortunately, Ubuntu 16.04 Xenial is not completely in the free software spirit anymore, with Amazon malware pre-installed [forum1] [forum2]; seriously, what is this, Windows?

apt-get remove unity-webapps-common unity-lens-shopping # 14.04
apt-get remove ubuntu-web-launchers # 16.04

So my next distro might be Mint (Debian or Ubuntu edition) instead.

Conclusion

The Yoga 900 13-ISK was my least painful Linux installation on a notebook so far. The devil is in the details: Luxuries like palm detection and screen auto-rotate do not work, and keyboard eccentricites may be taste dependent. Intel works against freedom by insisting on binary drivers instead of open source. On the plus side, the hardware is super beautiful and pleasing, not to mention repair-friendly at the same time. Hats off to Lenovo, your move Apple!

With that, I hope you are a bit smarter now than you were 15 minutes ago. If you have any questions or comments, you can reach me via email to kain at the above domain. Thanks for leaving a part of your attention span here, and have a good day!

EOF (Apr:2021)