Pulling my laptop out of my bag this past Friday, I was excited with the prospect of a good relaxing day of hacking on whatever I pleased. Having fulfilled the Thanksgiving family obligations, and negotiated an errand-free day with my wife, I was pretty excited about a full day of tinkering.
I pop open my Thinkpad, it wakes from sleep, and all input is frozen. The screen is rendering the image of my last desktop, but other than that, everything seems frozen, and a little indicator light is blinking at the base of the screen.
"What the shit?" I think and hard reset the machine.
The machine comes POSTs, displays a "disk error" on boot.
"What the shit?"
Experimenting a bit more, I determine that the SSD which I had purchased 3 1/2 years ago, has completely failed. A situation I didn't expect from an SSD, I had only expected that writes might fail at some point.
To make a long story short, I ventured out into the Black Friday chaos, fetched a new Intel 128GB SSD, brought it home and installed it.
Over the past couple months I've been toying with the idea of installing
FreeBSD on my laptop, but had been dissuaded by
lme@'s report on the FreeBSD
Suspend/Resume wiki page. Wherein he
described his experience as mostly positive except:
USB is dead after 2nd resume
Not having USB is somewhat of a deal breaker. Either way, I had some time to
kill, a full OS to install anyways, and it had been some time since
report. Perhaps the issue was fixed by now? Maybe it was just his X200, mine
might be different!
I forged ahead.
Installing FreeBSD is something I've probably done nearly 50 times in my, this time around was a little different however. The new FreeBSD 10 installer allows you to install ZFS as the "root" file system, not only that, you can enable encryption at install too!
I went ahead and installed FreeBSD, giddy with the notion that I might finally have ZFS running on my main machine. Truth be told, I was more excited than any person probably should be about a file system.
Completing the installation, I verified that suspend/resume worked at all. Sure enough, it did! Overjoyed I started setting up my environment to my liking.
After 30 minutes of installing packages and configuring various bits of software, I remembered "USB is dead after 2nd resume"
As you might expect, the USB issue persisted. I started to experiment, and try to think of ways to fix the issue, all said and done I tried:
1, based on this post
The last item actually solved the issue! I was able to use USB devices after multiple suspends!
Note: I should clarify that all these steps are not necessary for functional USB devices after boot. As far as I'm aware, the last item is all that's actually required.
With further experimentation I determined that I was not able to leave USB peripherals connected if I wanted to suspend the machine. Leaving those devices connected would result in the machine suspending, and then immediately waking back up. A "quirk", but something I can cope with in exchange for ZFS and the other goodies that FreeBSD 10 provides.
If you're unable to reproduce these results, you might want to compare your list of kernel modules with mine below. A buggy kernel module can affect suspend/resume in unpredictable ways, from my understanding.
zfs.ko opensolaris.ko geom_eli.ko crypto.ko aesni.ko sem.ko iwn5000fw.ko ums.ko ng_ubt.ko netgraph.ko ng_hci.ko ng_bluetooth.ko ulpt.ko ng_l2cap.ko ng_btsocket.ko ng_socket.ko linux.ko i915.ko drm.ko
Based on another mailing list post, I also set the sysctl
hw.acpi.lid_switch_state=S3 to make sure that the X200 would suspend when I
shut the lid automatically.
Despite my low expectations originally, I had a managed to arrive at a FreeBSD machine which:
All of this, in a 12 inch, 4lb laptop is pretty darn exciting.
As to be expected, there are some quirks, nothing serious, but quirky behaviors nonetheless:
Ctrl+Alt+F9to return to X, and input returns normally.
iwn(4)) driver seems to be "scan your brains out", which if you're trying to save battery or you're out of range of any useful wireless networks, is a little silly. This is easy to fix just by "downing" the interface with
ifconfig wlan0 down
The main purpose of my laptop is to support my work as a developer, the secondary purpose is to support my work as an open source hacker. Having any *nix OS makes the first case feasible, but having FreeBSD unlocks some hacking that I've wanted to do, such as:
rc.d. (aside: systemd which many Linux hackers are familiar with can be considered a poor impersonation of launchd, which is, in my opinion, a pretty stellar job management daemon)
The most unfortunate aspect of this development means that I'm probably stuck on my X200 for another couple years, or at least until somebody else does the foot work to make sure later generation Thinkpads are covered by FreeBSD's sparse laptop support.
I'm plenty satisfied with my work/play environment, all I need is to acquire a FreeBSD sticker for the X200 and I'm set!