Linux (Ubuntu 16.04) on Lenovo ThinkPad P50: Configuration for displays, Optimus and trackpad

Xubuntu 16.04 on the Lenovo ThinkPad P50 is almost painless and provides good battery life, multi-displays. As for the usual questions: suspend/resume is 100% reliable for me under all circumstances. Wifi is perfect. Multi-monitor works. Stability is completely rock-solid; it’s better than my last five years of Macs, and better than any Windows experience I’ve had. My machine is the core i7 model, with the Full HD display, not the hiDPI. There are some tweaks, and if you use 16.04, there are steps you can take to get later versions of the graphics stack, instead of waiting for 16.04.3.


Linux on the Lenovo Thinkpad P50 is great, although the choice of Xubuntu over other distributions makes this much easier.

I bought my Thinkpad P50 online from B&H Photography (New York); new, it was about half the Australian retail price. Mine was a returned unit, so it was even cheaper still, still with residual of the 3 year warranty (which is international, despite B&H saying it wasn't). I bought the base model and added a 1TB SSD and 32 GB Ram.

I avoided the HiDPI screen despite being a Retina user on the macs because it seems Linux is not very good yet with mixing HiDPI and std resolution displays, and of course, there isn’t much point having the battery and cost disadvantages of HiDPI when you mostly look at legacy external monitors.

I’ll give a shout out to ; have bought several computers, been great.


three screens

Three screens running from xubuntu 16.04

Updated May 2017.

 Overview of the OS components

Ubuntu 16.04.2 (HWE)

see to make sure you are on 16.04.2


using 4.8 kernel and the latest stable nvidia driver from this PPA

I also use these repositories for some backported stable upstream stuff regarding display drivers.


After installation I added tlp for battery management

It idles at < 7W. 

My P50 came with Secure Boot off and UEFI on. I didn’t change either.

Thinkpad P50 System updates & Thunderbolt firmware

I fully updated the machine using Lenovo’s Windows 7 utility; I was mostly interested in the latest BIOS updates. My Thinkpad P50 is dual boot (actually, quad boot would be more accurate; I have a couple of other Linux distributions installed so I can test big updates before committing to them).

Note: It's also a good idea to update the Thunderbolt firmware, because this is provides the HDMI out port. This update is not included in the standard Lenovo system updates, it seems. You can only do this in Windows.

Google: Intel Alpine Ridge Thunderbolt Firmware for Windows 10 (64-bit), 8.1 (64-bit), 7 (64-bit) - ThinkPad P50.

 The firmware update may complain that you don't have a Thunderbolt device connected. Continue anyway; despite the messages, it will do the firmware update. You'll see a message about the update taking up to three minutes. 

The HDMI port before this updates doesn't always detect a monitor (same in Windows).
Note that there is a May 2017 update for both BIOS and Thunderbolt firmware. Before this update, the external monitor on my HDMI port did not always start (same with Windows) and it would take a few reboots before it reappeared.

This hasn't happended since the update. I wish I had learnt about the Thunderbolt firmware update earlier.


External monitors & Optimus 

I use two external monitors. One monitor is attached to the display port, one to the HDMI port, since I don’t have a dock.

I’m using the nvidia binaries from Ubuntu repositories, which come with ‘prime-select’, an Ubuntu enhancement that makes it easy to swap between the power of the Nvidia card and the efficiency of intel, although a reboot is required going from Intel to Nvidia.  Optimus is only enabled when Hybrid graphics mode must is set in BIOS.

Of course, the easiest approach is to set Discrete Graphics in the BIOS.  With the Discrete setting, the laptop directly runs external displays and the laptop’s panel from nvidia.  The OS doesn’t see intel graphics at all. This is definitely the simplest way to work. However, to access battery saving mode (intel graphics), you need to reboot and reconfigure the BIOS back to Hybrid, and then the system goes through a reconfiguration boot, which is a bit slower than normal.

Keeping Hybrid mode on a bit less cumbersome (but not much). Note that xubuntu isn't mapping the display brightness control keys properly when you boot in Discrete mode. There's an easy fix below.

There is an alternative which does what the Windows drivers do: turns on the nvidia card when needed.  The linux version is bumblebee but the installation tutorials are long so I haven’t bothered. Also, it doesn't work with the Nvidia drivers, you must use Nouveau.


  1. KDE, Unity & Gnome didn't work with my three screens in 16.04 and 16.04.1 in hybrid graphics mode. Xubuntu did, because the compositor in xfce uses xrender, which works with Optimus when handing off to the Intel card used to drive the laptop panel. Gnome and Unity as shipped with 16.04 & 16.04.1 use an OpenGL-based compositor, which doesn’t work with the Optimus setup (the external monitors work, but not the laptop panel; this is a known bug
    But Ubuntu 17.04 in Gnome (using X, not wayland) works fine with the three monitors, so the bug has been fixed (althouh the bug report is still open). I assume this fix will arrive in 16.04.3. In any case, discrete mode (Nvidia card only) will be fine.

You can use nvidia-settings (a GUI tool) to make sure you are using the nvidia card or to change to the intel driver, or the command line:  The command-line equivalent is
sudo prime-select

At this point, everything should just work but there are some tweaks below for a much better experience.

  1. Some good tweaks: trackpad
    The trackpad does not respond well to small, slow movements, the sort of precise movements you may want to make. It acts jerky. It’s not a hardware problem, but a problem of default settings. Small movements get accelarated.

    I've now swappedto libinput drivers because the accidental-touch detection is good, but when using the synaptics driver, I had this script as executable, and I had xfce run it at session startup (Settings -> Session and Startup 0-> Application Autostart)

# this is run by xfce startup apps
# xinput --list-props 13

DEVICE="SynPS/2 Synaptics TouchPad"
xinput --set-prop "$DEVICE" "Device Accel Profile" 6
xinput --set-prop "$DEVICE" "Device Accel Constant Deceleration" 12
xinput --set-prop "$DEVICE" "Device Accel Velocity Scaling" 10
xinput --set-prop "$DEVICE" "Synaptics Scrolling Distance" -114 -114
xinput --set-prop "$DEVICE" "Synaptics Palm Detection" 1

xinput --set-prop "$DEVICE" "Synaptics Palm Dimensions" 3, 3


Note: a more modern approach is to use libinput; it's under active deverlopment. I have swapped to this. Palm rejection is automated, and with ths driver I can get natural scrolling working everywhere on all devices, which I didn't manage previously. The driver is part of X so it is updated in the point updates. This means that Ubuntu 16.04.2 has the same version that released in 16.10. If use use the PPAs I mentioned at the top, you'll get even more recent versions. Finally I have 'natural scroll' (or reverse scroll) working everywhere. It's enabled in the script below *AND TURNED OFF* in the Settings app. Palm rejection works very well, I have touch to tap on permanently now. The driver is much less configurable, but I will stick with libinput.

Using libinput means installing the package xserver-xorg-input-libinput-hwe-16.04.

Ubuntu will automatically switch to this driver, you don't need to do anything else (thta is, you don't need to uninstall any existing packages) . Note that the HWE packages are how you make sure you are uisng 16.04.2. See

 Libinput version of the P50 tweaks for mouse and trackpad

# this is run by xfce session startup

DEVICE="SynPS/2 Synaptics TouchPad"
xinput --set-prop "$DEVICE" "libinput Accel Speed" -0.95 #very low to get smooth pointer behaviour, min is -1
xinput --set-prop "$DEVICE" "libinput Natural Scrolling Enabled" 1
xinput --set-prop "$DEVICE" "libinput Tapping Enabled" 1
xinput --set-prop "$DEVICE" "libinput Disable While Typing Enabled" 1

#slow down mouse

xinput --set-prop "$DEVICE" "libinput Natural Scrolling Enabled" 1

DEVICE="TPPS/2 IBM TrackPoint"
xinput --set-prop "$DEVICE" "libinput Natural Scrolling Enabled" 1



  1. Nvidia tweaks: there were some ugly tearing effects on all monitors. Tearing is fixed with this script, which I also run on session start. It is all one line.

    nvidia-settings --assign CurrentMetaMode="$(nvidia-settings -q CurrentMetaMode -t|tr '\n' ' '|sed -e 's/.*:: \(.*\)/\1\n/g' -e 's/}/, ForceCompositionPipeline = On}/g')" > /dev/null                                                                      
    Read more here:

This script activates ForceCompositionPipeline. There are different ways of doing this, such as changing xorg.conf, but my script works and changing xorg.conf is a bit more complex with Optimus so I’ll just stick with this script. It’s also settable from the GUI control panel (see bottom of screen shot):

I have the semi-official Ubuntu nvidia PPA (see top) and I follow the latest release. It’s been great for me with 375, 378, 381. Note that the 378 version also includes a nvidia settings control panel which finally shows your laptop screen as well as the external monitors in Optimus mode… not a big deal since all monitors are visible in the xfce Displays setting, but a small improvement. See screen shot above. However, the 378 driver will not get the May fixes for Optimus; the 375 driver did (it's LTS) and the 381 driver did too.

Optimus & Prime Sync to end tearing on the laptop panel

In Optimus mode, you will see tearing on the laptop panel with the 'out of the box settings/. The v-sync in XFCE compositor settings makes no difference to this. It’s due to a missing feature in xwindows which was only added in v1.19, which is not part of Ubuntu 16.04.1, 16.04.2 or 16.10. This feature is known as Prime Synchronization.

Prime Sync is possible in 17.04 and will be backported in 16.04.3 (I expect this around July/August 2017).

However, as of May 2017, it's now available in one of the PPAs I referred to at the start (

Make sure you are on 16.04.2 (the HWE stack) first.

You need the LTS 375.66 driver (or later) or the 381 driver; these have important Prime Sync bug fixes which are not in earlier releases. Driver 378 is in the middle of these two releases but it is end of life and not fixed.

You need to make a one-line config file too.

I put full instructions here:



  1. Intel tweaks
    When running in intel-mode (sudo prime-select intel) I still had some tearing. This is fixed by creating a file /usr/share/X11/xorg.conf.d/20-intel.conf

Section "Device"

Identifier  "Intel Graphics"

  Driver      "intel"

  Option      "TearFree"    "true"



Also note that you need the package xserver-xorg-video-intel installed. The package manager says you are encouraged not to use this module if your hardware is more recent that 2007! However, without it, the intel module is not loaded and tear free is not enabled. And if you are using 16.04.2, the module will be xserver-xorg-video-intel-hwe-16.04

There may be smarter ways of settings this, I don’t know. Unfortunately, you can’t leave this file in place if you switch back to prime-select nvidia: the laptop panel won’t display. I have a script tim_prime intel|nvidia, which renames this file if I am going to run nvidia and reinstates it if I am switching to nvidia. It then calls prime-select for me. I am primitive shell scripter but here it is. I use this instead of prime-select.


function intel_off()


rm /usr/share/X11/xorg.conf.d/20-intel.conf




function intel_on()


cp /usr/share/X11/xorg.conf.d/20-intel.conf_off \



while [ "$1" != "" ]; do


case $PARAM in


echo 'intel'


prime-select intel



echo 'nvidia'


prime-select nvidia





  1. Longer battery service life by not charging to 100%
    ThinkPad battery bios can configured so that it stops charging at less than 100%. This should give a longer useful life to the battery. ThinkPads have done this for years. I picked up a five year-old W520 with the original battery, and it was still holding a 70% charge so I'm convinced.
    Visit and install Tpacpi-bat via the PPA.

    Install tlp from the ubuntu repositories. In the config file /etc/efault/tlp
    I have these settings

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module

# required). Charging starts when the remaining capacity falls below the

# START_CHARGE_TRESH value and stops when exceeding the STOP_CHARGE_TRESH value.

# Main / Internal battery (values in %)



sudo tld fullrecharge will do a one-time full charge of the battery

Other Points


Printing: At home and work I have HP printers & scanners; these have always worked great with Linux and they still do, particularly if you use the HPLIP software (in the Ubuntu repositories). I use the wifi all over the place, it’s been flawless. 

Using Discrete Graphics from BIOS: Display brightness keyboard control

If you choose discrete graphics from the BIOS, there is no tearing on the intel panel (assuming the startup scripts above)

However, the brightness keys don’t work.


The brightness can be set like so

nvidia-settings -a BacklightBrightness[DP-4]=70 (This sets the brightness to 70%)

Or via xbacklight which can easily be mapped to keys


DP-4 is the name of my laptop panel. Yours may be different. It’s easy to see this from the Nvidia control panel. I used xfce to map increase and decrease to Super F5 & F6 (Super is the Windows key)


I have calibri installed. In 12pt it looked bad, this is turned off via a ~/.fonts.conf file as per