OpenBSD on the Raspberry Pi 3B


I’ve previously discussed using OpenBSD on the Raspberry Pi where I indicated which models of the Raspberry Pi can run OpenBSD. The 3B is one of those models. I’ve also written about getting an OpenBSD image onto a USB stick using Windows and you can use that same process with a MicroSD card.

With the release, a few days ago, of OpenBSD 6.8, I thought it would be timely to go through the installation process for anyone interested in trying OpenBSD 6.8 on a RPi 3B (N.B. the 3B, not the 3B+).

Getting miniroot68.fs on a MicroSD Card

The RPi 3B will boot only from a MicroSD card. You can, of course, daisy chain it to boot OpenBSD from a USB stick if you want but, to do so, you still need a MicroSD card in the device with the special bootcode.bin file on it. This is a viable way of installing OpenBSD, but here I’m going to talk about installing OpenBSD on – and booting from – a MicroSD card.

First, you need to get the “miniroot” image from your chosen mirror (I use mirrorservice.org located in Kent, UK):

$ wget ftp://ftp.mirrorservice.org/pub/OpenBSD/6.8/arm64/miniroot68.img

I’ve used wget on the command line as I assume the reader is using Linux. If you’re using Windows, then you can download it using your browser, like you usually download files from the internet. I’ve also used the ftp mirror but you can use the http/https mirrors. as well.

Next we’ll verify the signature and checksum of this image file. To do this we need the public key:

$ wget https://ftp.openbsd.org/pub/OpenBSD/6.8/openbsd-68-base.pub

and we’ll need the SHA256 checksum:

$ wget ftp://ftp.mirrorservice.org/pub/OpenBSD/6.8/arm64/SHA256.sig

If you haven’t installed the OpenBSD version of Signify on your (Debian-based) machine, then install it now:

$ sudo apt-get install signify-openbsd

Now we can go ahead and verify our image file:

$ signify-openbsd -C -p openbsd-68-base.pub -x SHA256.sig miniroot68.img

Again, if you’re not using Linux, then you may find this a bit challenging. I’m not aware of a Windows alternative to OpenBSD’s signify application. If you are, please share in the comments.

If you get any warnings or errors from verification, I suggest you redo the steps above – sometimes you can unknowingly transpose characters when you’re using the command line without being careful.

If you’ve downloaded everything from reputable sources (ie. the OpenBSD web site and any of the mirrors listed in the links on their website), then everything should work first time and you can now proceed to ‘burn’ the image to an MicroSD card:

NOTE: the usual warnings apply about making sure the “of=/dev/sda” part in the below command, is your actual MicroSD card – it’s up to you to ensure you specify the write device. I will not be held responsible if you trash your main disk by accident.

$ sudo dd if=miniroot68.img of=/dev/sda bs=1M conv=fsync

Of course, you don’t have to use the command line. You can use a graphical installer of your choice. If you’re on Windows, you could use the Win32DiskImager (see my post) or BalenaEtcher, which is very popular. There are others. The tool you use is not that important.

Once the image has been written/flashed – it shouldn’t take long at all (usually a second or two) – you can put it in your PRi 3B and start it up.

Booting the RPi 3B

The RPi 3B will take a few seconds before it starts to read the MicroSD card. If you’re using a UART-to-Serial cable, you’ll see the U-Boot bootloader cycle through to the point where it begins to boot the OpenBSD kernel:

After a second or two, the kernel will start to spew out information about the RPi’s hardware that it has recognised, eg:

You can see it recognises the RPi 3B’s 1G of RAM (of which approx. 60MB is reserved for the OpenBSD kernel. The CPU is recognised along with a bunch of other stuff as the kernel output continues to scroll:

Note from the above two screenshots, that both the Ethernet (smsc0) and WiFi (bwfm0) interfaces are recognised by the kernel. However, also note that the firmware required for the WiFi has failed to load. Firmware, being proprietary, cannot be distributed with the installer. However, do not be concerned, as this firmware is downloadable after install and, as we will seen, it is done automatically for us on the first boot after install.

You can see from the above slide that I’ve started answering the OpenBSD installer’s questions. I’ve chosen the defaults – except when configuring the network interfaces. The default offered is bwfm0 but, as explained above, this won’t work due to the lack of firmware. Therefore, I want to use the Ethernet interface – smsc0.

I’ve chosen dhcp to get the IPv4 address of smsc0. This can be changed after install to a static IP address – see this post for instructions.

Creating the Disk Partitions

After a few more questions from the installer, you’ll be prompted to decide on the disk partitions. As always, you can have up to 4 primary partitions with the fourth being an “extended” partition as they call it in Linux. You’ll see from the below screen that the installer opts for all 4 but only uses 2. The first is a FAT32 partition. This will contain the bootcode.bin and any other files needed to initiate the RPi 3B before jumping to the fourth partition where the OpenBSD disklabels (extended/sub partitions) will be.

You can go ahead and accept the OpenBSD disklabel defaults (partitions A to L in the above), but I have my own scheme:

As you can see, I’m using a 16GB MicroSD card which equates to 14.9GiB (ie. 16,000,000,000 / 1,024^3 rather than 16,000,000,000 / 1,000^3). I’m not going to be using the X display manager in any form (server or client) so I don’t need /usr/X11R6 on a separate partition. I also won’t be doing any compiling from source code so I don’t need separate /usr/src/ and /usr/obj partitions. I’m going to be using the OpenBSD RPi 3B as a web server so I have large /tmp and /var partitions. I’ve given myself 3G for /home but I’m not sure if I’ll ever need that much. Of course, your own circumstances and intended use of the RPi 3B will help you decide on a layout. I should note that the use of a 16GB MicroSD card was not by choice. I had tried a 32GB MicroSD card for more space but the RPi 3B didn’t like it and wouldn’t let the installer write each disklabel/partition, so I had to settle for something less. I tried two different SanDisk Ultra 32GB Class 10 MicroSDHC cards. Both didn’t work. YMMV.

After the disklabelling is done, we install the Sets:

As I said earlier, I’ll not be using the X display manager so I don’t install them. After installing the Sets and setting the time zone, the installer is finished. You can now reboot (note the automatic installation of bwfm0’s firmware):

Congratulations!
Categories:OpenBSD

7 comments

  1. Thanks for this, I tried installing 6.7 on the Pi3 a few months back and had a terrible time at it. In the end I reluctantly switched to FreeBSD. Given these instructions I might give it another go 🙂

  2. I followed these exact instructions, the initial prompt loaded, I pressed enter, then it loaded a blank black screen. Every time. Have you had this issue, what could have gone wrong?

    • Are you still seeing the same problem? I recall there’s a one-off EEPROM setting for tty that you may need to set. I can’t recall the exact details so I’ll have to investigate.

      • Yes, I’ve still had the same problem. How would I make that change?

      • The reason this happens is because the console defaults to serial. To fix this at the OpenBSD/arm64 BOOTAA64 prompt type: set tty fb0
        Then hit enter again to boot. Once you’ve booted/setup put that same line in /etc/boot.conf and you’ll never need to do it again. That being said, I’ve gotten through these steps (really, you can just follow the prompts):

        1) Install
        2) Add user
        3) Reboot
        4) Login as root and start xenodm
        5) Marvel at Xorg running on OpenBSD arm64
        6) … notice that the keyboard and mouse do not work 😦
        7) notice that the ethernet falls over
        8) cry into my coffee

        The problem appears to be that the smsc driver responsible for the USB and NIC is very unhappy with modern keyboards and mice. I believe the it’s related to the polling rate. Every USB keyboard/mouse I’ve tried results in the same problem – unfortunately, no, a hub did not magic it away. dmesg shows they keyboard and mouse disconnecting/reconnecting repeatedly and I think starting X is the final straw. At that point the NIC times and out and it’s dead, Jim. Somehow I just didn’t expect a USB keyboard to be weak link here.

        FWIW, I’m using 6.9-CURRENT

  3. Solved the issue with HDMI. No keyboard so I can’t get the installer working. John how did you complete the installation process?

    • So I use a wired USB keyboard, but it wasn’t completely reliable. I think that if you unplug/replug it during the boot/installation process it may work for you. I ended up trying multiple keyboards and some worked better than others. Even if it installs I doubt it’ll last long anyway. The NIC is on the USB bus and that appears to the crux of the problem. I dug around a bit and the driver appears to be the same one used in FreeBSD; albeit the FreeBSD version has some changes. Incidentally everything works in FreeBSD.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: