January 19, 2015

Introduction

In the beginning, there was Zac. He discovered Linux and ran fifty thousand different distributions, never being satisfied. When one distribution fixed an issue, thirty new issues were created. Subsystems bickered, sound servers wept, and bus systems rended their clothing.

This went on for years and finally Zac gave up. He threw in the towel and bought a Macbook. He basked in the mostly-Unix environment provided by OS X. He occasionally tried to take Linux back but it was always a disappointment. One of the more recent forays into nix, he ventured into the BSD realm. Using FreeBSD from versions 7 to 9, he found a mostly harmonious environment. There were forays into other BSDs but these were but fleeting dalliances. Then the FreeBSD gods thought fit to introduce hellacious regressions/complications around version 9. Thus ended Zac’s adventures in nix yet again for several years.

Enter OpenBSD in 2015, stage left.

Segue

It seems every year, we hear that 20XX is the year of the Linux desktop. Inevitably, every Linux pundit from Brasil to Mongolia will extol the virtues of switching to Linux. Now don’t get me wrong, Linux does great things but it’s never worked out of the box well enough as a desktop. There’s always something to tinker with, some driver to compile, some knob to fiddle with.

I installed OpenBSD 5.6 on my old Thinkpad x201 and much to my surprise, it just worked. Better than installing Windows out of the box on this particular machine in fact. WiFi required a firmware update, but that was as simple as running fw_update. I configured a few settings with the help of the very thorough OpenBSD documentation and it’s pretty much been cake.

Maybe 2015 is the year of the OpenBSD desktop rather than the Linux desktop.

USB Key Setup

I won’t cover how to burn an ISO to a CD. That territory has been tread since before I started using *nix. In fact, I’m not even going to cover USB key creation with OpenBSD install media. OpenBSD does a better job at that in section 4.3.4 of the FAQ.

Basic Tweaks

I’ve taken to storing the various tweaks to config files in OpenBSD in my https://github.com/zacbrown/configs/tree/master/openbsd. There’s three main groups in the openbsd’ folder of configs, spread below. Folders are in italics and bold.

  • fw_update - this is required to update the WiFi drivers. My chipset is the iwl-1000. YMMV.
  • etc - everything in this directory can be copied directly into /etc/.
  • xorg.conf - a little chunk of Xorg config to setup the TrackPoint
  • rc.conf.local - the basic settings I use in mine, including specificying that apmd should dynamically scale the CPU, which daemons to launch, what flags to pass to PF, etc.
    • BSDNow.tv has a good coverage of some of the things you’d put in rc.conf.local.
  • login.conf - Settings for how much heap processes can take before the OS forcibly kills them.

The aforementioned settings are pretty key to a good experience with OpenBSD as a desktop. The xorg.conf file is necessary for the TrackPoint middle-click button to work for scrolling. While rc.conf.local changes aren’t required, many of the options I’ve specified in there are good suggestions for laptop configuration. The login.conf file changes are necessary since web browsers are terrible hogs.

Elaborate Tweaks

I don’t actually have any elaborate tweaking” that had to be done. One open issue is getting the hardware volume buttons to control the hardware mixer rather than routing the commands through X to the application with focus.

  • etc - everything in this directory can be copied directly into /etc/.
  • apm - this folder contains scripts that will be run for various apmd events (suspend, standby, hibernate, shutdown)
    • In my case, the suspend script is used to cause the Xsession to lock. See .xinitrc below for what happens.
  • pf.conf - firewall settings, block all inbound. Might need to allow ssh at some point.
  • bin - some basic helper scripts
  • wireless & wireless.cfg - wireless is a perl script that nicely connects to preconfigured wireless networks specified in wireless.cfg. You can find the original author of the script here.
  • powersaver-mode - uses sysctl to change hw.cpuspeed to lowest setting (0) to reduce CPU usage
  • performance-mode - uses sysctl to change hw.cpuspeed to highest setting (100) to maximize CPU usage
  • .xinitrc - This file is read before X11 is started. Notable entries in it are the launching of xidle which is used by the aforementioned apm scripts to trigger the Xsession to lock on suspend.
  • .kshrc - This file is loaded for each new ksh instance. Just some basic defined variables used in the terminal.
  • .profile - This file is loaded for each new logon session. In order to get it to reload fully, you need to logout and back in.

The configurations above are the extra tweaks I’d have made in some form in Windows had I just installed that. Power management configurations, settings to lock the machine on suspend, firewall settings, and wireless connection settings. None of these are earth-shattering settings to get some fundamental piece working.

Conclusion/Observations

Now at the beginning, I made it sound like it was all completely working when I installed. That may appear misleading considering all the files I describe above but they’re largely customizations as opposed to required steps. The basic tweaks section are the only real requirements.

As far as observations go, the ThinkPad x201 gets great battery life. It’s about the same as running Windows 7 and definitely better than any Linux distribution I’ve tried to run on it. WiFi is also better in OpenBSD than it was on Linux. Signal reception is more consistent whereas it seemed to fluctuate a considerable amount on Linux.

All in all, this is a pleasant surprise and I’ll be running OpenBSD on this laptop for the foreseeable future.


osdev howto openbsd


Previous post
Glorious Nippon I’ve begun the long and arduous (but enjoyable) task of planning the honeymoon that Caroline and I will be taking. I’ve vacillated between several
Next post
Redfin Realtor Ratings Mean Nothing After looking at our finances last fall, I realized that if we were to liquidate some of