Linux & Lenovo ThinkPad X1 Carbon 6

Just got a new ThinkPad X1 Carbon 6 and want to set it up for audio and media work with Linux. Using latest Ubuntu Mate (18.04.1) the installations is simple and trivial. There are two major problems but both are actually easy to solve.

Table of contents

  • create bootable USB key
  • install Linux from USB
  • priority tweaks:
    • power: Windows10 sleep mode
    • pro-audio: soundcard at 48000
  • custom tweaks
    • lowlatency kernel, qjackctl, jackd2, patchage
    • i3wm
    • mouse
    • xbacklight
    • power manager
  • jack/alsa/pulseaudio script

Create a bootable USB key

On another Linux machine download any modern Linux distro image (a file with .iso extensions). Insert a USB key whose contents you can spare and check the device number with lsblk:

Unmount the stick:

Create a bootable stick from the image:

Install linux from USB

Insert the new USB into the X1 and reboot. When booting first try press Enter to enter a different startup, press F12 to choose alternative temporary startup device and then choose USB HDD to boot live linux from it. Wait for the desktop to appear. You can get the feel of default install for chosen distribution. Check how everything works. If you are happy there’s usually an icon on the desktop that let’s you install that distro permanently. Click on it. Just go through all defaults – erase previous/existing operating system, and so on, or adjust as you see fit.

There’s one thing to note here regarding swap partition and suspend-to-disk: I have installed everything on one partition as offered by default, but since there is no separate swap partition suspend-to-disk does not work – I think. This is not anything major, but in case you want that functionality, you need to manually create partitions at this step where you make a separate swap partion that needs to be at least the size of your RAM.

After installation finishes, click yes to reboot, and remove the key. You should boot into your working Linux. There’s one or two main tweaks that you need to do.

Windows10 sleep mode

If you fill up the battery, disconnect the power and close the lid to put the laptop in sleep mode, you will notice that over night the battery will drain. A lot. Maybe completely. The problem is in ‘new’ way how Lenovo setup the sleep mode and controls it via a driver in Windows10. Linux tries to put it to sleep using a traditional (standards-compliant?) S3 mode, which does not work quite right. Fortunately, Lenovo have made updates to BIOS to enable that (deep) S3 sleep mode for Linux and other unix-like operating systems. You have to reboot the laptop and get to BIOS settings, search for power and there you can change the sleep mode for S3: Win10 or Linux. See here.

Bonus power tip: for great power-saving tweak I recommend installing small daemon that was originaly made for ThinkPads to help with saving battery life: tlp (link) – just use your package manager (on debian/ubuntu-based distros: $ sudo apt install tlp).

Pro-audio: internal soundcard at 48000Hz

Internal soundcard on this laptop seems to be able to playback at sampling rate of only 48kHz. This is not at all important for casual user, because PulseAudio will easily do conversion. But running JACK audio server and for example Ardour will be a problem, since that forces the user to either always use an external soundcard (which is mostly recommended anyway, but sometimes you want to do something on the road quickly on the headphones or something and you don’t necessarily need high-quality DA converters) or be forced to have all Ardour sessions in 48000 – which is very inconvenient!

Thankfully there’s a simple solution that consist of the following

  • start JACKd with dummy driver at 44100Hz rate (the rate you need to work in)
  • add internal card to jack using alsa_out/alsa_in programs with 48000Hz rate

Instead of the first line you can also start JACK with dummy driver from Q Jack Control program and then just start alsa_out in a terminal window (if you don’t need input you can also skip it)

I wrote a script that deals with all the PulseAudio suspending, killing, loading modules in order to continue using browser sounds and input while having a running jackd. You can look at at the end of this article. Obviously you’ll need to have jackd2 and pulseaudio-module-jack installed.


Custom tweaks

Up until now you should have fully functional system including sleep mode and additional workaround for crappy soundcard working with jack properly. What follows are more specific tweaks and hack that might or might not come handy to you.

i3wm

I use a tiling i3 window manager. , and some other stuff and will details this stuff from here. Up to this point it looks like most things work out of the box. To make it look nice I followed instructions here: https://github.com/addy-dclxvi/i3-starterpack. Hope to publish my i3 config soon.

Mouse

I found trackpad totally too jumpy aka oversensitive for normal work. actually settings in MATE were not satisfactory – the sensitivity is too high despite being at zero (far left). My much more comfortable setting is (lower the number towards -1 and it gets less and less sensitive):

I don’t use trackpad actually, so I turn it off with xinput:

In order to further use and explore settings possible with xinput just use:

Xbacklight

In very light window managers – like i3 – you don’t have a settings powerhouse app checking and running everything. So I use alittle program – xbacklight – that you can control the brightness of your screen.

to /etc/X11/xorg.conf.d/intel_backlight.conf add an Xorg.conf entry (needs X restart or reboot):

and then map keys in your i3 configuration file (~/.config/i3/config):

Power management daemon

For power management in the sense of sleep mode when battery is critical I use mate-power-manager. I auto-run it from i3 config file.


jack & alsa_out/alsa_in & pulseaudio script