Ubuntu and ThinkPad X390
Jun 9, 2019 · 592 words · 3 minutes read
Recently I’ve bought Lenovo ThinkPad X390 and while on Windows 10 everything as far as I’ve tested works nicely, it’s not the case with Ubuntu 18.04.
Some of the listed problems here are related to my setup(i3wm, X11), other strictly to X390 <-> Ubuntu.
Power management
TLP – Linux Advanced Power Management
Battery life
X390 battery live estimation by Lenovo: ~17h
— arathunku (@arathunku) June 8, 2019
😂 lab conditions
Reality: ~6h
100% brightness, WiFi off, few terminals open, Spotify pic.twitter.com/eg63nQRCA0
Graph via battop
Media keys don’t work
Verify they’re working: sudo showkey -k
, if they do, proceed:
It’s GNOME’s fault. ?!
> sudo apt install dconf-editor
> dconf-editor
Navigate to:
org.gnome.settings-daemon.plugins.media-keys
Toggle XF86AudioPlay
and other media keys there.
Broken brightness control
Brightness didn’t work at all. Slider in Ubuntu for this was completely broken so I had to:
sudo touch /etc/X11/xorg.conf.d/20-intel.conf
sudoedit /etc/X11/xorg.conf.d/20-intel.conf
and paste:
Section "Device"
Identifier "card0"
Driver "intel"
Option "Backlight" "intel_backlight"
BusID "PCI:0:2:0"
EndSection
Now I could control brightness but my keys still didn’t do anything.
xbacklight
is throwing “No outputs have backlight property”
no matter what I try so I’ve finally switched to light.
LIGHT_VERSION="1.2"
UDEV_RULES="/etc/udev/rules.d/90-backlight.rules"
cd /tmp && \
curl -L -J -o light.deb "https://github.com/haikarainen/light/releases/download/v${LIGHT_VERSION}/light_${LIGHT_VERSION}_amd64.deb" && \
sudo apt install -y ./light.deb && \
rm -rf ./light.deb && \
sudo usermod -a -G video REPLACE_WITH_USERNAME && \
sudo touch "${UDEV_RULES}" && \
sudo tee "${UDEV_RULES}" <<HERE
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chgrp video /sys/class/leds/%k/brightness"
ACTION=="add", SUBSYSTEM=="leds", RUN+="/bin/chmod g+w /sys/class/leds/%k/brightness"
HERE
Logout and login or restart
Bluetooth setup
That’s my first laptop with Bluetooth, and I wanted to use my wireless headset. No major problems, works as expected with a small caveat…
When I close the lid, the system suspends for a sec and wakes up.
I had to add a script:
> cat /lib/systemd/system-sleep/bluetooth-suspend
#!/bin/bash
# Makes sure bluetooth service is not running while suspended.
if [ "${1}" == "pre" ]; then
service bluetooth stop
elif [ "${1}" == "post" ]; then
service bluetooth start
fi
TIL I also learned about blueman.
sudo apt install blueman
Blueman provides GUI to setup Bluetooth devices.
Alternatively:
> sudo apt install bluez-tools
> sudo bluetoothctrl
> agent on
> scan on
# wait for device and copy its MAC address
> pair {{ MAC }}
> trust {{ MAC }}
Fingerprint reader
Unfortunately, it’s Synaptics and I still haven’t managed to make it work.
> lsusb | grep Synaptics
Bus 001 Device 005: ID 06cb:00bd Synaptics, Inc.
Scaling
X390 has 13.3" screen and in my case, it’s 1920x1080. By default, everything was a bit too small for my taste.
I’m using i3wm, so it means I’m stuck on X11 for the foreseeable future. I also cannot switch to Sway and Wayland because I want to have the same setup on all of my computers from which one of them has NVIDIA GPU and it’s not supported by Sway.
I’ve tried adjusting scaling via GNOME settings, but everything looked a bit blurry, so I’ve opted for just modifying font sizes in GNOME, i3wm, Firefox, and Alacritty.
gsettings set org.gnome.desktop.interface text-scaling-factor 1.2
I cannot wait to see how this works with external display… /s
Screen flicker / tears / poor performance
I don’t know why but I had xserver-xorg-video-intel
installed.
It’s not recommended for newer hardware.
sudo apt purge xserver-xorg-video-intel
After removing and that and setting kernel options:
> /etc/modprobe.d/i915.conf
options i915 enable_fbc=1 modeset=1
Works as before and without screen problems.
In case I find something new, I’ll update the post.