Gentoo Linux on the Lenovo Thinkpad X1 Tablet Third Gen (X1Y3 / 20KJ / 20KK)
The following write up covers my trials and tribulations getting everything working properly on this device. While my instructions are Gentoo specific, this should be useful no matter what distro you’re running. If you are NOT using Gentoo, just keep in mind when I enable “USE flags” for packages in Gentoo, this automatically pulls in any dependencies necessary to enable those features. In your distro, it may be necessary to install additional packages not listed. For example: To install Apache with mod_php in Gentoo you can simply enable the “apache2” USE flag in dev-lang/php. In Fedora or Debian … you’ll need to install a separate package for mod_php (typically something like httpd-php7 or similar). Also bear in mind I’m using KDE Plasma for my DE, so you’ll need to swap out with equivalent things in your DE of choice when it comes to that. With that caveat out of the way … let’s get to hardware info and setup.
Hardware Info
# hwinfo --short all cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3775 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3636 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3700 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3747 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3700 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3692 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3712 MHz Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz, 3711 MHz keyboard: Lenovo ThinkPad X1 Tablet Thin Keyboard Gen 3 /dev/input/event2 AT Translated Set 2 keyboard mouse: Lenovo ThinkPad X1 Tablet Thin Keyboard Gen 3 /dev/input/mice Wacom HID 511A Pen /dev/input/mice Wacom HID 511A Finger monitor: LG Display LCD Monitor graphics card: Intel VGA compatible controller sound: Intel Audio device storage: Samsung Electronics Non-Volatile memory controller network: wlp4s0 Intel WLAN controller network interface: wlp4s0 Ethernet network interface bond0 Ethernet network interface lo Loopback network interface disk: /dev/nvme0n1 Samsung Electronics Disk partition: /dev/nvme0n1p1 Partition /dev/nvme0n1p2 Partition /dev/nvme0n1p3 Partition /dev/nvme0n1p4 Partition /dev/nvme0n1p5 Partition /dev/nvme0n1p6 Partition /dev/nvme0n1p7 Partition usb controller: Intel USB Controller bios: BIOS bridge: Intel PCI bridge Intel ISA bridge Intel PCI bridge Intel Host bridge Intel PCI bridge Intel PCI bridge hub: Linux Foundation 2.0 root hub Linux Foundation 3.0 root hub memory: Main Memory bluetooth: Intel Bluetooth Device unknown: FPU DMA controller PIC Keyboard controller Intel Memory controller Intel Sky Lake Gaussian Mixture Model Intel Signal processing controller Realtek Unclassified device Intel Unclassified device Intel Signal processing controller Intel Multimedia controller Intel Communication controller Intel Signal processing controller Intel Signal processing controller Intel Signal processing controller Intel Signal processing controller Intel Signal processing controller Intel SMBus Intel Sky Lake Imaging Unit Lite-On Integrated Camera Lenovo ThinkPad X1 Tablet Thin Keyboard Gen 3
# lspci 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08) 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07) 00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08) 00:05.0 Multimedia controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit (rev 01) 00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model 00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-LP Integrated Sensor Hub (rev 21) 00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21) 00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21) 00:14.3 Multimedia controller: Intel Corporation Device 9d32 (rev 01) 00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21) 00:15.1 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #1 (rev 21) 00:15.2 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #2 (rev 21) 00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21) 00:1c.0 PCI bridge: Intel Corporation Device 9d11 (rev f1) 00:1c.3 PCI bridge: Intel Corporation Device 9d13 (rev f1) 00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1) 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1) 00:1e.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO UART Controller #0 (rev 21) 00:1e.3 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO SPI Controller #1 (rev 21) 00:1f.0 ISA bridge: Intel Corporation Intel(R) 100 Series Chipset Family LPC Controller/eSPI Controller - 9D4E (rev 21) 00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21) 00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21) 00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21) 02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01) 04:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78) 05:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981
# lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 004: ID 8087:0a2b Intel Corp. Bus 001 Device 003: ID 04ca:706b Lite-On Technology Corp. Bus 001 Device 005: ID 17ef:60b5 Lenovo Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ Wacom HID 511A Pen stylus id=15 [slave pointer (2)] ⎜ ↳ Wacom HID 511A Finger touch id=16 [slave pointer (2)] ⎜ ↳ Wacom HID 511A Pen eraser id=23 [slave pointer (2)] ⎜ ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 Consumer Control id=11 [slave pointer (2)] ⎜ ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 Mouse id=13 [slave pointer (2)] ⎜ ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 Touchpad id=22 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Video Bus id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Integrated Camera: Integrated C id=14 [slave keyboard (3)] ↳ Intel Virtual Button driver id=17 [slave keyboard (3)] ↳ Intel HID events id=18 [slave keyboard (3)] ↳ Intel HID 5 button array id=19 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=20 [slave keyboard (3)] ↳ ThinkPad Extra Buttons id=21 [slave keyboard (3)] ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 id=8 [slave keyboard (3)] ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 System Control id=9 [slave keyboard (3)] ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 Wireless Radio Control id=10 [slave keyboard (3)] ↳ Chicony ThinkPad X1 Tablet Thin Keyboard Gen 3 Consumer Control id=12 [slave keyboard (3)]
Kernel Config
Quite a few things you’ll need aren’t enabled by default by genkernel, so you’ll want to go over this list carefully if you are using Gentoo. If you’re using a binary distro you’ll still not want to entirely skip this over, as I did have to patch my kernel to get support for the trackpoint. Speaking of, here’s a link to the patch which is in the Linux kernel, but less than 30 days old as of the time of this writing. This means unless you’re rocking kernel 5.0.2 or so or newer (or have backports that recent) … you’ll need to manually patch your kernel too for trackpoint support. You’ll want the following options enabled:CONFIG_NVME_CORE=m CONFIG_BLK_DEV_NVME=m CONFIG_THINKPAD_ACPI=m CONFIG_THINKPAD_ACPI_ALSA_SUPPORT=y CONFIG_THINKPAD_ACPI_VIDEO=y CONFIG_THINKPAD_ACPI_HOTKEY_POLL=y CONFIG_IWLWIFI=m CONFIG_IWLWIFI_LEDS=y CONFIG_TOUCHSCREEN_WACOM_W8001=m CONFIG_TOUCHSCREEN_WACOM_I2C=m CONFIG_HID_WACOM=m CONFIG_HID_MULTITOUCH=m CONFIG_HID_GENERIC=y CONFIG_INPUT=y CONFIG_INPUT_LEDS=y CONFIG_INPUT_EVDEV=y CONFIG_INPUT_KEYBOARD=y CONFIG_INPUT_MOUSE=y CONFIG_INPUT_TABLET=y CONFIG_INPUT_TOUCHSCREEN=y CONFIG_INPUT_MISC=y CONFIG_USB_VIDEO_CLASS=m CONFIG_BT=m CONFIG_BT_HIDP=m CONFIG_BT_HS=y CONFIG_BT_LE=y CONFIG_BT_INTEL=m CONFIG_BT_HCIBTUSB=m CONFIG_SND_HDA=m CONFIG_SND_HDA_INTEL=m CONFIG_SND_HDA_PREALLOC_SIZE=2048 # Because of PulseAudio CONFIG_MICROCODE=y CONFIG_MICROCODE_INTEL=y
Recommended Packages
# eix powertop [I] sys-power/powertop Available versions: 2.8 2.9 **9999 {X nls unicode KERNEL="linux"} Installed versions: 2.9(01:44:36 AM 03/22/2019)(X nls unicode KERNEL="linux") Homepage: https://01.org/powertop/ Description: tool that helps you find what software is using the most power # eix fwts [I] sys-apps/fwts Available versions: (~)15.12.00 (~)17.02.00 Installed versions: 17.02.00(04:06:11 AM 03/22/2019) Homepage: https://wiki.ubuntu.com/Kernel/Reference/fwts Description: Firmware Test Suite # eix onboard [I] app-accessibility/onboard [1] Available versions: (~)1.4.1^m Installed versions: 1.4.1^m(08:13:09 PM 03/20/2019)(PYTHON_TARGETS="python3_6 -python3_4 -python3_5") Homepage: https://launchpad.net/onboard Description: Onscreen keyboard for everybody who cant use a hardware keyboard [1] "salfter" /var/lib/layman/salfter (overlay) # eix wacom [I] dev-libs/libwacom Available versions: 0.30 {doc static-libs} Installed versions: 0.30(05:28:59 PM 03/04/2019)(-doc -static-libs) Homepage: https://github.com/linuxwacom/libwacom Description: Library for identifying Wacom tablets and their model-specific features [I] kde-misc/wacomtablet Available versions: (5) 3.1.1 {debug +handbook test} Installed versions: 3.1.1(5)(05:30:05 PM 03/04/2019)(handbook -debug -test) Homepage: https://www.linux-apps.com/content/show.php?action=content&content=114856 Description: KControl module for Wacom tablets [I] x11-drivers/xf86-input-wacom Available versions: 0.36.0-r2 {debug KERNEL="linux"} Installed versions: 0.36.0-r2(02:39:15 AM 03/05/2019)(-debug KERNEL="linux") Homepage: http://linuxwacom.sourceforge.net/ Description: Driver for Wacom tablets and drawing devices # eix intel-microcode [I] sys-firmware/intel-microcode Available versions: 20180807a_p20190309^mbsd {hostonly initramfs +split-ucode vanilla KERNEL="linux"} Installed versions: 20180807a_p20190309^mbsd(04:23:53 AM 03/22/2019)(initramfs split-ucode -hostonly -vanilla KERNEL="linux") Homepage: http://inertiawar.com/microcode/ https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=28087 Description: Intel IA32/IA64 microcode update data # eix blue | grep -A2 -B3 Installed [I] dev-qt/qtbluetooth Available versions: (5) 5.11.3(5/5.11)^t ~5.12.1(5/5.12)^t ~5.12.2(5/5.12)^t {debug qml test} Installed versions: 5.11.3(5/5.11)^t(04:13:59 PM 03/04/2019)(qml -debug -test) Homepage: https://www.qt.io/ Description: Bluetooth support library for the Qt5 framework -- [I] kde-frameworks/bluez-qt Available versions: (5) 5.54.0(5/5.54) ~5.56.0(5/5.56) {debug doc test} Installed versions: 5.54.0(5/5.54)(02:37:48 PM 03/01/2019)(-debug -doc -test) Homepage: https://www.kde.org/ Description: Qt wrapper for Bluez 5 DBus API -- [I] kde-plasma/bluedevil Available versions: (5) 5.14.5 ~5.15.3 {debug} Installed versions: 5.14.5(5)(03:52:10 PM 03/03/2019)(-debug) Homepage: https://cgit.kde.org/bluedevil.git Description: Bluetooth stack for KDE Plasma -- [I] net-wireless/bluez Available versions: 5.49-r1(0/3) 5.50-r1(0/3) {alsa btpclient cups debug deprecated doc experimental extra-tools +mesh +obex +readline selinux systemd test test-programs +udev user-session ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32" PYTHON_TARGETS="python2_7"} Installed versions: 5.50-r1(0/3)(12:49:58 PM 03/04/2019)(alsa btpclient cups deprecated extra-tools mesh obex readline udev -debug -doc -experimental -selinux -systemd -test -test-programs -user-session ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" PYTHON_TARGETS="python2_7") Homepage: http://www.bluez.org Description: Bluetooth Tools and System Daemons for Linux # eix fwupd [I] sys-apps/fwupd Available versions: ~1.2.4-r2 (~)1.2.5 {colorhug dell doc elogind +gpg +man nvme pkcs7 redfish systemd test thunderbolt uefi PYTHON_SINGLE_TARGET="python3_4 python3_5 python3_6 python3_7" PYTHON_TARGETS="python3_4 python3_5 python3_6 python3_7"} Installed versions: 1.2.5(11:39:56 PM 03/21/2019)(gpg man nvme thunderbolt uefi -colorhug -dell -doc -elogind -pkcs7 -redfish -systemd -test PYTHON_SINGLE_TARGET="python3_6 -python3_4 -python3_5 -python3_7" PYTHON_TARGETS="python3_6 -python3_4 -python3_5 -python3_7") Homepage: https://fwupd.org Description: Aims to make updating firmware on Linux automatic, safe and reliable # eix terminus [I] media-fonts/terminus-font Available versions: 4.46 ~4.47 {X a-like-o +center-tilde distinct-l +pcf +pcf-unicode-only +psf quote ru-dv +ru-g ru-i ru-k} Installed versions: 4.46(04:53:28 PM 03/04/2019)(X center-tilde pcf pcf-unicode-only psf ru-g -a-like-o -distinct-l -quote -ru-dv -ru-i -ru-k) Homepage: http://terminus-font.sourceforge.net/ Description: A clean fixed font for the console and X11 Write by Stylus Labs: http://www.styluslabs.com
Setup Dual Boot Quickly
The following is how I setup things so that I could install Linux setup for dual boot while Windows 10 installed a billion updates. I keep Windows 10 around mostly to test websites in IE/Edge, but it is also an easy way to update the BIOS and firmware through the Lenovo software update thing.
1) Install VirtualBox including the Extension Pack for Windows.
2) Download SystemRescueCD 5.3.2 (the last version they released based on Gentoo, but still quite current) and set it up in VirtualBox as a boot CDROM.
3) Use Windows Disk Manager (search “Disk Manager” in the start menu) to resize Windows and create new partitions. DO NOT have Windows format the partitions for you. Having Windows resize itself is necessary because Lenovo ships Windows by default BitLocker encrypted. Windows can shrink itself on a running drive and create new partitions on said drive. I personally setup a root partition, LUKS encrypted home partition, and swap partition (for hibernation purposes, and because you’d be surprised how much memory webkit or chromium take when compiling).
4) Use the following trick to be able to mount real partitions as drives in VirtualBox. Note this requires launching VirtualBox and the Windows CMD prompt as Administrator.
5) Go ahead and update Windows and use the Lenovo portal to update system firmware, BIOS, drivers, etc. Note that if you have to reboot at any time you can simply have VirtualBox freeze the VM and you can then pick up your Linux install where you left off after rebooting.
6) Complete installation of Linux using your distro’s instructions, but keeping in mind the specific hardware and settings mentioned above.
Post Install Tweaks
BIOS Changes
You’ll definitely want BIOS assist mode on for Thunderbolt. I also in general turn off all the Intel ME/TPM stuff that I possibly can. If Lenovo has shipped an updated BIOS by the time you read this (see below), be sure to enable “Linux” mode for sleep in the BIOS.
Important USE Flags
# cat /etc/portage/package.use/* net-wireless/bluez btpclient extra-tools deprecated sys-apps/fwupd nvme thunderbolt uefi >=sys-boot/grub-2.02-r1 mount sys-firmware/intel-microcode initramfs app-portage/layman subversion media-sound/pulseaudio native-headset ofono-headset
Intel Microcode
This will help patch some (but not all) CPU vulnerabilities as well as improve any issues stemming from errata relating to bugs in CPU design. Edit/Add the following line to /etc/default/grub to load the Microcode at boot: GRUB_EARLY_INITRD_LINUX_CUSTOM=”intel-ucode.cpio” Run the following commands, noting that the first is to install if you’re not using Gentoo:
# emerge -va --quiet sys-firmware/intel-microcode # iucode_tool -S --write-earlyfw=/boot/intel-ucode.cpio /lib/firmware/intel-ucode/* # grub-mkconfig -o /boot/grub/grub.cfg (Or whatever the command is to regenerate the GRUB2 config on your distro)
Custom DSDT Tables for S3 Sleep
As of the time of this writing, Lenovo has not shipped a BIOS for this machine with proper S3 listings for deep sleep in the BIOS. This is because this newer Intel system supports a software deep suspend that gives the OS greater granular control over what goes to sleep and how deeply it goes to sleep. This is sadly a highly Windows-centric and specific feature and was pushed by Microsoft as their preferred way to do things. Lenovo has shipped updated BIOS images for similar Thinkpad hardware giving a new BIOS option for proper S3 sleep in Linux. If you don’t patch the DSDT tables, you’ll get maybe a half day to a day on sleep. If you have proper S3 sleep it’s more like a week of sleep time. Read here (be sure to scroll down!) for the somewhat involved details for creating your own DSDT tables and patching them over your BIOS ACPI tables at boot time. Note this means you’ll be modifying the GRUB2 line you’ve already touched above to deal with Microcode. And since you just modified GRUB2 let’s go ahead and cover all the changes we’re going to make in GRUB2:
GRUB2 Tweaks
Note that by adding the “mount” USE flag to GRUB2 above, if you now install os-prober Gentoo will automatically search for Windows installs and add them to your GRUB2 config. In addition I’ve changed the following settings in my /etc/default/grub:
GRUB_FONT=/boot/grub/terminus.pf2 # High DPI monospace console font GRUB_GFXMODE=3000x2000 # Native Resolution GRUB_CMDLINE_LINUX_DEFAULT="quiet mem_sleep_default=deep resume=/dev/nvme0n1p4" # Sleep line default behavior after kernel 4.18, resume should point to your swap partition (or file) GRUB_EARLY_INITRD_LINUX_CUSTOM="intel-ucode.cpio acpi_override" GRUB_GFXPAYLOAD_LINUX=keep GRUB_BACKGROUND="/boot/grub/aurora.png" # Use any 3000x2000 png you want
KDE Plasma High DPI
KDE System Settings has everything you’ll need to tweak things for High DPI. Of particular note is the force font DPI scaling setting under fonts. The taskbar scales well, though some GTK apps like connman do look like you’re zooming in at 500% on a tiny icon.
Putting Your Powertop/S3 Changes To The Test
If you have chosen to install fwts, unplug your laptop on full battery and then run:
# fwts --power-states
It will now conduct a test of S3 and S4 and report back errors and estimated battery life duing sleep.
Unexplored/Unsupported
I’m not interested in tablet auto-rotation (I get annoyed by it flipping too much while I’m walking) so I have a tray widget that lets me use KDE’s control panel to adjust the orientation on demand any time I want. It’s possible to do auto-rotation from my understanding (if your desktop environment supports that sort of thing) if you’re so inclined. I’m simply not inclined.
The fingerprint reader is totally unsupported though efforts have been made to reverse engineer it.
lm-sensors does not seem to have the necessary recognition of the onboard hardware monitoring. This feels like it has been the standard operating procedure for as long as I can remember with lm-sensors … if you buy something new, don’t expect lm-sensors support off the bat. It took a year or two with all my desktop builds before support for their HW sensors trickled down into kernels I was running. Coretemp and ACPI temperature readouts work just fine, but it sees a proper sensor it just can’t use. Output from sensors-detect and then sensors:
# sensors-detect (snipped output) Some Super I/O chips contain embedded sensors. We have to write to standard I/O ports to probe them. This is usually safe. Do you want to scan for Super I/O sensors? (YES/no): Probing for Super-I/O at 0x2e/0x2f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... No Trying family `VIA/Winbond/Nuvoton/Fintek'... No Trying family `ITE'... No Probing for Super-I/O at 0x4e/0x4f Trying family `National Semiconductor/ITE'... No Trying family `SMSC'... Yes Found unknown chip with ID 0x2701 (snipped output) # sensors coretemp-isa-0000 Adapter: ISA adapter Package id 0: +34.0°C (high = +100.0°C, crit = +100.0°C) Core 0: +31.0°C (high = +100.0°C, crit = +100.0°C) Core 1: +32.0°C (high = +100.0°C, crit = +100.0°C) Core 2: +31.0°C (high = +100.0°C, crit = +100.0°C) Core 3: +32.0°C (high = +100.0°C, crit = +100.0°C) acpitz-acpi-0 Adapter: ACPI interface temp1: +35.0°C (crit = +128.0°C) iwlwifi-virtual-0 Adapter: Virtual device temp1: +33.0°C thinkpad-isa-0000 Adapter: ISA adapter fan1: 0 RPM
Thanks to the following pages which proved useful in helping get this stuff figured out:
– X1Y3 ArchLinux Wiki Page– Reddit /r/thinkpad thread
– Another Reddit /r/thinkpad thread
Comment