Memo Garcia

Linux on Huawei Matebook X Pro

December 4, 2018

This laptop has very decent specs:

Don’t expect running workstation level workloads in this machine but it is a wonderful dev machine.

Things I don’t like about the laptop

Update 14/Jul/2019

Palm rejection has improved a lot since I updated to the latest Touchpad software versions.

Distro

Ubuntu 18.04 with kernel 4.15.0-42-generic

Update 14/Jul/2019

do-release-upgrade to Ubuntu 18.10 and upgraded kernel version to 5.0.0-050000-generic

Touchpad

sudo apt install acpi acpi-support acpica-tools acpid acpidump acpitail acpitool libacpi0 laptop-detect pommed xserver-xorg-input-synaptics

Nvidia drivers

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update

At this time, nvidia-driver-415 is the most up to date driver and the recommended one.

sudo ubuntu-drivers autoinstall
prime-select query

For high-performance graphics, use:

prime-select nvidia
# log out and log in

Verify nvidia is correctly installed:

sudo lshw -C display
glxinfo | grep OpenGL

I’m getting readings about 12W to 17W battery discharge rate with this configuration.

For lower consumption, use:

prime-select intel
# log out and log in

I’m getting readings about 4.5W to 6W battery discharge rate with this configuration.

Update 14/Jul/2019

After upgrading to kernel 5.0.0-050000-generic I’m getting discharge rates of 3.5W, not bad!!!

Desktop manager

i3wm

sudo apt install i3wm i3lock

vim ~/.config/i3/config

# HDPI
exec xrandr --dpi 220

# Applets
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec --no-startup-id gtk-redshift
exec --no-startup-id megasync
exec --no-startup-id dropbox start
exec --no-startup-id flameshot

# Lock screen
bindsym $mod+l exec i3lock -c 000000

# background
exec --no-startup-id /usr/bin/feh --randomize --bg-scale /path/wallpaper/* -Z

And then, reload the configuration:

i3-msg reload
i3-msg restart
Media keys

For screen brightness and key backlights, I’m using Light

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5

# keyboard backlight controls
bindsym XF86KbdBrightnessUp exec light -A 5
bindsym XF86KbdBrightnessDown exec light -A 5

For volume control, I’m using pactl

# Volume controls
bindsym XF86AudioLowerVolume exec /usr/bin/pactl set-sink-volume @DEFAULT_SINK@ '-5%'
bindsym XF86AudioRaiseVolume exec /usr/bin/pactl set-sink-volume @DEFAULT_SINK@ '+5%'
bindsym XF86AudioMute exec /usr/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle

Battery

sudo apt install powertop tlp
sudo powertop --calibrate
sudo powertop --autotune
sudo tlp start

Disk I/O

Following the graphical method steps on this webpage, I get the following speeds for my 512 GB NVMe PCIe SSD:

Average Read Rate: 1.4 GB/s (1000 samples)
Average Write Read: 271.5 MB/s (1000 samples)
Average Access Time: 0.11 msec (1000 samples)

Maybe I’m testing it wrong, but it seems to me the write speeds are quite low.

Troubleshooting

Unsigned driver at boot

If your Matebook X Pro does not boot after installing this nvidia driver or the one downloaded from nvidia’s website then disable the Secure Boot option in the BIOS.

Reconfigure the kernel
sudo apt install --reinstall linux-image-generic linux-image-4.15.0-42-generic
Remove old drivers
sudo for FILE in $(dpkg-divert --list | grep nvidia-340 | awk '{print $3}'); do dpkg-divert --remove $FILE; done

references