Ubuntu 18.04 status on HP Spectre x360 13"
- Pen, touchpad, touchscreen are all functioning after updating to mainline kernel and latest libinput
- Caveat: After using pen, touchscreen is non-responsive temporarily
- s2idle and hibernate work, s3 is not supported
- Fingerprint reader does not function
- Built-in microphone does not function (BT mics work)
- Webcam works
Guide
Booting from the USB installer
A few steps are required to get this working:
- Set BIOS to legacy so you can boot Ubuntu, while you're at it, update the BIOS to the latest version (important!)
- Insert 18.04 USB, reboot, use F9 to get into the USB boot loader
From here you can use gparted to re-partition and keep Windows, or the installer to wipe everything out.
Post install
A lot works out of the box, however a number of steps are required to get all of the hardware functioning as expected.
Libinput drivers
First up, is updating libinput. This is required to get the pen, touchpad, and touchscreen working in harmony. First we'll install the native Ubuntu drivers to get all the prerequisites, then we will update to version 1.12 which corrects some of the pen issues.
Code:
sudo apt-get install -y libinput-tools xdotool
wget https://launchpad.net/ubuntu/+source/libinput/1.12.6-1/+build/16328793/+files/libinput-bin_1.12.6-1_amd64.deb -O /tmp/libinput-bin.deb
wget https://launchpad.net/ubuntu/+source/libinput/1.12.6-1/+build/16328793/+files/libinput-tools_1.12.6-1_amd64.deb -O /tmp/libinput-tools.deb
wget https://launchpad.net/ubuntu/+source/libinput/1.12.6-1/+build/16328793/+files/libinput10_1.12.6-1_amd64.deb -O /tmp/libinput10.deb
sudo apt install -y /tmp/libinput*.deb
rm -rf /tmp/libinput*.deb
Mainline kernel
In addition to libinput updates, the pen and screen rotation require an updated kernel. As of this writing, kernel v5.0.0 works best. First thing is to get the latest icl firmware:
Code:
sudo wget https://kernel.googlesource.com/pub/scm/linux/kernel/git/firmware/linux-firmware/+/master/i915/icl_dmc_ver1_07.bin -O /lib/firmware/i915/icl_dmc_ver1_07.bin
Next, you'll need the newer kernel. You have three options:
- Mainline kernel - If you can deal with all the dmesg errors, you can use the official mainline kernel.
- Compile the mainline kernel with the patches applied
- Use my custom built kernel - You can use the custom built mainline kernel with the Spectre x360 patches applied
Option 1) Official Mainline Kernel (will get a flood of dmesg errors)
Code:
sudo wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh -O /usr/sbin/ubuntu-mainline-kernel
sudo chmod +x /usr/sbin/ubuntu-mainline-kernel
sudo ubuntu-mainline-kernel -i v5.0.3
Option 2) Compile the mainline kernel with patches
Code:
sudo wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh -O /usr/sbin/ubuntu-mainline-kernel
sudo chmod +x /usr/sbin/ubuntu-mainline-kernel
sudo ubuntu-mainline-kernel -i v5.0.3
sudo mkdir -p /opt/kernel
cd /opt/kernel
sudo wget https://dl.dropbox.com/s/7q6co76m2eizfin/spectre-x360.diff?dl=0 -O spectre-x360.diff
sudo git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
sudo git checkout -b spectre v5.0
sudo git apply ../spectre-x360.diff
sudo cp -vi /boot/config-5.0.3-050003-generic .config
sudo make oldconfig
sudo make -j`nproc` deb-pkg
sudo ubuntu-mainline-kernel -u v5.0.3
cd ..
sudo apt install ./linux-headers-5.0.3+_5.0.3+-1_amd64.deb ./linux-image-5.0.3+_5.0.3+-1_amd64.deb
Option 3) Use my pre-built kernel (based on option 2) <=- Easiest and best option
Code:
wget https://dl.dropbox.com/s/3p90k3d6xaythbs/linux-headers-5.0.3%2B_5.0.3%2B-1_amd64.deb?dl=0 -O linux-headers-5.0.3+B_5.0.3+-1_amd64.deb
wget https://dl.dropbox.com/s/k6di26o6kadldne/linux-image-5.0.3%2B_5.0.3%2B-1_amd64.deb?dl=0 -O linux-image-5.0.3+_5.0.3+-1_amd64.deb
sudo apt install ./linux-headers-5.0.3+_5.0.3+-1_amd64.deb ./linux-image-5.0.3+_5.0.3+-1_amd64.deb
Touchpad sensitivity
The synaptic touchpad suffers from the sensitivity issues documented elsewhere. To fix this, toggle the settings that assit with palm detection.
Code:
USR=$(whoami)
mkdir -p /home/$USR/.config/bin
echo "ID=\$(xinput -list |grep Touchpad |awk '{print \$6}')" > /home/$USR/.config/bin/synaptic.sh
echo 'ID=${ID##*=}' >> /home/$USR/.config/bin/synaptic.sh
echo 'xinput --set-prop "$ID" "Synaptics Finger" 50 90 255' >> /home/$USR/.config/bin/synaptic.sh
echo 'xinput --set-prop "$ID" "Synaptics Noise Cancellation" 20 20' >> /home/$USR/.config/bin/synaptic.sh
chmod +x /home/$USR/.config/bin/synaptic.sh
echo "[Desktop Entry]" > /home/$USR/.config/autostart/synaptic.desktop
echo "Type=Application" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Exec=/home/$USR/.config/bin/synaptic.sh" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Hidden=false" >> /home/$USR/.config/autostart/synaptic.desktop
echo "NoDisplay=false" >> /home/$USR/.config/autostart/synaptic.desktop
echo "X-GNOME-Autostart-enabled=true" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Name[en_US]=synaptic" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Name=synaptic" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Comment[en_US]=" >> /home/$USR/.config/autostart/synaptic.desktop
echo "Comment=" >> /home/$USR/.config/autostart/synaptic.desktop
Intel tearing fix
The Spectre 13" with Intel graphics is susceptible to video tearing. To fix this, use the Tearfix option for Xorg.
Code:
sudo mkdir -p /etc/X11/xorg.conf.d
echo 'Section "Device"' |sudo tee /etc/X11/xorg.conf.d/20-intel.conf
echo ' Identifier "Intel Graphics"' |sudo tee -a /etc/X11/xorg.conf.d/20-intel.conf
echo ' Driver "intel"' |sudo tee -a /etc/X11/xorg.conf.d/20-intel.conf
echo ' Option "TearFree" "true"' |sudo tee -a /etc/X11/xorg.conf.d/20-intel.conf
echo 'EndSection' |sudo tee -a /etc/X11/xorg.conf.d/20-intel.conf
*NOTE* One user has reported issues with Chrome menus after this fix. While I do not experience this on my UHD device, your results may vary.
Wifi updates
Out of the box the v38 firmware is defaulted for Wifi, which is slower and offers lower connection speeds. The below line will download the v43 firmware that works best with our Wifi chipset.
Code:
sudo wget https://git.kernel.org/cgit/linux/kernel/git/iwlwifi/linux-firmware.git/plain/iwlwifi-9000-pu-b0-jf-b0-43.ucode -O /lib/firmware/iwlwifi-9000-pu-b0-jf-b0-43.ucode
Power management
The Spectre does not auto power manage out of the box, however TLP manages the laptop perfectly.
Code:
apt-get install -y tlp powertop
Optional
Enable Hibernation
Hibernation is included in this guide because of the Spectre's unique need to disable i2c prior to hibernation, and then re-enable post. Hibernation can be implemented one of two ways.
Hibernate option 1) Via GNOME settings
This option works best if you do not have encrypted drives. This is true because when resuming with encrypted drives, you already have to enter a password post-hibernate. If you use this option with encrypted drives, you will be required to enter 2 passwords on resume.
Code:
echo "[Re-enable hibernate by default in upower]" |sudo tee /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "Identity=unix-user:*" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "Action=org.freedesktop.upower.hibernate" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "ResultActive=yes" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "[Re-enable hibernate by default in logind]" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "Identity=unix-user:*" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "ResultActive=yes" |sudo tee -a /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
echo "i2c_hid" |sudo tee /etc/suspend-modules.conf
echo '#!/bin/bash' |sudo tee /lib/systemd/system-sleep/suspend-modules
echo '' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo 'case $1 in' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' pre)' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' for mod in $(</etc/suspend-modules.conf); do' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' modprobe -r $mod' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' done' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' ;;' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' post)' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' for mod in $(</etc/suspend-modules.conf); do' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' modprobe $mod' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' done' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo ' ;;' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
echo 'esac' |sudo tee -a /lib/systemd/system-sleep/suspend-modules
sudo chmod a+x /lib/systemd/system-sleep/suspend-modules
echo '#!/bin/bash' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'case "$1" in' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' thaw|resume)' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' sleep 1' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' XINPUTUSER=$(who | grep :0 | sed 's/\([a-z]*\).*/\1/')' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' DISPLAY=:0.0 su $XINPUTUSER -c "sh /home/$XINPUTUSER/.config/bin/synaptic.sh"' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' ;;' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' *)' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' ;;' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'esac' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'exit $?' |sudo tee -a /etc/pm/sleep.d/99_resume
sudo chmod a+x /etc/pm/sleep.d/99_resume
gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'hibernate'
Hibernate option 2) Via ACPID
This option works better for encrypted drives because it runs at the system level and bypasses GNOME login. This way you only have to enter one password. The reason to use ACPID instead of GNOME is if you want to be able to have the lid close and go into s2idle while requiring a password at resume (GNOME), while at the same time NOT requiring the gnome password on resume from hibernation.
Code:
sudo apt-get install pm-tools
echo 'event=button/power' |sudo tee /etc/acpi/events/power
echo 'action=/etc/acpi/hibernate.sh "%e"' |sudo tee -a /etc/acpi/events/power
echo '#!/bin/bash' |sudo tee /etc/acpi/hibernate.sh
echo '' |sudo tee -a /etc/acpi/hibernate.sh
echo 'if [ `whoami` == "root" ]; then' |sudo tee -a /etc/acpi/hibernate.sh
echo ' modprobe -r i2c_hid' |sudo tee -a /etc/acpi/hibernate.sh
echo ' pm-hibernate' |sudo tee -a /etc/acpi/hibernate.sh
echo ' sleep 1' |sudo tee -a /etc/acpi/hibernate.sh
echo ' modprobe i2c_hid' |sudo tee -a /etc/acpi/hibernate.sh
echo ' sleep 1' |sudo tee -a /etc/acpi/hibernate.sh
echo ' XINPUTUSER=$(who | grep :0 | sed "s/\([a-z]*\).*/\1/")' |sudo tee -a /etc/acpi/hibernate.sh
echo ' DISPLAY=:0.0 su $XINPUTUSER -c "sh /home/$XINPUTUSER/.config/bin/synaptic.sh"' |sudo tee -a /etc/acpi/hibernate.sh
echo 'else' |sudo tee -a /etc/acpi/hibernate.sh
echo ' echo "Must be root";' |sudo tee -a /etc/acpi/hibernate.sh
echo 'fi' |sudo tee -a /etc/acpi/hibernate.sh
sudo chmod a+x /etc/acpi/hibernate.sh
gsettings set org.gnome.settings-daemon.plugins.power power-button-action 'nothing'
Hibernate add-on: Hibernate after s2idle
Regardless of the option you choose, you can also enable "Hibernate after s2idle" so that when you close the lid the machine will hibernate after a period of time. The below assumes you wish to hibernate after the machine has been in s2idle state for 5400 seconds.
Code:
echo '#!/bin/bash' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'case "$1" in' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' thaw|resume)' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' sleep 1' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' XINPUTUSER=$(who | grep :0 | sed "s/\([a-z]*\).*/\1/")' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' DISPLAY=:0.0 su $XINPUTUSER -c "sh /home/$XINPUTUSER/.config/bin/synaptic.sh"' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' ;;' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' *)' |sudo tee -a /etc/pm/sleep.d/99_resume
echo ' ;;' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'esac' |sudo tee -a /etc/pm/sleep.d/99_resume
echo 'exit $?' |sudo tee -a /etc/pm/sleep.d/99_resume
echo '[Sleep]' |sudo tee /etc/systemd/sleep.conf
echo 'HibernateDelaySec=5400' |sudo tee -a /etc/systemd/sleep.conf
sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=suspend-then-hibernate/g' /etc/systemd/logind.conf
Bookmarks