Ubuntu 18.04 + Lenovo X1 Carbon (6G)

Jeremy Cheng
Jun 26, 2018 · 9 min read
Image for post
Image for post

Disclaimer: I’m not responsible for any damages or injury, including but not limited to special or consequential damages, that result from your use of this set of instructions.

Everything in General Just Worked Out-of-the-Box

The installation went off without a hitch and everything except for the fingerprint reader just worked right out of the box. To my surprise, even the touch screen worked. The only thing that I didn’t check was the SD/Sim slot which I read somewhere that it also doesn’t work out-of-the-box. No big deal for me though as I don’t like using fingerprint readers and have no need for sim/nano SD support. I then connected the HDMI port to my external display and that worked wonderfully as well.

Battery Life

  1. Disable “Secure Boot” in BIOS
  2. Run the below command in the terminal:
sudo apt-get install tlp tlp-rdw acpi-call-dkms tp-smapi-dkms acpi-call-dkms

Without any further tweaks, I already feel a boost in battery life. It works out to about 10 hours of battery life based on my usage patterns. However, for those of you who are “worried papas” or care for very specific battery use parameters for your devices, you can take a look at the “Battery charging threshold” section of this article which goes further into tweaking what’s under the hood. FWIW, I didn’t have any of the touchpad, trackpoint, t̶e̶m̶p̶e̶r̶a̶t̶u̶r̶e̶,̶ ̶o̶r̶ ̶C̶P̶U̶ ̶i̶s̶s̶u̶e̶s̶ it mentions so I didn’t bother with any of the tweaks the author suggested on that end.

Edit (July 4th, 2018):

I did however find that the low latency kernel seems to perform better so I switched to it and the deep sleep still works.

sudo apt install linux-image-4.15.0-24-lowlatency linux-headers-4.15.0-24-lowlatency

Edit (July 22, 2018):

I saw some dropped frames, slowness, keyboard lag, etc especially when on battery that could be due to the graphics driver, CPU management, microcode, and TLP settings. While it’s still usable without these tweaks, I prefer to get the best out of a laptop that I paid a pretty good price for. Here's what I did to make things better.

Disable Wayland from GDM3 just in case Wayland weirdness is affecting graphics performance cause I found that GDM3 was being launched with Wayland. I accomplished this by editing /etc/gdm3/custom.conf:

# Uncoment the line below to force the login screen to use Xorg

Install Open Graphics Drivers PPA:

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

It proved to not help much and I read that the xserver-xorg-video-intel driver is now deprecated so I removed it so that the graphics card will fall back to the kernel:

sudo apt purge xserver-xorg-video-intel

Install Intel microcode:

sudo apt install intel-microcode

Edit (February 26th, 2019)

Today, I decided to do some further tuning to save more battery life and increase performance on videos, desktop animations, and overall snappiness in general. I decided to stick the update here because this would be where you would want to do this if you were to follow this post to do a fresh install or if you are like me and doing this after you have done everything else, I wanted to make it easier to reference the next step of installing the Lenovo Throttling fix again. But before you do that, here are the tweaks that I did which worked out well for me:

  1. Boot into the BIOS settings
  2. Change Config → Thunderbolt 3 → Security Level to “Display Port and USB”
  3. Go back to the previous menu in Config
  4. Go to Display
  5. Change the memory from 256 to 512
  6. Go to Security → I/O Port Access and disable WWAN, SD, and Fingerprint scanner just to ensure there’s no unnecessary pulling for better battery life
  7. Save and Reboot

At this point, you will notice that anything that’s graphics driven is noticeably nicer and smoother.

Skip the rest of this update section if this is a fresh install. However, if you are amending these steps after having gone through the post previously, you should consider the following:

  • Removing /override_acpi from your /boot/grub/grub.cfg and then reboot again if you have done the S3 hack before and have also now changed the BIOS settings to Linux sleep instead of Windows
  • If at any point in time you can’t boot back into Ubuntu, load BIOS factory settings and it will get you back in along with your previous changes sticking for some reason
  • You have to run the below steps on installing the Lenovo fix again afterwards

Installed dependencies and cloned the Lenovo Throttling Script:

sudo apt install git virtualenv build-essential python3-dev libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev
cd ~/Downloads
git clone https://github.com/erpalma/lenovo-throttling-fix.git

Changed the defaults of ~/Downloads/etc/lenovo_fix.conf to:

# Update the registers every this many seconds
Update_Rate_s: 5
# Max allowed temperature before throttling
Trip_Temp_C: 80
# Max allowed temperature before throttling
Trip_Temp_C: 90
# CPU core voltage offset (mV)
CORE: -100
# Integrated GPU voltage offset (mV)
GPU: -70
# CPU cache voltage offset (mV)
CACHE: -100
# System Agent voltage offset (mV)

Edit (August 6th)

After tweaking the TLP config on August 4th (scroll down to see), I also increased the undervolting which seems to save a lot of battery life without any compromise in performance. Though I have not tried doing anything super heavy yet. In any case, the battery lasts about more like 6 hours rather than 5 now.

# CPU core voltage offset (mV)
CORE: -110
# Integrated GPU voltage offset (mV)
GPU: -90
# CPU csache voltage offset (mV)
CACHE: -110
# System Agent voltage offset (mV)
# Analog I/O voltage offset (mV)

Applied the fix with my changes:

cd ~/Downloads/lenovo-throttling-fix
sudo -H ./install.sh

Configured TLP with the following settings:

Note: Most of the time, I care more about power over battery life. 6–8 hours of battery life is a lot better than a not responsive enough system to attain 10+ hours of battery life. With that said, these settings are tuned to at least get me 6 hours minimum of battery life which is good enough for my purpose as I have a power source at most of the places I go.

# Dirty page values (timeouts in secs).
# Set energy performance hints (HWP) for Intel P-state governor:
# performance, balance_performance, default, balance_power, power
# Values are given in order of increasing power saving.
# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
# Set CPU performance versus energy savings policy:
# performance, balance-performance, default, balance-power, power.
# Values are given in order of increasing power saving.
# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
# Disk advanced power management level: 1..254, 255 (max saving, min, off).
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
# AHCI link power management (ALPM) for disk devices:
# min_power, med_power_with_dipm(*), medium_power, max_performance.
# (*) Kernel >= 4.15 required, then recommended.
# Multiple values separated with spaces are tried sequentially until success.
SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm medium_power"
# Radio devices to disable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.

Edit (August 4th)

Did some further TLP tweaking that increased the performance while on battery without loosing too much battery life:

TLP Config

Last but not least, I installed CPU Power Manager Gnome Shell Extension from the Ubuntu Software Store and configured the following profiles so I can have more control of my perf settings based on the situation I am in:

Image for post
Image for post

After a swift reboot from all of the changes above, my X1C6 is now more or less hitting the right marks for me. I also watched a few Donnie Yen fight scenes while on battery just to make sure the video output performance is up to par… ;)

Edit (July 27th, 2018):

Something that I did before and mysteriously went away reminded me of how much graphics performance I got out of this fix:

sudo vim /etc/environment

Add the following line and reboot:


Edit (July 29th, 2018):

Firmware Security (v0.1.27) popped up in the Ubuntu Software Store. I was a bit scared as I have read in forums that some updates that are installed from the Lenovo site has rendered the laptop unusable but my personality doesn’t allow outstanding updates to be not installed especially when it’s security related and that I am hopeful that since it’s an Ubuntu pushed update that it was tested and work well. So I went ahead and hit the update button and then rebooted the system. So-far everything works fine on the laptop. Kudos to Canonical for making this so seamless/automated!

Edit (February 26th, 2019)

As of some time before October, 2018, the below deep sleep hack is no longer needed and you can just go to the bios, config, power, and choose “Linux” instead of “Windows” for the sleep settings and everything will be good to go out-of-box. You can probably also turn secure boot back on at this point.

S3 — Deep Sleep

I̶ ̶a̶m̶ ̶n̶o̶t̶ ̶m̶u̶c̶h̶ ̶o̶f̶ ̶a̶n̶ ̶e̶l̶e̶c̶t̶r̶i̶c̶a̶l̶ ̶e̶n̶g̶i̶n̶e̶e̶r̶ ̶s̶o̶ ̶i̶n̶s̶t̶e̶a̶d̶ ̶o̶f̶ ̶d̶o̶i̶n̶g̶ ̶i̶n̶-̶d̶e̶p̶t̶h̶ ̶p̶o̶w̶e̶r̶ ̶c̶o̶n̶s̶u̶m̶p̶t̶i̶o̶n̶ ̶t̶e̶s̶t̶i̶n̶g̶ ̶m̶y̶s̶e̶l̶f̶,̶ ̶I̶ ̶d̶i̶d̶ ̶s̶o̶m̶e̶ ̶s̶i̶m̶p̶l̶e̶ ̶t̶e̶s̶t̶s̶ ̶a̶g̶a̶i̶n̶s̶t̶ ̶a̶l̶l̶ ̶t̶h̶e̶ ̶c̶h̶a̶t̶t̶e̶r̶ ̶i̶n̶ ̶t̶h̶e̶ ̶f̶o̶r̶u̶m̶s̶ ̶a̶b̶o̶u̶t̶ ̶h̶o̶w̶ ̶i̶n̶ ̶t̶h̶e̶ ̶6̶t̶h̶ ̶G̶e̶n̶ ̶X̶1̶ ̶C̶a̶r̶b̶o̶n̶,̶ ̶L̶e̶n̶o̶v̶o̶ ̶d̶e̶c̶i̶d̶e̶d̶ ̶t̶o̶ ̶g̶e̶t̶ ̶r̶i̶d̶ ̶o̶f̶ ̶t̶h̶e̶ ̶A̶C̶P̶I̶ ̶S̶3̶ ̶D̶e̶e̶p̶ ̶S̶l̶e̶e̶p̶ ̶s̶t̶a̶t̶e̶ ̶i̶n̶ ̶f̶a̶v̶o̶r̶ ̶o̶f̶ ̶a̶ ̶”̶M̶i̶c̶r̶o̶s̶o̶f̶t̶ ̶d̶r̶i̶v̶e̶n̶ ̶s̶l̶e̶e̶p̶ ̶s̶t̶a̶t̶e̶ ̶c̶a̶l̶l̶e̶d̶ ̶W̶i̶n̶d̶o̶w̶s̶ ̶M̶o̶d̶e̶r̶n̶ ̶S̶t̶a̶n̶d̶b̶y̶ ̶a̶k̶a̶ ̶S̶i̶3̶”̶ ̶w̶h̶i̶c̶h̶ ̶b̶r̶e̶a̶k̶s̶ ̶U̶b̶u̶n̶t̶u̶’̶s̶ ̶a̶b̶i̶l̶i̶t̶y̶ ̶t̶o̶ ̶g̶o̶ ̶i̶n̶t̶o̶ ̶t̶h̶e̶ ̶d̶e̶e̶p̶ ̶s̶l̶e̶e̶p̶ ̶s̶t̶a̶t̶e̶;̶ ̶s̶o̶m̶e̶t̶h̶i̶n̶g̶ ̶q̶u̶i̶t̶e̶ ̶v̶a̶l̶u̶a̶b̶l̶e̶ ̶f̶o̶r̶ ̶r̶o̶a̶d̶ ̶w̶a̶r̶r̶i̶o̶r̶s̶ ̶t̶h̶a̶t̶ ̶c̶a̶n̶’̶t̶ ̶a̶f̶f̶o̶r̶d̶ ̶t̶o̶ ̶s̶h̶u̶t̶d̶o̶w̶n̶ ̶o̶r̶ ̶h̶i̶b̶e̶r̶n̶a̶t̶e̶ ̶b̶e̶f̶o̶r̶e̶ ̶t̶h̶e̶y̶ ̶a̶r̶e̶ ̶o̶n̶ ̶t̶h̶e̶ ̶m̶o̶v̶e̶ ̶a̶n̶d̶ ̶y̶e̶t̶,̶ ̶d̶e̶m̶a̶n̶d̶ ̶l̶o̶n̶g̶ ̶b̶a̶t̶t̶e̶r̶y̶ ̶l̶i̶f̶e̶ ̶i̶n̶ ̶t̶h̶e̶i̶r̶ ̶d̶e̶v̶i̶c̶e̶s̶ ̶s̶o̶ ̶t̶h̶a̶t̶ ̶t̶h̶e̶y̶ ̶l̶a̶s̶t̶ ̶t̶h̶r̶o̶u̶g̶h̶ ̶t̶h̶e̶i̶r̶ ̶w̶o̶r̶k̶ ̶d̶a̶y̶s̶.̶ ̶

B̶e̶f̶o̶r̶e̶ ̶I̶ ̶a̶p̶p̶l̶i̶e̶d̶ ̶t̶h̶e̶ ̶h̶a̶c̶k̶e̶d̶ ̶f̶i̶x̶,̶ ̶t̶h̶e̶ ̶l̶a̶p̶t̶o̶p̶ ̶g̶o̶e̶s̶ ̶i̶n̶t̶o̶ ̶t̶h̶e̶ ̶S̶2̶ ̶s̶l̶e̶e̶p̶ ̶s̶t̶a̶t̶e̶ ̶a̶k̶a̶ ̶s̶t̶a̶n̶d̶b̶y̶ ̶r̶i̶g̶h̶t̶ ̶o̶u̶t̶ ̶o̶f̶ ̶t̶h̶e̶ ̶b̶o̶x̶.̶ ̶T̶h̶i̶s̶ ̶c̶o̶s̶t̶e̶d̶ ̶m̶e̶ ̶a̶b̶o̶u̶t̶ ̶1̶%̶ ̶o̶f̶ ̶b̶a̶t̶t̶e̶r̶y̶ ̶l̶i̶f̶e̶ ̶e̶v̶e̶r̶y̶ ̶3̶0̶–̶4̶5̶ ̶m̶i̶n̶u̶t̶e̶s̶.̶ ̶T̶h̶e̶ ̶w̶a̶k̶i̶n̶g̶ ̶o̶f̶ ̶t̶h̶e̶ ̶l̶a̶p̶t̶o̶p̶ ̶w̶a̶s̶ ̶a̶l̶s̶o̶ ̶a̶ ̶b̶i̶t̶ ̶l̶a̶g̶g̶y̶.̶ ̶

A̶f̶t̶e̶r̶ ̶I̶ ̶a̶p̶p̶l̶i̶e̶d̶ ̶t̶h̶e̶ ̶h̶a̶c̶k̶e̶d̶ ̶f̶i̶x̶ ̶w̶h̶i̶c̶h̶ ̶I̶ ̶w̶i̶l̶l̶ ̶w̶r̶i̶t̶e̶ ̶a̶ ̶f̶o̶l̶l̶o̶w̶u̶p̶ ̶p̶o̶s̶t̶ ̶o̶n̶,̶ ̶I̶ ̶l̶o̶s̶t̶ ̶a̶r̶o̶u̶n̶d̶ ̶2̶%̶ ̶o̶f̶ ̶b̶a̶t̶t̶e̶r̶y̶ ̶f̶r̶o̶m̶ ̶a̶ ̶6̶-̶7̶ ̶h̶o̶u̶r̶ ̶S̶3̶ ̶d̶e̶e̶p̶ ̶s̶l̶e̶e̶p̶.̶ ̶W̶h̶a̶t̶’̶s̶ ̶s̶u̶r̶p̶r̶i̶s̶i̶n̶g̶ ̶i̶s̶ ̶t̶h̶a̶t̶ ̶t̶h̶e̶ ̶w̶a̶k̶i̶n̶g̶ ̶o̶f̶ ̶t̶h̶e̶ ̶l̶a̶p̶t̶o̶p̶ ̶w̶a̶s̶ ̶a̶l̶s̶o̶ ̶m̶u̶c̶h̶ ̶m̶o̶r̶e̶ ̶s̶n̶a̶p̶p̶y̶ ̶t̶h̶a̶n̶ ̶t̶h̶e̶ ̶S̶2̶ ̶s̶l̶e̶e̶p̶ ̶s̶t̶a̶t̶e̶.̶ ̶

S̶o̶ ̶p̶r̶o̶b̶l̶e̶m̶ ̶t̶h̶e̶r̶e̶ ̶a̶l̶s̶o̶ ̶s̶o̶l̶v̶e̶d̶.̶ ̶I̶t̶’̶s̶ ̶n̶o̶t̶ ̶a̶s̶ ̶g̶r̶e̶a̶t̶ ̶a̶t̶ ̶m̶y̶ ̶M̶a̶c̶b̶o̶o̶k̶ ̶A̶i̶r̶ ̶p̶e̶r̶ ̶s̶e̶ ̶b̶u̶t̶ ̶I̶ ̶c̶e̶r̶t̶a̶i̶n̶l̶y̶ ̶t̶h̶i̶n̶k̶ ̶i̶t̶’̶s̶ ̶a̶c̶c̶e̶p̶t̶a̶b̶l̶e̶.̶

Edit (July 22nd)

A̶s̶ ̶p̶r̶o̶m̶i̶s̶e̶d̶,̶ ̶h̶e̶r̶e̶’̶s̶ ̶t̶h̶e̶ ̶s̶t̶e̶p̶-̶b̶y̶-̶s̶t̶e̶p̶.̶

What about Software?

As I have mentioned before, Ubuntu and GNU/Linux in general has come a long ways so I have obviously been able to fill all my requirements with the software through a combination of open and closed source software to pretty much make this setup take care of all my practical needs. Though I must say that my usage behavior doesn’t speak for everyone. I am sure my constant using of Ubuntu on my desktops at work and home for as long as I remember influences my software choice and usage patterns. Here’s a screenshot of my setup:

Image for post
Image for post

Happily Ever After?

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store