UPDATE 2018-02-24: I got a new Lenovo X1 Carbon 5th gen and tried to do the same setup with Debian 9.3.0. It was an utter failure because of some boot issues. I went with Xubuntu instead and everything works FLAWLESSLY. Xubuntu is beautiful.
I've had my mind on switching my development machine from a 13" MacBook Pro Retina to a Lenovo X1 Carbon running Linux for a while. The main reason is getting more familiar with Linux itself and also to have a more stable and minimal dev environment. So I finally got the machine and decided to install Debian 8.5 "jessie". Why Debian? Well, I tried installing Arch Linux once and couldn't get past getting wifi to work, and Ubuntu seemed like it added too much stuff. The choice was either Debian or Linux Mint. I went with Debian because it seems like it's the most stable.
I followed the instructions at https://www.debian.org/releases/jessie/amd64/ch04s03.html.en which explicitly say to not use unetbootin which is a tool that makes bootable USBs for you.
- Download the ISO image from the downloads page:
wget http://cdimage.debian.org/debian-cd/8.5.0/amd64/iso-dvd/debian-8.5.0-amd64-DVD-1.iso
- Write the image to a USB device, which you'll need to find first with
diskutil list
on a Mac (for me it was disk1). Then unmount it withdiskutil unmountDisk diskX
. - Copy the image to the disk
cp debian-8.5.0-amd64-DVD-1.iso /dev/disk1
sync
This will wipe everything off the USB so you'll have to reformat it if you want to use it again. You'll need another USB for installing software downloaded from another machine because there won't be internet access at first. If you don't have another USB then follow the Debian instructions on how to make a multi-partitioned bootable USB. An unfortunate side-effect was that Mac OS X's Disk Utility can no longer reformat my USB sticks.
For some reason the version of the BIOS that comes installed on the 4th gen X1 Carbon won't boot from a USB. So you'll have to update the BIOS from http://support.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-x-series-laptops/thinkpad-x1-carbon-type-20fb-20fc/downloads/DS111756
It's pretty easy just follow the wizard.
The machine shipped with Windows 10, which doesn't fully shutdown when you "shut down" the OS so run shutdown /s /t 0
in command prompt or else you can't restart and enter the BIOS (F12). There are some BIOS settings that need to be changed in order to boot from USB. See the BIOS section of https://wiki.debian.org/InstallingDebianOn/Thinkpad/X1%20Carbon%204thGen%20PCIe_SSD/jessie
Once you exit the BIOS and spam the F12 key you should see your USB in the list of devices to boot from. Select it, press enter, and you should get taken into the Debian installer which is nice and easy to step through. I went with GNOME for the desktop environment.
This is where the real trouble began for me. I knew from https://wiki.debian.org/InstallingDebianOn/Thinkpad/X1%20Carbon%204thGen%20PCIe_SSD/jessie that the wifi and sound wouldn't work, and in order to get them to work I'd have to install an updated Linux kernel. So I updated the kernel and it booted but video didn't work. Luckily Debian allows you to boot different kernels so I could install the necessary drivers from Debian booted with the old kernel.
The drivers to install first (from jessie-backports):
- firmware-iwlwifi to get wireless working
- xserver-xorg-video-intel to prevent video from breaking
Download the .debs and then install them with sudo dpkg -i name-of-package.deb
.
Then download the linux-image-4.7.0-0.bpo.1-amd64 kernel .deb and install it the same way as the drivers.
Once everything's been installed you can restart the machine and it should boot into the latest kernel. You should now be able to connect to a wireless network from the Network Manager.
At this point I wanted to install apt packages but nothing was coming up. It turns out the apt sources config was commented out (because of no connectivity?) so I had to uncomment the sources with sudo vi /etc/apt/sources.list
and then run sudo apt-get update
. After this I was good to go.
I knew there would be some gotchas to set everything up but it was quite a frustrating process. I don't know if it's the Linux kernel, Lenovo, or the BIOS to blame but there were issues with all of these components. Maybe the software installed on the X1 Carbons will be fixed and the issues I experienced will go away, but who knows. That said, I do really like this machine because it's very light, has a nice screen, the keyboard feels great, and Debian with GNOME is quite snappy compared to Mac OS X.
A couple of things I'm still trying to figure out and get used to
- the keyboard shortcuts which are different on Mac OS X: ctrl + left|right arrow, copy paste, the placement of the Windows button
- apt-get vs homebrew
an apparent issue with gnome-terminal eating memory
I'll probably write a follow-up after getting used to doing my daily work on this machine.
UPDATE: I switched to XFCE because GNOME was slowwww. XFCE is really excellent and doesn't use many system resources.
The terminal itself has a memory leak?? 😱