OpenBSD On A Raspberry Pi 4
Download the necessary files:
ftp ftp://ftp.nluug.nl/pub/OpenBSD/7.7/arm64/install77.img
ftp ftp://ftp.nluug.nl/pub/OpenBSD/7.7/arm64/miniroot77.img
ftp ftp://ftp.nluug.nl/pub/OpenBSD/7.7/arm64/SHA256.sig
ftp ftp://ftp.nluug.nl/pub/OpenBSD/7.7/arm64/SHA256
Notes to myself regarding download mirrors:
- install7x.img is around 800MB and takes about an hour to download from openbsd.org
- Most mirrors don't work with the openbsd command-line ftp client
- mirrors.sonic.net: works
- ftp.nluug.nl: works and is faster than openbsd.org
Verify openbsd downloads:
$ sha256 -C SHA256 install77.img
(SHA256) install76.img: OK
$ signify -Cp /etc/signify/openbsd-77-base.pub -x SHA256.sig install77.img
Signature Verified
install76.img: OK
Get the device name for the microSD card:
# hw.disknames
# dmesg
# disklabel sd1
Using OpenBSD, assuming the microSD card device was recognized as sd1: We can use install76.img or miniroot76.img. Although we CANNOT install the sets from the boot SD card because it will be re-partitioned during the first phase of the install, we can get the sets via http! Wait…what?! Why are we booting from the SD card and not from a USB drive??? Not sure…
Write the miniroot77.img to the microSD card:
# dd if=miniroot77.img of=/dev/rsd1c bs=1m
Note: rsd1c is the c partition of the raw sd1 device
Insert microSD card into the raspberry pi and power on
To get console on hdmi, at boot> prompt, type:
set tty fb0
Answer normal install questions
When asked which disk to use, choose sd0
Use Whole disk
For a 64GB microSD card, the auto-allocated layout is:
a: 1024.0M 65536 4.2BSD 2048 16384 1 # /
b: 4189.8M 2162688 swap
c: 60350.0M 0 unused
d: 4023.0M 10743520 4.2BSD 2048 16384 1 # /tmp
e: 6422.4M 18982656 4.2BSD 2048 16384 1 # /var
f: 6378.8M 32135808 4.2BSD 2048 16384 1 # /usr
g: 1024.0M 45199584 4.2BSD 2048 16384 1 # /usr/X11R6
h: 8342.2M 47296736 4.2BSD 2048 16384 1 # /usr/local
i: 16.0M 32768 MSDOS
j: 3023.8M 64381536 4.2BSD 2048 16384 1 # /usr/src
k: 6144.0M 70574176 4.2BSD 2048 16384 1 # /usr/obj
l: 19746.0M 83157088 4.2BSD 2048 16384 1 # /home
Use Custom layout
a: 1024.0M 65536 4.2BSD 2048 16384 1 # /
b: 4096.0M 2168768 swap
d: 20.0G /usr
e: 12.0G /usr/local
f: * /home
Let's install the sets!
Location of sets? http
HTTP server? cloudflare.cdn.openbsd.org
Reboot, login, and:
$ su root
# syspatch
# pkg_add -Uu
Some things that help when running off an SD card:
- Add
noatimeto root entry in /etc/fstab - Disable library relinking with:
# rcctl disable library_aslr - To activate the console on HDMI, include "set tty fb0" in /etc/boot.conf
Configure doas:
# cp /etc/examples/doas.conf /etc/doas.conf
# vi /etc/doas.conf
Then while editing doas.conf in vi, add the following:
permit nopass keepenv :wheel
Then reload doas without rebooting with:
# doas -C /etc/doas.conf
Enjoy using OpenBSD on your Raspberry Pi 3 or 4!