Sunday, February 9, 2014

Installing Ubuntu 13.10 on Gen 2 (Haswell) Lenovo X1 Carbon

I recently bought the new X1 Carbon Gen 2 with a 2560x1440 touchscreen, 8GB RAM and 256GB SSD.  I installed Ubuntu Linux 13.10 on it, and it's been a great experience so far.  I absolutely love the laptop and linux runs very well on it.

Summary of what's working:

  • Wireless -- works out of the box
  • Touchscreen -- out of the box you only get left-click, but you can enable gestures with Touchegg (see bekow).
  • Touchpad -- works out of the box but not well.  Can be fixed with some X11 config changes (see below)
  • Function keys -- the X1 has an "adaptive keyboard" where the function keys are an LCD strip, displaying context-sensitive keys.  Out of the box the basic function keys (F1-F12) are displayed and work fine, even in BIOS.  So far I haven't been able to cycle through different sets of buttons.
  • Hibernate --  "sudo pm-hibernate" works out of the box
  • External display on HDMI port -- plugging in a 1920x1080 external display to the HDMI port worked out of the box.  No luck with the mini displayport yet.
  • Bluetooth -- hci0 was soft-blocked by default, but easily unblocked and then works like a charm.
  • Automatic switching to usb headset audio & mic - worked out of the box
  • Trackpoint (the little red button in the middle of the keyboard) - works out of the box

Summary of issues:

  • Suspend -- "sudo pm-suspend" will suspend to RAM, but there's no way to resume.  You have to power off and back on.  But "hibernate" (suspend to disk) works, and the SSD is very fast so I don't mind that.
  • External display on Mini DisplayPort not working.

Not Tested:

  • Fingerprint reader
  • OneLink Docking Station (though I have one on order so I'll test that when it arrives)

The installation process:

The process I went through was:
  1. Create a bootable usb flash drive with Ubuntu 13.10
  2. Turn off UEFI in the BIOS on the Carbon X1 (hit "Enter" while the Lenovo splash screen is displayed at boot time to enter BIOS)
  3. Change the order of boot devices in BIOS so the usb flash drive is prior to the HD
  4. Boot into the usb flash drive and install
  5. Make a few easy fixes 
  6. Voila!

Touchscreen gestures:

To enable touchscreen gestures, install Touchegg:

     sudo apt-get install touchegg

Then edit ~/.config/touchegg/touchegg.conf to apply the changes you want.

You'll get some decent gestures by default.  See here for more information on tweaking touchegg.

Fixing the touchpad:

Out of the box the touchpad is barely useable, but after following these instructions I'm very pleased with it.

Enabling bluetooth:

Install BlueZ:

     sudo apt-get install bluez bluez-utils

Then check the status of your hci device(s):


In my case, hic0 was software-blocked by default, so typing the following command unblocked it:

     sudo rfkill unblock hci0

For more information on linux bluetooth, see this article.

My Set-Up:

I'm running fluxbox instead of Unity, and GDM instead of LightDM as my login manager.

To install fluxbox, just type "sudo apt-get install fluxbox" and then next time you log in, you can click on "sessions" in GDM or LightDM and select fluxbox.

To install GDM or SLiM or another login manager, install it through apt-get, and the installation process will prompt you to choose with login manager you want to use as your default.  If you want to change your selection after you've installed another one, type "sudo dpkg-reconfigure GDM" and you can change it to another one.

I enjoy the fluxbox keymapping functionality.  You can run "xev" in a terminal to see what keycodes specific button presses fire.  So, for example, running "xev" and pressing the battery icon on the function key panel, I can see it returns keycode 235.  So in ~/.fluxbox keys I've added the following line:
     235 :Exec sudo pm-hibernate

...which makes pressing that key invoke hibernate mode.  For that to work, though, you need to change your sudoers config to not require a password for that command.  To do this, you can create a file called "power" in /etc/sudoers.d/ with the following line:

     %adm ALL=(ALL) NOPASSWD: /usr/sbin/pm-hibernate

Be careful doing this!  You should use visudo rather than a normal editor (as it will validate before writing, and you should not edit /etc/sudoers directly, but rather create a new file in /etc/sudoers.d

EDIT May 7 2014:  I discovered a simpler way to hibernate.  You can just do "systemctl hibernate" as a non-root user, and it should work without mucking around with permissions.  I'm on Arch now though so I can't confirm it works in Ubuntu.

I'm running the following applets in my systemtray in fluxbox:

  • nm-applet:  shows you a little wifi icon indicating your signal strength, and if you click on it you can select a different wireless network and so forth.
  • xfce4-power-manager:  battery monitor 

Here's a screenshot:

Kernel Parameter Weirdness:

By default my kernel parameters in GRUB are set to "quiet splash".  For some reason if I use "nomodeset" (to get a text-based login rather than graphical) then hibernate doesn't work.  No idea why that would be but I didn't spend much time on it.

UPDATE:  Feb 24, 2014 -- OneLink Dock Pro

I ordered a OneLink Dock Pro along with the X1 Carbon.  It arrived just this weekend, much later than the laptop itself.  Plugging in a monitor (1920x1080) to the dock's DVI port worked out of the box, as did USB 2.0 mouse and keyboard.  USB 3.0 hard drive also worked out of the box.  I did not test the DisplayPort connection yet, but I have a DisplayPort->HDMI adaptor on order so I'll give that a try soon.

The picture on the external monitor is not that great, somewhat "washed out" in appearance compared to the identical monitor hooked up to my desktop running Win8 sitting right next to it, using the DVI port on the NVIDIA GPU of the desktop.  I'm not sure why this is yet, or whether it'll possible to fix it.  I tweaked the brightness and contrast and it improved, and it doesn't really bother me, but it's not as nice as I'd hoped.  The "washed out" look is the same using the HDMI port on the laptop itself, or the DVI port on the dock.  I do not have a monitor with DisplayPort connection to test and, as noted above, I couldn't get the mini-DisplayPort on the laptop itself to work (I was using a mDP->DVI adaptor).

FURTHER UPDATE: Feb 24, 2014:  The "washed-out" appearance on external monitor has an easy fix.  See here for instructions.  Yay!!  Looks absolutely great now!

UPDATE:  Feb 27, 2014 -- Can't get 3 displays working with dock (built-in + 2 1920x1080)

I ordered a DisplayPort to HDMI adaptor which came in the mail today.  I'm trying to run 2 1920x1080 monitors connected to the Onelink Dock Pro, one connected to the DVI port on the dock, and the other connected via the adaptor to the DP port.  I get picture on both external monitors, but they're mirrored and I can't find a way to treat them as separate displays.  If I run "xrandr -q", only 1 device is detected for the two ports (DP2). 

If I look at /var/log/Xorg.0.log, the manufacturer info for the monitor I plug in first is detected, the second one is not shown.  This seems to indicate the dock is getting only 1 true video port sent to it, and then doing some kind of splitting.  There is a windows driver for the Onelink Dock Pro that I suspect somehow lets the OS treat the one video output stream as two distinct screens, but no joy for Linux.  Had I known that, I might've gone with the cheaper Onelink Dock with just one video port.

The issue may actually be with the Intel 4400 integrated graphics, though, because I also tried connecting one of the monitors to the onboard HDMI port, and it doesn't work while the laptop is plugged in to the dock, but works fine when I unplug the dock.  So it could be that the intel gfx driver for linux doesn't support 3 displays (although the windows driver apparently does).

Ah well, guess I'll have to wait for either an intel driver that supports 3 displays or a linux driver for the Onelink Pro Dock.

UPDATE: Mar 7, 2014 -- Still no luck with 3 displays

I got confirmation from one of the devs working on the i915 driver that 3 displays should be supported for the 4400, so I tried a newer kernel and it's still not working.  The behavior is:
  • 2 monitors connected through the OneLink Pro Dock (1 on the DVI port, another on the DisplayPort with a passive DP->DVI adaptor):  only 1 display (besides the built-in panel) is detected by 'xrandr -q'.  Both monitors display the picture, but they're mirrored with each other. 
  • 1 monitor connected through the dock DVI port, and 1 connected to the laptop HDMI port:  when I connect the HDMI cable to the laptop, the monitor connected to the dock blanks out and the display is no longer listed in 'xrandr -q', but the monitor connected via HDMI works.
I've ordered an "active" DP->DVI adaptor, and I'm hoping that'll solve it.  The 4400 has two pixel clocks, so in order to support 3 displays, 2 of them have to be sharing a pixel clock.  I'm hoping the active adaptor will allow one external monitor to share a pixel clock with the built-in laptop panel.

UPDATE: Mar 9, 2014 -- No luck with "active" adaptor

I tried the active DP->DVI adaptor with the Onelink Pro Dock.  Behavior is the same.  I did notice that when the 2nd external monitor is plugged in, I get another resolution option for "2560x1024" in xrandr, and if I select that, it does extend the picture across the two instead of mirroring, but that resolution is very poor.  I tried manually adding a resolution of 3840x1080 but that didn't work.  No idea at this point where the real problem lies, so not sure what to try next.  Might be stuck with 1 external monitor.

UPDATE: Apr 28, 2014 -- 3 displays working!

I can confirm it's possible to drive 3 displays with this set-up:
  • internal display 
  • 1 external monitor connected to the laptop's miniDisplayPort with mDP->DVI adaptor, at 1920x1080.
  • 1 external monitor connected to the OneLink Pro Dock via DVI, also at 1920x1080.
I'm running Arch Linux now, though, so apologies I can't offer a suggestion to ubuntu users.  I did try this set-up on Ubuntu 13.10 and it didn't work for some reason, but I never tried it on 14.04 before I switched to Arch.

I would of course rather use two video outputs on the Onelink Pro Dock, but apparently it uses an MST Hub to drive mutliple displays, which is not supported yet.  I can only get two external displays to be mirrored that way (and they show up as one display in xrandr as discussed above).


  1. Incredibly useful, thank you! When I get my X1 Carbon, using your instructions will be the first thing I do.

  2. Thanks, glad you liked it. Let me know how it goes if you get a chance.

  3. Thanks a lot. This is very helpful. What is your experience with battery life? Any special configuration necessary to keep the X1 running as long as possible under ubuntu?

    1. I haven't tested the battery life yet, or any power-saving options, so I couldn't say. I'll test it at some point and post here.

  4. I'm anxiously awaiting the battery life experience.

    1. I'll try to do some timings this week.

    2. Today I got about 5 hours of battery life. Brightness was set at medium, and about 3 of the 5 hours was spent watching video. I was not using it the other 2 hours, and the display was off but it was not hibernating. I think it's got some power management features enabled, but I haven't looked into it.

  5. Thank you very much for sharing your experience. I will receive mine (with onelink dok) in some days and will install ubuntu.

  6. At the top you said "So far I haven't been able to cycle through different sets of buttons." Did you get this to work? If not, how are you able to press volume keys, etc?

    1. I never actually tried to get it working. Instead I just map key combinations in fluxbox. So for example, volume up for me is ctrl-alt-uparrow.

  7. Thanks for all of your hard work. How do you find the touchpad and trackpoint working? I have an issue with my 1st gen X1 carbon, that means that I have to switch off the trackpad (it randomly comes alive when typing, so I can't use it). What about the trackpoint buttons? I use my trackpoint a lot especially the middle button for scrolling, does that work?

    1. There are no dedicated mouse buttons on the Gen 2, unlike the Gen 1. You press on the trackpad itself. It has little red lines that make it look like there might be a button there, but there's not.

      The trackpoint itself works to move the mouse cursor, and I can then left-click or right-click based on where I depress the trackpad. I don't think there's any way to middle-click, at least with my current set-up.

      The trackpoint is not sensitive enough by default, but I'm sure that's easy to configure. I don't use it, though, so I haven't tried it.

      I'm pretty happy with the touchpad after making the config changes I linked above.

  8. Thanks for this very through work-through :) I have the exact same setup and problem with the OneLink dock and two monitors. Except that I have a DisplayPort input in my screen, and as such does not convert to DVI. But same problem.
    The two screens just mirror each other.

    Please keep updates on whether it gets worked out. I will do the same.

    1. Are you daisy-chaining the monitors with DisplayPort? I was thinking I might buy monitors that support that, but it's a pretty expensive test if it doesn't work.

    2. No, I have one DVI and one DisplayPort.

      I have not been able to get it to work correctly, but somehow when running (the one monitor posible) via DP, it went into powersave at irregular intevals. Switching over on DVI circumvented this.

      So now; running laptop open and one monitor connected via DVI to the OneLink dock.

      Would really like to get the second monitor up, and getting suspend/hibernate working. That hasn't happened yet :/

    3. Wow! Somehow the suspend-issue got fixed by the suggestion below by the OpenID dude... hope the bios-upgrade will fix the network-issue then :)

  9. there's an apparent bios update coming (1.13) that will fix the suspend problems. also, if you disable usb 3.0 in bios currently, apparently suspend works.

    1. Great - thanks!! - but this somehow disabled my cabled network in the OneLink dock?! By-passing it for the moment, but does anybody know a fix for this?

    2. I just tried to update the bios (and failed). I downloaded the image and wrote it to a USB stick. Only, I never managed to boot from that stick. Either I have the wrong security settings in the bios or the stick is corrupt (which I can't exclude at the moment). It tries to boot and then says something like "this is not a valid boot image". I forgot the exact phrase and don't have the laptop with me at the moment.

    3. There is an updater for Windows.

      This way the whole boot disk procedure is redundant.

    4. That does not really help me since I wiped my windows installation. Would be quite some effort to recover it just for a bios upgrade. In the end, I probably have to do it, just to get suspend to work.

    5. Well, a temp. fix, as mentioned in another comment, is to disable USB 3.0 in the bios. That makes the laptop come correctly out of suspend.

      But you should be able to make the iso bootable. Maybe with a different usb-stick or, as you said, bios settings.

  10. From
    "Fixed an issue where the computer might not resume normal operation from sleep state on Linux." & "

    Fixed an issue where the LCD brightness control might not work on Linux."

    1. Awesome! - will reboot into windows asap and update!

    2. FYI:

  11. I have updated the BIOS and can confirm the suspend/resume issue is now fixed. However, I have other issues now after resume. For example, the adaptive keyboard does not turn back on. There are also some scaling issues, as everything seems to be blown up and much larger than before suspend.

    Any other users experiencing these issues?

    1. I haven't tried it yet. Are you experiencing any issues with the new BIOS version that are not related to suspend/resume? If it doesn't break anything else, I'll give it a try.

      Out of curiosity, though, why are you guys so keen on using suspend instead of hibernate? With the SSD, resuming from hibernate is lightning fast. Is it just that Unity doesn't offer you the hibernate option in the logout widget (whatever you call that thing)?

  12. I updated to 14.04 last night. No major issues so far (haven't tested thoroughly though), but I'll warn you that the intel-linux-graphics-installer doesn't work on 14.04 yet. The driver that ships with 14.04 is working well, though I haven't tested it extensively. I'm hoping some combination of new driver and new kernel will fix my issue with multiple external monitors (see above) at some point, but I guess I'll have to wait until Intel makes the graphics installer work with 14.04 for my next try.

    A few things I discovered about 14.04:
    --GDM didn't work properly (screwed up my resolution), so I reverted to LightDM and it works fine.
    --gnome-control-center is replaced by unity-control-center. If you're using Unity, it's seamless, but I'm using fluxbox and so I'm launching it explicitly. gnome-control-center still runs, but with some weirdness (it said I was running 13.10 after the upgrade).

    I left my install running over night and this morning I had a very broken system, but I realized later it was because the laptop lost power halfway through the install. So recovery mode, root terminal, and "dpkg --configure -a" and I was back in business.

  13. Thank you for your article and all the comments. It helps a lot ! I'm about to buy my own X1 Carbon Gen2.

  14. I've now switched to Arch. I'm able to get 3 screens working now (internal display, mDP->DVI from the laptop, and DP->DVI from the Onelink Pro Dock). Not sure what the difference is between my Arch setup and my old Ubuntu setup. My kernel version was actually newer in Ubuntu.

    I also found out the Onelink Pro Dock uses an MST hub to drive multiple displays, which is not supported in linux yet apparently, so if you need 3 monitors you're stuck with a setup like mine for now. The only downside is plugging in 2 cables instead of one. Otherwise works great. I wish I could give a specific fix for Ubuntu users other than "switch to Arch!" Arch is not for the faint of heart. Took me several days of geekery to get everything working. Didn't realize what a lightweight I am!

    The hard work for me, though, was figuring out how to set up encryption properly for root and swap partitions and boot with UEFI. Once I got that figured out, the rest was pretty smooth sailing.

  15. I am using a 3.17-rc5 and the MST hub is supported and working. However, even with the latest Intel drivers (pre-3.0, 996), I am only able to drive two screens but that's OK for me. The two screens are plugged directly on the dock

    1. Arch just released 3.17.1-1 to core, and I can confirm Onelink Pro Dock is now working properly with 2 external monitors, both at 1920x1080 resolution. 1 is connected to DVI, the other to the DisplayPort bridged to DVI. Yay! Many thanks to David Airlie from RedHat who I think did the coding for MST hub support.