(And yet another Windows VS Linux digression… because I didn’t get enough flame and trolls in my Squeeze review)
Debian, my favorite OS, is frozen and on schedule to make another stable release, Wheezy, within the next few months. I’ve installed Wheezy on my “new” Thinkpad T420 and got some interesting results to report, particularly on idle power consumption (battery life). But let me build up to that.
Although a while back I wrote about making old computers last forever running Linux, and although my T40 was still doing everything well for office use, lately I’ve been salivating over SSD read speeds and more CPU power for my CAD use. So a month ago when my T40 suffered its third motherboard death (probably another case of the classic GPU BGA fault that plagued that generation) I decided to upgrade instead of repairing it again.
Considering that I’m unlikely to ditch a laptop until it’s ten years old (as my T40 is now 9.5 years old), it makes economic sense to me to buy a two year old laptop. The T420 would have been around $1,000 brand new, I managed to snag one for $425, and it had an SSD! My T40 is still worth about $100 working. So I conclude the depreciation is steepest in the first two years, after that it holds some value for a while.
I could have got a T410 significantly cheaper, but after reading many reviews I was convinced that the Sandy Bridge delivers ~20% better battery life when idle. 20% idle power means a lot to me.
I debated between the Thinkpad and the same generation Macbook Pro. I’ve been in love with my Trackpoint (a.k.a. pointing stick) for years. For one thing it is fast and precise, once you master it, and for another thing the learning curve prevents others from having fun borrowing my computer. On-board pointing device quality is a signature of portability. Carrying an external mouse is a sign of failure (or at least a sign that portability is not a priority). Last time I used a Mac the touchpad was quite impressive, I think it compared favorably to the Trackpoint. But the Trackpoint delivers three buttons. By the way, the Thinkpad’s touchpad is nothing compared to the Mac’s. Certainly the Macbook Pro itself is superior on thinness and lightness, at least compared to the T420. (Now the X220 may be a different story.) It was competitive. Next time around I just might turn to the dark side.
My insistence on pointing device, keyboard, and chassis quality really narrows the field of laptops I would consider. $425 isn’t far away from the price of some lower-end brand-new laptops. But those aren’t machines that I would enjoy using for 8 years. In my usage, quality is far more important than a 2-year margin on obsolescence.
Debian Wheezy was a clear choice over Lenny Squeeze, since Lenny Squeeze used kernel 2.6.32 which doesn’t support the TRIM command, which purportedly is a very good thing for SSDs. Anyways Wheezy is close enough to release for me to trust it.
Enabling TRIM after installing Wheezy was as simple as adding “discard” to the /etc/fstab options for the SSD - after I checked that my Kingston 128GB SSDNow supports TRIM (every modern SSD should).
I seem to favor ArchWiki entries whenever I find them. This is the one I read on optimizing Linux for a SSD. There are a few additional little pointers there. For example I set my ‘swapiness’ to 1, which is fine since I have 4 whopping GB of RAM.
I kept wondering if Linux would support wear-leveling, which is even more important than TRIM for SSD longevity. The answer is that the SSD’s firmware handles the wear-leveling, and is independent of the OS. In fact, the block numbers used by the OS don’t map to physical block locations. The association is only logical. The secondary implication here is that securely deleting files on an SSD is almost impossible. Linux utilities ‘shred’ and ‘wipe’ will not work at all (and I would say they are a bad idea on flash memory anyway). I find the bottom line to be that SSD’s are not resellable after having written personal data. This SSD is mine now.
Yet another implication is that if I install ANY OS on my SSD that doesn’t support TRIM, the extra wear affects ALL OS’s installed on my SSD, even if they are on separate partitions. For example, it would be imprudent to install Windows XP, which does not support TRIM, unless my use of Windows XP would be very intermittent so the impact would be minimal.
My Favorite Apps
All my favorite apps just worked out of the gate.
- LTSPice IV (Wine)
- MPLAB X IDE Linux
- OpenOffice I mean LibreOffice
- Iceweasel, Chromium/Chrome
Boot Times, Window Managers, and Bugs
In my last installment on Squeeze, I made a big fuss over Windows Managers and boot times, so I should say something about them here.
- Grub-to-login time: 17 sec
- Login-to-KDE time: 7 sec
- Login-to-XFCE time: 3 sec
Hooray for SSD! That is almost twice as fast as my T40 booted with Squeeze. (The difference probably being primarily the SSD rather than the distro, so I don’t know whether Wheezy boots faster than Squeeze.)
In the back of my mind there was a little voice telling me I should at least try Gnome, the most popular window manager because it’s the default. Then a louder, more snobby voice said “why bother? I already know that Gnome is my last choice.”
With Squeeze I had a few bugs to deal with, but this time both KDE and XFCE worked flawlessly out of the box. Almost… in XFCE Thunar takes 30 seconds to launch. If I weren’t so lazy I would have found a new file manager, probably nautilus, to use by now.
I think I might owe an honesty moment here; in my Squeeze review I argued that KDE should be the default desktop environment so it would be more thoroughly debugged. Well, Gnome is still the default and KDE and XFCE seem to be just fine. Oh well.
Another little gotcha: I used WiFi for a network install, and the Debian installer created a static /etc/network/interfaces file, which caused the machine to correctly connect to my WiFi after installation, but it effectively disabled network-manager. All I had to do was edit /etc/network/interfaces and /etc/NetworkManager/NetworkManager.conf to remove the static configuration and enable network-manager, then the applets in both KDE and XFCE worked fine.
So I have a shortage of real “bugs” to report, except:
Idle Power Consumption and Battery Life, all the headache caused by RC6
Before I get into the RC6 problem, one thing I was amazed by is the ultra-low power used by the T420 when it’s asleep (i.e. suspend-to-RAM). The T40 with a Pentium M consumed a couple of Watts when sleeping, so sleeping wasn’t such a great option when traveling. I let my T420 sleep for 8 hours and it was still at 97% charge when I woke it up. I think this is common for new hardware, but it doesn’t seem to get mentioned in reviews, or I missed it somewhere. It is exciting because it makes hibernating obsolete. What purpose does hibernate serve? None. Hibernating is just a waste of SSD write-cycles. Which is fine by me, sleeping is much more convenient.
I spent hours scouring the web trying to find out why Wheezy was drawing 16W when idle, while Windows 7 was drawing only 8W. This is pretty important to me - heaven forbid I should have to run Windows 7 waiting for a new release.
One of the difficulties in chasing an idle power problem is that everyone promotes the solution that worked for them, but no one knows what’s wrong. (Just like asking for car trouble advice). I tried several less important suggestions:
- thinkfan (although it may help make the fan less annoying)
- enabling power savings on peripherals (USB, etc.)
- TLP (actually I think TLP might make some difference, and it was very easy to use, and my wakeups/second went down to 100-200, but it wasn’t the clincher. I may have shaved off a couple Watts here. Also it was pretty easy to change the charging thresholds so I don’t charge above 85%, that ought to help the battery’s longevity.)
- the workaround for the 2.6.38 kernel regression; “pcie_aspm=force” in grub boot options. I wouldn’t have expected this to matter since Wheezy is on kernel 3.2.0, long after the fix was merged.
- disable wireless
The powertop utility was no real help, according to it my display backlight was consuming 12W on the lowest setting. (This was the conclusion after 400 measurements. It changes as it goes.) If powertop were to be believed, I should have taken apart my display looking for a hardware problem. I didn’t believe it.
I knew it had to have something to do with the Sandy Bridge’s idle power saving measures, because my CPU temp was above 55 C when idle, and the fan was running at medium speed all the time, even though the ondemand governer was running and had the clock frequency at 800 MHz, the load was %1, and I had less than 500 wakeups/second at all times, down to 100-200 after using TLP, and powertop reported both CPU cores spending more than 99% of their time in a C7 sleep state. What was left?
I finally - finally - got a clue reading about all the users saying a Ubuntu 12.04 kernel update reduced their Sandy Bridge idle power consumption. Then I found mention that a new Ubuntu 12.04 kernel, 188.8.131.52.27, is the first to have RC6 (RC6 = integrated-GPU-power-saving-state) enabled by default. “Enabled by default,” that means that my Debian 3.2.0-4 kernel almost certainly has the capability, even if it isn’t enabled by default. RC6, it turns out, has been an issue on Linux for some time, and the enable-by-default patch still wasn’t merged into the mainstream kernel as of 3.2.
Here’s where things got weird. Now in hindsight, I can’t help but wonder if it really happened because it seems a little crazy. I already had thrown “i915.i915_enable_rc6=1” into my /etc/default/grub options and rebooted. So I tried “cat /sys/module/i915/parameters/i915_enable_rc6” and was shocked to see it say “-1”. So RC6 is not enabled. Why not? Windows 7 must be enabling it, so it couldn’t be a hardware problem.
dmesg | grep rc6 Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-4-amd64 root=UUID=5e42a3e2-55dc-4ff8-9813-5ac555ea7d21 ro quiet pcie_aspm=force 915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1
There’s a typo in there. But I had already fixed that typo and reran “grub-install /dev/sda”. So I double-checked /etc/default/grub and ran grub install yet again and rebooted. Same results. Now it’s midnight but I can’t give up because I’m close - so so close.
For kicks, I uninstalled an old kernel I had leftover following an upgrade. Maybe - just maybe - grub is applying the correct options to the wrong kernel.
apt-get remove linux-image-3.2.0-3-amd64 grub-install /dev/sda
Bingo! “cat /sys/module/i915/parameters/i915_enable_rc6” returns “1”!
Sure enough, my idle power consumption is now 8.5W with the display turned down, 12W with the display cranked all the way up. This increases my expected battery life from about 5 hours to about 8 hours (I have the 9-cell battery, but it’s used, at about 83% of its design capacity).
The one mystery is that powertop still tells me (after deleting /var/cache/powertop/saved_results.powertop and letting it run another 140 measurements) that eth0, my ethernet port, is consuming 3.5W when unplugged. Is it really?
Linux vs Windows, GPL vs Proprietary
I sometimes ask myself, intending to be objective, why I use Linux instead of Windows. Is there something Linux does that Windows doesn’t? Am I saving time or money using Linux? I have to say, the RC6 issue was a big pain and took a ton of time to work out. It wasn’t really even a bug, it’s just a non-defaulted feature that took me an ice age to locate and switch on. In all it was the worst Linux install process I’ve had in many years.
I use one app that is Windows-only, and another app that is Linux-only, but the apps that I use most regularly are cross-platform and can run on either one. A long time ago I had a “gee-whiz” moment realizing that a Linux server can run multiple desktops for multiple users, which of course Microsoft refuses to do without charging a fortune for licensing, but although cool, it isn’t a capability I have a personal use for.
It seems reasonably clear to me now that the answer is I’m a Linux fanboy. I love my XFCE desktop, I love the applets, I love the package manager. I love running a system that is secure-by-design and doesn’t require an anti-virus. I enjoy running a system that has lean hard drive and RAM footprint, although the T420 is not truly hampered by Windows 7’s bloat. Also I enjoy the freedom.
Speaking of which, Windows 7 fails to run the only Windows-only application that I use, a solid parametric 3d mechanical CAD from 2003, even with Windows XP compatibility mode enabled.
Windows XP, as I mentioned earlier, is a bad choice on an SSD, even if it resides on a “separate” partition, since XP does not and will never support TRIM. Moreover, since the hood is “welded shut”, users are not free to add TRIM support to Windows XP themselves. Even if I wanted to downgrade to an HDD, this SDD is mine forever since I’m unwilling to risk the personal data I’ve put on it.
In short, my beautiful newish T420 is incompatible with my 2003 version solid parametric mechanical CAD. I have Windows 7 but there’s no reason for me to use it, for now.
Microsoft doesn’t strike me as being all that evil for creating this situation. It’s hard to be too angry with Napoleon after meeting Hitler and Stalin.
At work we use a similar application, Solidworks. Solidworks is Stalin. Every year they release a new version, with a new file type. The new version can open old file types, but will only save the new file type. If I had Solidworks 2003, and a client had Solidworks 2010, could we use the software as a communication medium? Not really, only in one direction. I could send my files to the client, but if they sent me something I couldn’t open it. Everyone who uses Solidworks pays to upgrade it every year.
It’s not just Solidworks. The whole parametric solid mechanical CAD field is the same way. Alibre Design, the underdog, does the exact same thing. Every vendor in the field does it.
I hope Freecad keeps coming along. I can’t wait to make the switch. Maybe I won’t need it until then, or if I do maybe I’ll still have my Athlon XP desktop kicking around.
The GPL model appears to me to be very good at delivering the best software for the end-user, just not immediately, and never in small volumes. You look at a popular old field like electronics or graphics, and you see some amazing GPL software, like KiCAD, GIMP, and Blender. But try finding a GPL offering for a little niche field, like laser simulation. If you’re lucky you might relevant C-language libraries on FFT optical propagation and FEA, and you can write the app yourself.
Going back to Windows specifically, one thing that has mystified me recently is that there is no “Windows marketplace” for applications. Oh wait, now I’m googling it, there is such a thing: “Windows Store Online”. I would think it ought to be important to users for finding quality software, in the same way that the package managers (i.e. APT) are important for Linux, or iTunes is important for iOS devices, or Google Play is important for Android. No one wants to surf the wild web with a web browser for free applications that they can download and install on their phone. For one thing, there is no quality control when doing that. No wonder Windows users suffer from malware bundled in their freeware.
I can see that Microsoft, as usual, has got it flat wrong, from a purely practical point of view. For one thing, there is no free software on the Windows Store Online. No wonder “sourceforge” has become analogous in my mind to “Google Play”, and in turn, no wonder I’ve never heard of the MS store. When I want free software for Windows I go to Sourceforge, which I know has some quality control, in fact they require FLOSS. Microsoft isn’t on the FLOSS wagon and doesn’t need APT or Sourceforge, but they are way behind the eight-ball in that: 1) users are not directed to Microsoft Store Online from Windows, i.e. in the “Add and Remove Applications” panel, 2) Microsoft Store Online sucks, severely lacking in diversity and free software. Users would benefit, and MS would benefit.
(I feel like I’m supposed to include the word “ecosystem” in this discussion, but it’s such an annoying buzzword.)
Wheezy is looking great, XFCE and KDE both worked wonderfully. Booting speeds are comparable to Windows 7.
SSDs are fast, the i5-2520M blazes through my LTSpice simulations like a hot knife through butter. I haven’t tried it on auto-routing in PCBNew (KiCAD), but I expect to be dazzled. I can’t imagine why office-type users would care about the CPU, unless they game. The super-low-power sleep makes hibernate obsolete, which is great for the SSD and great for me.
Sandy Bridge has excellent idle power saving capability as well, the T420 getting close to 8 W, which is 15-20% lower than most previous hardware generations (excepting the low-horsepower ULV netbook dogs like Via C7, Intel Atom and AMD E-450).
Enabling RC6 is key to getting good battery life with Wheezy on Sandy Bridge. Lazy users can try Ubuntu 12.04 or later, or enable RC6 on Wheezy and get it right faster than I did. (Ubuntu does seem to trend toward more lazy-friendliness than Debian, I think.) TLP is probably also worth using.
Windows almost stole my keyboard for a few years, but in the end Linux pulled through. Yeah!
My Squeeze Pre-Review has always been my most popular post. Hopefully this time I managed to ignite some flames or attract some trolls, maybe a few folks will even stop by and see some of my under-appreciated topics, like my Radiant Floor, My Bicycling Saga, or Socialism… and I care because? Sometime in the not-too-distant future I’m hoping to do another piece on hypermiling and ecomodding, myself being an evangelical MPG enthusiast.