OpenBSD in a laptop

Ángel Ortega

I recently purchased a second hand HP EliteBook 820 G1 laptop and installed OpenBSD 6.6 on it. In this document I write about the installation process and how it feels working on it.

This machine is a Core i5 from 2014, it has 4GB of memory, a 320GB disk, a 12" screen and Ethernet and Wireless interfaces, so it's a rather capable machine. I have 30+ years of experience in UNIX machines but it's the first time I installed OpenBSD in a real computer.

I copied the miniroot66.fs (downloaded from OpenBSD site) from my Linux machine into a pendrive using dd, inserted it into the HP and switched it on. It booted directly from USB; I have to change that.

The installation process is non-graphic and straightforward. After booting, it asked what I wanted to do and I said install; then it asked for my keyboard layout (es) and a host name and then proceeded to network configuration. It detected three devices: em0 iwm0 vlan0, querying info for the first one (Ethernet) by default. I configured it to use DHCP and it worked without hassle. I then proceeded to configure the Wireless LAN: it asked me for the SSID, encryption type and password, but failed because it didn't find the board firmware. My plan is to use this I/F as its main connection, but lets work with Ethernet by now.

I entered the requested information about a domain name, the nameservers (left the ones it got automatically), a password for root, if I want to start sshd by default (of course I want), if I want the X Window System started by xenodm. I changed the default answer to yes. I then setup my user account, answered if I want root ssh login (of course NOT), set my timezone (correctly autodetected as Europe/Madrid) and the installation process continued to main storage configuration.

I told it to use whole disk GPT partitioning and, in a traditional UNIX fashion, it offered me a suggestion for a multiple (9!) partition configuration. Yes, very cool, but I had awful experiences in my past on SunOS, IRIX and ULTRIX systems failing in strange ways while updating or compiling or working because a partition like /usr/local gets full while others like /usr/X11R6 have plenty of space. So thanks, but no, thanks, so I opted for a Custom partition layout.

The partition editor is an old-fashioned one, so I'm familiar with the procedure. I wanted to have all data in the same partition and leave the end of the disk for swap. So I typed a to create a new partition, accepted name a for it (OpenBSD names partitions this way, being c reserved for the whole disk), accepted the default offset, set its size to almost all available space (reserving the end for swap), accepted the default type of 4.2BSD and set the mountpoint to /. I created a second partition and accepted all defaults, as it correctly inferred that I wanted to create a swap partition. Typed q to exit saving and it started the filesystem creation process.

The procedure continued to the downloading and installation of the sets (system software bundles). I chose http, no HTTP proxy and the suggested server and directory. All sets were marked for installation, which is what I wanted, so I moved on. It downloaded all sets and installed them.

After that, it did some some things like choosing a multiprocessor kernel and relinking it and congratulated me for my successful installation. It wanted me to reboot, so I did it.

After rebooting and (expectedly) barfing about failures in the Wireless I/F, it detected that it needed to download some additional firmware, specifically iwm-firmware interl-firmware uvideo-firmware inteldrm-firmware. It downloaded and installed them and then it said that the CPU microcode was updated, available on reboot.

The graphic system started without problems. An ugly X login dialog with the cute OpenBSD fat fish was shown; this is xenodm, an OpenBSD rewrite of the ancient X tool. The OpenBSD guys do not hesitate in heavy patching or rewriting essential software tools if they find them faulty or insecure and this is one of the cases.

So I entered my user and my password and the classic fvwm Window Manager was shown. Ha ha ha how cute those were the days but NO. I will change this as soon as possible, but I need to fix the Wifi issue first.

Firmware updates are done with the fw_update tool, which was ran just before; running it again said that there were no new files to download, which is expected. I ran ifconfig to see if my Wireless card had an IP address, but it didn't. I executed sh /etc/netstart, the script that calls dhclient on the configured interfaces, but my iwm0 had "no link". Executing ifconfig iwm0 scan showed a long list of Wireless access points, including mine, so the hardware seems to work. I rebooted to take a look at the kernel log lines about firmware, but there were no errors, just again a "no link". I looked closely at the output of the scan subcommand again and it said !wpakey: I double checked the information at /etc/hostname.iwm0 and discovered I mistyped the password. Fixed it, reran the network setup script and my wireless got an IP almost immediately. I'm such a bonehead.

Before moving further, the syspatch utility must be executed; it checks, downloads and installs any security patches for the current system. There were a bunch of them. A kernel relinking was done. I rebooted.

I logged in (OMFG this fvwm awful thing again I have to change it) and then proceeded to do my most basic configuration steps, so I copied my ssh and tmux setup from the server. It also seems that the locale is not configured by default, so I added export LANG=en_US.UTF-8 to my ~/.profile.

The first thing I do on new systems is to compile and instally my text editor Minimum Profit because, you know, I eat my own dog food and vi is for weenies. OpenBSD comes with a full UNIX development kit; the only thing not already available was the git tool.

Up to now, all installed software is an official part of the OpenBSD system. Anything else is available as a package, installed and configured into /usr/local. This may surprise you if your experience comes from Linux distributions, where everything is treated the same.

Package installation is done with the pkg_add utility. So, typing pkg_add git downloads and installs the thing and its dependencies. You can search for available packages by typing pkg_info -Q followed by the partial name of a package. Without arguments, pkg_info lists the already installed packages. Packages can be updated by typing pkg_add -u.

So I compiled and installed my text editor and set the appropriate EDITOR variable in ~/.profile. This is starting to look fine.

OpenBSD doesn't have sudo, but a similar and simpler tool named doas. I configured it to work for me by typing echo 'permit persist keepenv angel' > /etc/doas.conf.

So it was time for installing a more modern desktop system: doas pkg_add mate mate-utils mate-extras did it. A fuckton of packages were downloaded and installed (I even had to choose between two flavours of unzip, go figure). After that, df -h reported a disk usage of 3.4G. Not bad. I see a total size of 462G. What? When I bought this laptop it said 320G. Let's hope it's not a bug that will spectacularly crash the system trying to write beyond the disk's boundaries.

The MATE desktop will be launched by xenodm, so it must be configured in the ~/.xsession file. This is the content of mine:

. ~/.profile
exec ck-launch-session mate-session

I import ~/.profile for my environment settings (not very orthodox, I know) and launch mate-session from there. I cargo-culted the ck-launch-session from somewhere; it's a consolekit2 thing that I don't remember what is was for.

So I relogged and found a default MATE desktop configuration. It's snappy, fast and delicious. I then proceeded to do my usual configuration tweaks: changed desktop and terminal themes to something darker, set a wallpaper, configured keyboard shortcuts for workspace switching to Win+number, terminal launch to Ctrl-Alt-T, tile window to east / west corner to Win+left / Win+right and changed the Compose key to Caps-Lock in Keyboard/Layouts/Options.

I also installed Firefox. The web looks fine, even JavaScript-infested behemoths like Facebook. Youtube works fine as well: Tears for Fears are now singing Shout, video flows very smoothly. Sound also works very well, even the Fn+volume keys work. I'm seeing ads in Youtube; though Adblock was automatically installed when I logged into the firefox sync thing it seems to not be working.

My first impression: OpenBSD fucking rocks. The installation is smooth and with very reasonable defaults. Hardware just work out of the box. External package integration is fantastic.

I'll write a followup to this post after some days of work with this machine. I still have to try Bluetooth (does this machine even has it?), external USB mounts and the biggest pain in the pass in UNIX systems: printing and scanning.

Continues in OpenBSD in a laptop, part 2.