Installing OpenBSD on a HP Stream 11 Laptop

Oct 9, 2023 · 1956 words · 10 minute read

Five years ago I revived an old HP Stream 11 as a simple travel laptop with Debian Linux. That install is now pretty old, and the laptop's pitiful 2GB of RAM struggles more and more with websites; so it's time for a refresh. Instead of just installing another Linux distribution I thought I'd try something a little different. Since it's #OctOpenBsd, and I have to admit that I've been BSD-curious for a while, this is a good excuse to give OpenBSD a try.

While this is mostly for fun, I do want the laptop to be usable as a travel laptop, so in the worst case I can use it to battle through an airline's overgrown monster of a website to re-book something or other activity that is too painful on a smart phone screen. That means I want:

  • Graphical Interface
  • WiFi
  • Power Management (suspend, hibernate etc.)
  • Modern web browser (Firefox preferred)
  • PDF Viewer
  • Emacs

There is a good Installation Guide from the project directly, and a guide at the OpenBSD Handbook. So this isn't a general guide, but specific to this small toy-like laptop, even if it might be useful to others. I'll go through all the steps, so I can repeat this later, but I'll only comment on the bits that caught me out or didn't appear obvious to me. I've collected the most useful pages I found at the bottom of this post. I'm also assuming that if you're thinking of installing OpenBSD this isn't your first rodeo in the *nix world, so won't be explaining some of the more basic steps.

Prepare Installation USB Stick

Assuming you're on Linux: download the OpenBSD 'install*.img' (7.3 at time of writing) file from a local mirror from the OpenBSD website and then insert a USB stick you're OK completely erasing. Find the name of the disk USB stick with lsblk, normally that's something like sdb, if it already has partitions they'll be listed with a following number, e.g. sdb1, but don't add the number. Then use dd to copy the image onto the USB stick, with:

sudo dd if=install74.img of=/dev/sdb bs=1M

This is where I made my first mistake, I accidentally typed the partition number as the out file location, e.g. sdb1 instead of sdb, for dd, and the result was that on booting I got errors like:

cannot open hd0a:/etc/random.seed: Invalid argument
booting hd0a:/bsd: open hd0a:/bsd: Invalid argument

Which I realised after reading this Reddit post of someone having made the same mistake.

Prepare the Laptop

Before starting the installer we need to set the BIOS settings on the laptop. Turn it on and keep hitting 'Escape' on the keyboard until you get the BIOS screen, then hit F10 to go to the settings. Under Configuration Settings ensure that 'Secure Boot' is disabled, that 'Legacy Boot' is disabled, and that the UEFI boot order puts a USB device above the laptop's hard drive. Save any changes.

(You can also check the option to allow the power manager to give the battery time remaining, it will then later appear when running the power management commands.)

The other thing we want to know is the make and model of the laptop's WiFi card. From Linux you can run lspci and look for an entry with the term "Network Controller" or perhaps "Wireless LAN" in the line, and make a note of the make and model somewhere for later. Once we've installed the OS we'll add the firmware drivers to the install so we can access the internet. We can also find the details once we've done the basic install, if you don't have an OS on the laptop now.

Installation

Power off the laptop, put the USB stick into one of the ports and power it on again. Best that it's also connected to the power while doing the installation.

After seeing the output of 'dmesg' on the screen you'll reach a prompt which asks says:

Welcome to the OpenBSD/amd64 7.4 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?

Select I and press Enter and start answering the questions the installer asks. In the following prompts my answer is always the final response. When it's the same as the default in square brackets you can just press Enter and don't have to manually type it. I've skipped the questions below which are specific to you, e.g. names and passwords.

Don't set up a network interface now, we don't have the drivers installed yet. (But notice that OpenBSD identified the type of WiFi card as being 'iwm'.)

Network interface to configure? [iwm0] Done

Yes, I want a graphical login:

Do you want the X Window System to the started by xenodm(1)? [no] Yes

Since the laptop has a connected keyboard and monitor leave as no. (Otherwise you could connect via terminal, thanks to Fritz A for the explanation.)

Change the default console to com0? [no] No

Choose to setup a non-root user, enter name, password etc.

sd1 is the USB stick, so sd0 is the laptop's built-in disk.

Which disk is the root disk? [sd0] sd0

Yes, it's a travel laptop that is cheap and throw away, so could easily get lost. You will then have to add a passphrase, and enter it every time you boot the computer. Also if you loose that passphrase you won't be able to start it again, so don't forget it.

Encrypt the root disk? [no] yes

First time I didn't encrypt the disk, worried about the performance hit, but in the end decided that if it's a travel laptop that I might loose, it's probably better to encrypt it so I don't have any worries should it become lost. So far the only place I've noticed slower performance is at the start of the boot, first because it stops to ask for the passphrase, and then it has to start by decrypting itself.

At the next step:

Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit [OpenBSD] O

Enter the passphrass, then you see

configuring the root disk sd2...

Choose 'G' for whole disk GPT and that works with UEFI (If you'd selected 'legacy' as the boot type in the BIOS then MBR should work.)

No valid MBR or GPT
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [gpt] gpt

I accepted the auto layout that was suggested (I don't know any better).

We don't want to initialise any other disks.

Which disk do you wish to initialize (or 'done') [done] done

We can't connect to the internet currently, and the sets are one the install disk

Location of sets? disk

It's not mounted.

Is the disk partition already mounted? [no] no

Yes, sd1 is the USB stick

Which disk contains the install media? [sd1] sd1
Which sd1 parition has the install sets? [a] a
Pathname to the sets? [7.4/amd64] 7.4/amd64

Accept all the selected sets (you can remove the games with -game* if you're a boring person).

Continue without verification? [no] yes

Then it starts installing.

When the installer asks again about the location of sets select 'done'.

What timezone are you in [Canada/Mountain]? Europe/Amsterdam

This is case sensitive.

It then doesn't add any firmware, displays the following for a while

Relinking to create unique kernel...

After that it should congratulate you on the install completing successfully. Press h to stop the laptop, remove the USB stick, and press any key to reboot.

Once it's rebooted you should see a login screen, login with your user and leave you looking at a single xterm window floating in void of the FVMW Window Manager. We're not going to worry about that now, we can just use the xterm to set up the WiFi.

(You can shut down the computer by switching to the root account by typing su into the terminal, giving the root account password and then typing halt -p to power off the laptop.)

Installing WiFi Firmware and Connecting to The Internet

For this you'll need another USB stick formatted as FAT32, or you could erase and re-use the one that we just used to install OpenBSD.

I struggled the first time as I had a USB stick that was formatted as exfat and I couldn't mount it without installing an additional package that we can't install because we don't yet have an internet connection. So make sure it's formatted to FAT32.

First you have to identify the model of WiFi card you have, in the case of the Stream11 it's an Intel AC 7265 card. This means it appears under the name 'iwm0' and we need to download the relevant firmware for our version of OpenBSD, which is the file /7.4/iwm-firmware-20230306.tgz, and save it to the USB stick in a folders called 'firmware/7.4/'. Also save the file SHA256.sig from the fireware directory into the same directory on the USB stick.

Plug the USB stick into the laptop, get its name (almost certainly sd2), mount it, and install the firmware from it. Switch to the root account and do that with the following steps where we get the name and partition of the USB stick and then mount it under /mnt/usb.

  $ su
  Password:
  # sysctl hw.disknames
  hw.disknames=sd0:<some number>,sd1:<some number>, sd2:
  # disklabel sd2
  <prints various info on the disk plus the partitons>
  #          size         offset   fstype [fsize bsize cpg]
  c:    <numbers>              0   unused
  i:    <numbers>           8192    MSDOS
  # mkdir /mnt/usb
  # mount /dev/sd2i /mnt/usb

Then we can add the firmware package from the USB stick and run the firmware update. It'll complain that it cannot install all them, as we only downloaded one - we'll get the rest later once we're online. (You could download the whole folder if you wanted and put it into the USB stick and avoid that.)

  # fw_update -p /mnt/usb/firmware/7.4
  fw_update: add intel,inteldrm,iwn,uvideo; update none
  Cannot install...

It should now be installed, then test if it work by bringing the interface up, and then scanning for local networks:

  # ifconfig iwm0 up
  # ifconfig iwm0 scan

Hopefully the output of that includes networks you're expecting. Now we can create a configuration for this interface to connect to your network, which will also reconnect automatically when you reboot the laptop:

Create the file /etc/hostname.iwm0 that contains:

join <SSID> wpakey "<wifi password>"
dhcp
inet6 autoconf
up

Then turn off the current connection and run the 'netstart' script to join your network, and test the connection by pinging your favourite website.

  # ifconfig iwm0 down
  # sh /etc/netstart
  WARNING: /etc/hostname.iwm0 is insecure, fixing permissions
  # ping henryleach.com
  <ping results, Ctrl-c to stop>

I originally included the option 'powersave' after 'up' in the hostename.iwm0 file, but it generated the warning/error ifconfig: SIOCS80211POWER: Invalid argument as the WiFi card doesn't support that feature. Many thanks to Otto M for identifying that.

Now we can finally run fw_update and let it look for any other firmware we might need online.

  # fw_update
  # fw_update: added intel,inteldrm,uvideo; updated none; keep iwm

With that the most basic installation is done. Next we can do post installation setup and personalisation steps.

Resources

For this installation and for the further configuration, in addition to the official project documentation, I found the following posts really helpful. So thank you to all the people who wrote them:


Updates

  • 2023-10-10: Some updates & corrections added after feedback
  • 2023-11-05: Updated to use version 7.4 to match the configuration guide, as that version appeared between the two posts being written. Also changed to using disk encryption, and the right way of installing the firmware.