Getting rid of my Macbook Air for a Thinkpad X200
I’m a free software guy. I’ve been using some ‘nix (Linux/BSD) so long, that I can’t work on a machine where caps lock is not mapped to ctrl. I get so frustrated in gui’s that I instinctively yell for imaginary children to get off my non-existent lawn. Since 2004, I had only used Thinkpad X or T series. So when I finally bought a Macbook Air in 2011, to the salesperson’s amusement, I told them I’d probably return it in a week or so.
There were so many reasons to not go with the Macbook Air.
Apple was and still is a non-free ecosystem. That was tough to swallow. I couldn’t figure out how to open a shell. Which was kind of embarassing. Who knew how the keyboard would be. No trackpoint either! And quite frankly, I was pretty sure I was going to drop the damn thing and the screen would shatter.
But 5 years - and an immense amounts of dents later - I’ve gone through two of them. Turns out mapping caps to ctrl took about 30 seconds. I setup Ubuntu in VMWare Fusion with 5 GB ram and 4 vCpu and ran it in fullscreen mode, so I could still use GNU/Linux as my OS. I travelled around the world, fell off motorcycles, and got 9 hours of battery life and wifi worked wherever I went. Thing has been bent and out of shape, but it still keeps going. The Macbook Air is robust. And on the single occasion that I had to do some video editing, it had some software which I haven’t used since. And it was fast. Spending $1500 and getting a laptop with 256 GB of SSD back in 2011, well, it was impossible. I remember that an X220 of the same specs would be much more expensive. Apple makes no-brainer hardware. I decided to bide my time until there was comparable hardware to run on and keep running Linux inside a VM.
But here ends my ode to the Macbook Air. I’m switching back on this upgrade cycle. A few reasons:
- At this rate, there will be never any free hardware to run on. I missed out on the Novena, but regardless, I’m not sure how stable it would be for my uses. The Purism laptops are probably not going to be freed. Risc chips are a long ways away.
- I wanted a laptop that can run libreboot. That leaves only a few options - the X61 (2007) or X200 (2008).
- Not upgradable. I keep on running out of disk space. It’s irritating. I’m not doing graphics work, playing games, or programming in java, so I usually don’t have a problem with cpu or memory. And now I can get the full 8 GB ram for linux.
- Tired of paying the Apple tax.
So without further ado, the new laptop and pricing:
- $110 - Thinkpad X200 (Core 2 Duo SL9400, WXGA+ screen)
- $40 - 2 of 4GB DDR3 1333MHZ SO-DIMM
- $240 - 1 TB Mushkin Reactor1
- $40 - 9-cell battery
- $20 - X200 Ultrabase
$450 for a laptop with 8GB of ram and 1 TB SSD, 3.5 pounds and at about an average 10W discharge rate gives about 9 hours of battery life (wifi/browsing). I even splurged for a Zolt charger which weighs next to nothing (100g/0.2 pounds) and can charge up to 3 items at once. After getting rid of the standard thinkpad power brick, the carrying weight between a Macbook Air + charger (3.4 pounds) and the Thinkpad X200 with 9 cell battery and Zolt is about 3.7 pounds.
At the end of the day, browsing isn’t as zippy with all the javascript as it is with a newer processor, but you can still stream a video and use dual monitors.
Setting up the X200
Disable Intel Management Engine
Now you can either flash the chip and remove the Intel ME or you can disable it in the BIOS. Flashing is a bit out of scope right now, but I bought a few spares to try it out.
OS install
I used Xubuntu 16.04. I was considering trying Voidlinux or QubesOS, but this is my new machine, and I just wanted it to work without fiddling around with it too much. It booted from USB and installed without a hitch. However, there is still a bunch of fiddling to do.
Fan
The fan is always on. To disable, need to install thinkfan. Source: http://overtag.dk/wordpress/2012/03/to-all-my-thinkpad-friends-running-linux/
apt-get install tp-smapi-dkms
echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkfan.conf
echo "tp_smapi" >> /etc/modules
modprobe tp_smapi
modprobe thinkpad_acpi
My temperature settings:
$ cat /etc/thinkfan.conf|grep -v \#
(0, 0, 52)
(1, 48, 60)
(2, 50, 61)
(3, 52, 63)
(4, 56, 65)
(5, 59, 66)
(7, 63, 32767)
Problems when resuming
On Xubuntu, the mouse pointer doesn’t show up after resuming. To fix, after resuming:
Ctrl-Alt-F1
Ctrl-Alt-F7
Once in a blue moon, there is some dbus permission error when trying to suspend with the lid open for power savings. I remember a version of OS X + Fusion didn’t play nice and I had to manually suspend my VM’s before closing the lid for it work correctly. However, the Thinkpad suspend/resume by opening and closing the lid works reliably. Just as fast as MBA and to top it off - hardware indicators!2
SSD
Set to weekly trim by default, not doing anything continuous. By the “feel”, it seems as fast as the MBA accessing the SSD through vmhgfs in linux (VMWare Fusion). I can’t really tell. If I get around to it, I’ll do some benchmarks. It is SATAII, so the performance should be reasonable for transfers.
Wifi
The wifi on Xubuntu seems a bit buggy. Occasionally, the indicator shows that it has been disabled via the hardware switch, while it has not. The wifi list sometimes doesn’t repopulate after resume. This is fixed usually by restarting nm-applet. And the script to restarts network manager after resume. Most of the time I resort to sudo iwlist scanning
and setting up new networks manually.
The fix from stackoverflow to restart the network manager after resume is below.
/etc/systemd/system/wifi-resume.service:
[Unit]
Description=Restart networkmanager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
Type=oneshot
ExecStart=/bin/systemctl restart network-manager.service
[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target
And install the wifi resume service.
sudo systemctl enable wifi-resume.service
Battery life
For my normal usage, getting between 8-10 hours or so after installing the laptop mode tools and powertop with a 9-cell battery. Today, for instance, I didn’t bother plugging it in and it went for 8h45 with 13% battery left. Firefox/chrome/shell (no disabling) while making a presentation.
- Wifi off / hardware kill, min brightness, 100 wakeups/sec = 5.5 W
- Wifi on, min brightness, 100 wakeups/sec = 7.0 W
- Normal usage - 50% brightness, 300 wakeups/sec = 10W (based on several hours of writing and browsing)
- Watching youtube - 50% brightness = 15W-17W
The 9-cell battery capacity:
$ cat /sys/devices/platform/smapi/BAT0/design_capacity
93960
Install packages:
sudo apt-get install laptop-mode-tools powertop
The battery logging script:
$ cat ~/battery.sh
#!/bin/sh
unixtime=$(date +%s)
remaining_percent=$(cat /sys/devices/platform/smapi/BAT0/remaining_percent)
current_date=$(date +%Y/%m/%d)
current_time=$(date +%H:%M)
state=$(cat /sys/devices/platform/smapi/BAT0/state)
power=$(cat /sys/devices/platform/smapi/BAT0/power_avg)
echo "${unixtime} ${remaining_percent} ${state} ${current_date} ${current_time} ${power}"
And install it into cron:
crontab -l
* * * * * ~/battery.sh >> ~/battery.log
I originally had set the start and stop thresholds to indicate a deep full-cycle, but this really doesn’t make sense for Li-ion batteries .
echo 80 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
echo 94 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
There are a bunch of additional tweaks available on the ArchLinux Wiki and this page .
Disabling firefox when it is not the focus
Another battery-eater is firefox. This script is a bit buggy on multiple monitors, but it appears to mostly work on single. I turn it on when I really need to extend the life, it’s a bit finicky.
git clone https://github.com/lmacken/tamefox
pip install svn+https://svn.code.sf.net/p/python-xlib/code/trunk/
pip install https://github.com/giampaolo/psutil/archive/release-1.2.1.tar.gz
Ultrabase and Docking Setup
The ultrabase is highly convenient, but don’t expect much. The audio isn’t that great, the sata hd bay adapter looks interesting, but the main feature is the extra displays. Some specs:
- DisplayPort monitor port supporting 2560 x 1600 maximum resolution.
- VGA analog port supporting 2048 x 1536 maximum resoution.
I’ve had no problems running both the 1680x1050 external monitor and the 1440x900 laptop monitor. I treat the laptop almost like a desktop and have an external thinkpad usb keyboard. Will update when I acquire a monitor of the highest possible resolution and see if it can drive two external monitors.
Setting up custom events on docking and undocking can be a bit tricky. Here are my udev rules:
$ cat /etc/udev/rules.d/85-thinkpad.rules
SUBSYSTEM=="drm", DEVPATH=="*/drm/card*", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/tjheeta/.Xauthority", RUN+="/home/tjheeta/thinkpad-dock.sh"
Note that it needs to be run with an environment that has the display and the Xauthority for xrandr to work. It is listening for a card event instead of querying if the dock is connected (/sys/devices/platform/dock.2
). And the dock/undock script is below:
#!/bin/bash
function connect(){
logger -t DOCKING "Switching off LVDS1 and turning on VGA1"
#/usr/bin/setxkbmap -option ctrl:nocaps # has no effect
/usr/bin/xrandr --output VGA1 --mode 1680x1050_60.00 --pos 0x0
/usr/bin/xrandr --output LVDS1 --off
# xrandr --output VGA1 --mode 1680x1050_60.00 --pos 0x0 --output LVDS1 --pos 1680x0 --auto # dual
logger -t DOCKING "Finished docking"
}
function undock() {
logger -t UNDOCKING "Switching on LVDS1"
/usr/bin/xrandr --output LVDS1 --auto
# Turn off all external displays
for output in $(/usr/bin/xrandr --verbose|grep "+"|grep connected| grep -v LVDS|awk '{print $1}'); do
echo $output
logger -t UNDOCKING "Switching off $output"
/usr/bin/xrandr --output $output --off
done
killall -HUP awesome
}
if [ $(cat /sys/class/drm/card0-VGA-1/status) == "connected" ] ; then
connect
else
undock
fi
Screen / Audio
I found that the X200 is easier to read in sunlight. Definitely is not as sharp as the Macbook Air in general. There’s really no comparison between even the Ultrabase and the Macbook Air speakers. The Macbook experience for consuming media is definitely a cut above.
Audio powersave by enabling:
echo "options snd_hda_intel power_save=1" |sudo tee /etc/modprobe.d/audio_powersave.conf
Conclusion
Moving from a Macbook Air 13” (mid-2011/8GB/256GB and mid-2013/8GB/512GB) to an X200 manufactured in 2008 actually wasn’t as bad as I thought it would be. I’ve used it for a month now, and it works fine for everything that I’m doing (programming, browsing, openoffice, containers, streaming video). Let’s face it, the hardware can’t really be compared. The Macbook Air is just damn nice. CPU-heavy tasks are just going to be slower (cough maps.google.com) and wifi setup is a bit of a pain. But $450 to get a 3.5 pound laptop with 8GB of ram and 1 TB SSD that gives around 7-10 hours of battery life is pretty fantastic, too. Xubuntu supports pretty much everything out of the box and the docking station works great for adding an extra monitor. And to top it off, it supports libreboot. Getting back to using linux as a primary OS instead of a VM was a bit tricky, but worthwhile. All in all, an excellent replacement at this price point.
tl;dr - Thinkpads from 2008 are both awesome and potentially libre with some additional work.
- The Mushkin Reactor is the best budget SSD according to Tom’s Hardware and has the lowest power draw. http://www.tomshardware.com/reviews/ssd-recommendation-benchmark,3269.html [return]
- I can’t believe I put an exclamation point for hardware indicators. [return]