Install Linux on Lenovo X1 Carbon
October 16, 2012 8 Comments
After 7 years, my notebook is dying. It’s time for a new one. My requirement is simple. High-resolution screen (anything higher than 1366×768 is OK) and light weight.
While researching, Lenovo released the new Thinkpad, X1 Carbon ultrabook. I used to use Thinkpad T41 and really liked it. This Thinkpad comes with 1600×900 screen and a SSD with Intel new Ivy Bridge CPU. However, Thinkpad notebooks are always on the expensive side, and this X1 Carbon is no difference. However, with a 10% discount promotion I got by signup for a news letter, the price came down within my budget, so I pulled the trigger.
It took about a week for Lenovo to deliver my X1 Carbon. Turning on the machine took about 30 seconds before the Windows login screen shows up, which is quite slow given it has SSD. Turned out there were tons of pre-installed software. The ThinkVantages, Lenovo Business software suit, shows itself proudly in the task bar, so I removed most of them. Next, Norton Antivirus asked me to register to get a license that is valid for 30 lousy days. So Norton is gone. I download Microsoft Security Essential and that will stop Windows from asking me to install an anti-virus program. After all those software removed, boot time is down to about 15 seconds.
Reclaim the space
Lenovo put the recovery disk images on the SSD. It sit on its own partition (drive D:) that is about 13Gb. This is on a SSD with only 128Gb. Luckily, it comes with the program that will burn those images to DVD and let you claim back those space. I have an external DVD writer lying around so it was no problem. If you don’t have one, I think the program lets you copy those images to USB harddrive too.
If you are going to burn it to the DVDs, you will need one DVD for Windows 7 images, and 4 other DVDs for the programs that Lenovo bundled with the machine. I tried to make a second copy of the images, just in case,but the program wouldn’t let me. It said I am only allowed to have one copy of those images. I guess Lenovo doesn’t know I know how to clone those DVDs without using their program
Anyway, once you burn those images, you can use the program to claim the disk space. The program is nice enough to merge the empty space to the existing partition. Note that there is another 10Gb partition reserved for hibernation.
Windows 7 comes with a tool that lets you shrink the size of the partition. I was able to shrink Windows partition down to about 70Gb, leaving about 40Gb empty space that I will install Linux on.
First stop, Ubuntu
I downloaded Ubuntu 12.04 64bit and put it in my external DVD drive. X1 Carbon booted from the DVD drive without any problem. The bios looks for external drive for booting by default.
Installing Ubuntu went very well. At one point, it even turned on the webcam and gave me a choice if I want to take a selt-portrate and use it on the login screen. I refused and choose the picture of a duck instead.
Ubuntu is a mature Linux distro, I did not expect any problem, and there there was no problems. Every just work, including multi-touch gesture.
However, Ubuntu is heavyweight, do-it-all distro. Running Unity session with one terminal opened used more than one Gb of memory. X1 Carbon only has 4Gb of memory, which, by the way, more than enough for what I do, but using more than 25% of total memory doing nothing is a bit too much.
sudo apt-get install openbox obconf
and just like that, openbox is running on my X1 Carbon. The memory usage is down to about 650Mb, which is a great improvement, but if I’m going to use light weight WM, I might as well go lightweight for the whole system.
I considered Arch. Thanks to Ubuntu, I know the hardware works, so if I give it some time I would be running an amazing Arch machine. However, I wanted something quicker and easier to install that lets me get back to work quick. So, no Arch this time.
I ended up installing CrunchBang, a small, lightweight Linux distribution based on Debian. At one time I had it installed on my previous notebook and I was quite impressed with its small memory footprint and speed. Installing CrunchBang on X1 Carbon turned out to be a little pain though.
CrunchBang Linux, or #! for short, currently at 10th iteration, comes with two stable versions. The standard one and the backported one. Both have 32 and 64bit releases.
Problem with #! 10 non-backport release
I decided to have something stable (this is going to be work machine after all), so I downloaded the 64bit non-backported. Installing went OK but I found that the wireless network didn’t work. Also, the synaptics touchpad driver didn’t get loaded for some reason, so multi-fingure geature wouldn’t work. I could have been able to fixed it by download the right drivers, but X1 Carbon only have Wifi. Without Wifi connection, I would need to download those drivers, copy them to X1 Carbon, and try them out. If my Linux experience teaches me anything, I would know that it won’t work the first time. That means I have to repeat those download-and-copy thing several times so I kindda gave up and download the backport release.
Problem with #! 10 backport release
correctly setup. At first I though it was X that messed up so I looked for X config file to fix it. The last time I had to manually fix the X config file was when every was happily using XFree86. I couldn’t even figure out where all the config files for Xorg went. Tuened out they are located at /usr/share/X11, but there is no xorg.conf, which I later learned that Xorg automatically detect the setting so no config file is needed. If xorg.conf exists at /etc/X11, it will be used though.
So, I start editing xorg.conf. I run X -configure to create the xorg.conf.new in my current directory. I copied it to /etc/X11 and rename it and start editing it. However, it didn’t make any different no matter what I tried. Fustrated, I removed all X stuff from the X1 Carbon, hoping reinstall them might magically fix the problem. Once X is gone, I reboot and the machine entered framebuffer console. To my surprise, the framebuffer console has the same problem. It is now clear that it is not X, but it’s the display driver (i915, by the way) that has major issue.
Success with #! 11 testing image
Look like #! is no go. However, before going back to Ubuntu, I decided to give #! another chance. There is a test image of the next release (CrunchBang 11 Waldorf) available. I downloaded it and try it, and it works!. Interestingly, the installer does not detect Windows 7 partition, but when I reboot the machine after installed, Windows 7 is one of the option in there.
There are also small graphic glitches on the top panel where some icons are not completely drawn. but they don’t bother me. More importantly, seeing that it uses only about 300Mb convinced me that at lease I should try living with this unstable release for a while. It might work out, who knows?
Tuning #! for X1 carbon
I was worried about heat and fan noise, but it turned out to be no issue. The heat and noise levels are not different from when it is running Windows 7.
I did added trim support to the SSD. To do so, I added ‘discard’ to fstab
UUID=bfebbf2f-7b62-4415-a232-b83fc276f362 / ext4 discard,errors=remount-ro 0 1
By the way, when assigning partitions for Linux, I only have two partitions, one big “/” that is ext4, and a 1Gb swap that I don’t really expect to use (4gig should be enough for me). Everything I do on this machine will be on SVN server, which in turn backup’ed to Amazon S3. For this reason, I’m not too worry about partitioning too much.
Note that people with Intel graphice cards that use i915 driver can turn on power-saving mode by adding “i915.i915_enable_rc6=1” kernel module parameter when booting the machine. However, rc6 is on by default for Ivy Bridge CPU like the one in this X1 Carbon.
By the way, I get between 4 and 5 hours of usage off a fully charged battery, mostly depend on how bright my screen is. It is comparable to what I get when running Windows. If the screen is on full brightness, then it only lasts about 3.5 hours.
Next, I customized the multi-touch gesture. I wanted it to behave like it does on Windows. That is, a tab for left click, two-finger click for right click, 3-finger click for middle click, and, of course, two-finger scroll.
To do that, I open Openbox autostart script, located at ~/.config/openbox/autostart, and add these lines to synaptics section.
synclient VertEdgeScroll=0 & synclient TapButton1=1 & synclient ClickFinger2=3 & synclient ClickFinger3=2 & synclient PalmDetect=true & synclient ClickPad=true &
So far multi-touch gesture has been awesome, but there are a lot more customize options that I have not tried. See ‘man synaptics’ for all the options. I am particularly interested in what the “circular scroll” is, but I am too lazy to find out.
Adding second keyboard layout
When I installed #! on my previous notebook, it somehow figured out my second language automatically (which is Thai, by the way). However, I had no such luck this time with X1 Carbon. This is an easy fix though. Adding these two lines to autostart script, and I can switch keyboard layout with Alt-Shift, which is the same key combination used in Windows 7.
(sleep 2s && setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,th) & (sleep 5s && fbxkb) &
The first line add second layout to the keyboard, the second line calls the small applet that will be running on the top panel, indicating the current keyboard layout.
Because I choose to use Alt-Shift to switch keyboard layout, pressing a key to trigger emacs text replacement mode becomes a bit harder (since emacs uses similar key combination for this purpose : Alt-Shift-%, or for regex replacement, Ctrl-Alt-Shift-%), so emacs fan should take note.
That’s it for now
This is all I have done so far, and I’m quite happy with it. X1 Carbon is an expensive notebook, even with the discount, and the screen can use some improvement, but overall it is a solid and fast machine. I also like that people don’t look at me using it like when I look at people using MacBook Air
Also, with #!, everything happens instantly. Ubuntu was fast too, but you can feel small latency on everything you do GUI-ly. That feeling is gone with #! (thanks you openbox I guess). If you are still considering X1 Carbon, I say go ahead and get one, and then give #! a try.
(note: I have not tested the fingerprint reader and display port as I do not plan to use them at this point. Thinkpad fingerprint readers are known to work under Linux and I don’t see why the display port won’t work)