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:
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):