DEV Community

Cover image for Installing OpenBSD 7 on Raspberry Pi 3 (and 4)
Spacial
Spacial

Posted on • Updated on

Installing OpenBSD 7 on Raspberry Pi 3 (and 4)

Getting Ready

Before anything, you'll need:

  • An Raspberry Pi 3 or 4 (only armv7)
  • An Serial FTL Cable (example)
  • An micro SD Card (your target disk) - min 4GB, but I recommend 16GB.
  • An USB thumb drive (your installer disk) - same as SD card, min 4GB, 16GB recommended - you can skip the thumb drive if you want to install throught internet connection.

All the stuff you'll need.

I suggest you go to OpenBSD arm64 page and download both miniroot70.img and install70.img.

(Optional) Updating Raspberry Pi Firmware

Well, if you want to make your raspi up-to-date fimware, you'll need to use Raspbian to update it, before OpenBSD installation.

Use your last RaspiOS image downloaded and unziped:

# dd if=2022-01-28-raspios-bullseye-arm64-lite.img of=/dev/mmcblk0 bs=1M status=progress conv=fsync
1904+0 records in
1904+0 records out
1996488704 bytes (2.0 GB, 1.9 GiB) copied, 109.776 s, 18.2 MB/s
Enter fullscreen mode Exit fullscreen mode

boot your raspi and log in, then update apt packages info:

pi@raspberrypi:~$ sudo apt update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Get:2 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]              
Get:3 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:4 http://archive.raspberrypi.org/debian bullseye InRelease [23.5 kB]             
Get:5 http://security.debian.org/debian-security bullseye-security/main arm64 Packages [115 kB]
Get:6 http://security.debian.org/debian-security bullseye-security/main armhf Packages [120 kB]
Get:7 http://security.debian.org/debian-security bullseye-security/main Translation-en [75.7 kB]
Get:8 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [250 kB]
Get:9 http://archive.raspberrypi.org/debian bullseye/main arm64 Packages [249 kB]
Fetched 916 kB in 6s (161 kB/s)    
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
7 packages can be upgraded. Run 'apt list --upgradable' to see them.
Enter fullscreen mode Exit fullscreen mode

Update all RaspiOS:

pi@raspberrypi:~$ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libcamera-apps-lite libcamera0 libcryptsetup12 libexpat1 libwbclient0 raspi-config rpi-eeprom
7 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,198 kB of archives.
After this operation, 1,599 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org/debian-security bullseye-security/main arm64 libwbclient0 arm64 2:4.13.13+dfsg-1~deb11u3 [307 kB]
Get:2 http://security.debian.org/debian-security bullseye-security/main arm64 libcryptsetup12 arm64 2:2.3.7-1+deb11u1 [230 kB]
Get:3 http://security.debian.org/debian-security bullseye-security/main arm64 libexpat1 arm64 2.2.10-2+deb11u1 [84.8 kB]
Get:4 http://archive.raspberrypi.org/debian bullseye/main arm64 libcamera0 arm64 0~git20220201+e96d0201-1 [755 kB]
Get:5 http://archive.raspberrypi.org/debian bullseye/main arm64 libcamera-apps-lite arm64 0~git20220131+7ac5197-1 [262 kB]
Get:6 http://archive.raspberrypi.org/debian bullseye/main arm64 raspi-config all 20220126 [30.2 kB]
Get:7 http://archive.raspberrypi.org/debian bullseye/main arm64 rpi-eeprom arm64 13.8-1 [1,529 kB]
Fetched 3,198 kB in 7s (439 kB/s)                                                                                                                                                                                                                                                        
Reading changelogs... Done
(Reading database ... 37475 files and directories currently installed.)
Preparing to unpack .../0-libwbclient0_2%3a4.13.13+dfsg-1~deb11u3_arm64.deb ...
Unpacking libwbclient0:arm64 (2:4.13.13+dfsg-1~deb11u3) over (2:4.13.13+dfsg-1~deb11u2) ...
Preparing to unpack .../1-libcamera0_0~git20220201+e96d0201-1_arm64.deb ...
Unpacking libcamera0:arm64 (0~git20220201+e96d0201-1) over (0~git20220106+44d59841-2) ...
Preparing to unpack .../2-libcamera-apps-lite_0~git20220131+7ac5197-1_arm64.deb ...
Unpacking libcamera-apps-lite (0~git20220131+7ac5197-1) over (0~git20220105+b9a6923-1) ...
Preparing to unpack .../3-libcryptsetup12_2%3a2.3.7-1+deb11u1_arm64.deb ...
Unpacking libcryptsetup12:arm64 (2:2.3.7-1+deb11u1) over (2:2.3.5-1) ...
Preparing to unpack .../4-libexpat1_2.2.10-2+deb11u1_arm64.deb ...
Unpacking libexpat1:arm64 (2.2.10-2+deb11u1) over (2.2.10-2) ...
Preparing to unpack .../5-raspi-config_20220126_all.deb ...
Unpacking raspi-config (20220126) over (20220112) ...
Preparing to unpack .../6-rpi-eeprom_13.8-1_arm64.deb ...
Unpacking rpi-eeprom (13.8-1) over (13.5-1) ...
Setting up libexpat1:arm64 (2.2.10-2+deb11u1) ...
Setting up libwbclient0:arm64 (2:4.13.13+dfsg-1~deb11u3) ...
Setting up libcryptsetup12:arm64 (2:2.3.7-1+deb11u1) ...
Setting up rpi-eeprom (13.8-1) ...
Setting up libcamera0:arm64 (0~git20220201+e96d0201-1) ...
Setting up raspi-config (20220126) ...
Setting up libcamera-apps-lite (0~git20220131+7ac5197-1) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u2) ...
Enter fullscreen mode Exit fullscreen mode

Reboot it:

pi@raspberrypi:~ $ sudo reboot 
Enter fullscreen mode Exit fullscreen mode

After boot, clean all caches and stuff (two commands here):

pi@raspberrypi:~ $ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:~ $ sudo apt clean
pi@raspberrypi:~ $ 
Enter fullscreen mode Exit fullscreen mode

(Optional - Only Raspberry pi 4) After cleaning, you'll update your Raspberry firmware:

pi@raspberrypi:~ $ sudo rpi-eeprom-update
Enter fullscreen mode Exit fullscreen mode

(Optional - Only Raspberry pi 3) After cleaning, you'll update your Raspberry firmware - Only do this if your have sure what you are doing:

pi@raspberrypi:~ $ sudo rpi-update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** We're running for the first time
 *** Backing up files (this will take a few minutes)
 *** Backing up firmware
 *** Backing up modules 5.10.92-v8+
#############################################################
WARNING: This update bumps to rpi-5.15.y linux tree
See: https://forums.raspberrypi.com/viewtopic.php?t=322879

'rpi-update' should only be used if there is a specific
reason to do so - for example, a request by a Raspberry Pi
engineer or if you want to help the testing effort
and are comfortable with restoring if there are regressions.

DO NOT use 'rpi-update' as part of a regular update process.
##############################################################
Would you like to proceed? (y/N)

 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   173  100   173    0     0   1310      0 --:--:-- --:--:-- --:--:--  1310
100  123M  100  123M    0     0  2818k      0  0:00:44  0:00:44 --:--:-- 3612k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 5.15.21-v7l+
 *** depmod 5.15.21-v7+
 *** depmod 5.15.21-v8+
 *** depmod 5.15.21+
 *** Updating VideoCore libraries
 *** Using SoftFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to fbcab73d5a20f592aa9f6b0e364757ef131dae27
 *** A reboot is needed to activate the new firmware
Enter fullscreen mode Exit fullscreen mode

Reboot for this last update:

pi@raspberrypi:~ $ sudo reboot 
Enter fullscreen mode Exit fullscreen mode

Preparing the disks

SD Card

Format your SDcard (on OpenBSD, Linux or whatever) - BEWARE of your disk name! see on dmesg after plug it:

OpenBSD

You can dd to fill zeroes on first bytes or use fdisk to do it (assuming your disk is sd0 - BEWARE) [updated, using dd prefer always the raw device]:

# dd if=/dev/zero of=/dev/rsd0c bs=1m
1+0 records in
1+0 records out
2511872 bytes transferred in 0.034 secs (72095271 bytes/sec)
Enter fullscreen mode Exit fullscreen mode

or

# fdisk -iy sd0
Writing MBR at offset 0.
Enter fullscreen mode Exit fullscreen mode

(Optional) If you want to check:

# fdisk sd0                              
Disk: sd0   geometry: 1936/255/63 [31116288 Sectors]
Offset: 0   Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
*3: A6      0   1   2 -   1935 254  63 [          64:    31101776 ] OpenBSD    
Enter fullscreen mode Exit fullscreen mode

Then you can dd miniroot.img to it:

# dd if=miniroot70.img of=/dev/rsd0c bs=1m
43+0 records in
43+0 records out
45088768 bytes transferred in 0.464 secs (97063297 bytes/sec)
Enter fullscreen mode Exit fullscreen mode

Linux

(Optional) Clean your MBR:

#dd if=/dev/zero of=/dev/mmcblk0 count=4096
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.785621 s, 2.7 MB/s
Enter fullscreen mode Exit fullscreen mode

Then you transfer miniroot70.img to it:

#dd if=miniroot70.img of=/dev/mmcblk0 bs=1M conv=fsync
43+0 records in
43+0 records out
45088768 bytes (45 MB, 43 MiB) copied, 3.31491 s, 13.6 MB/s
Enter fullscreen mode Exit fullscreen mode

Formatting USB thumb drive

After ejecting the SD card and plugging the thumb drive.

OpenBSD

You can dd to fill zeroes on first bytes or use fdisk to do it (assuming your disk is sd0 - BEWARE):

# dd if=/dev/zero of=/dev/rsd0c bs=1m count=2
1+0 records in
1+0 records out
2511872 bytes transferred in 0.034 secs (72095271 bytes/sec)
Enter fullscreen mode Exit fullscreen mode

or

# fdisk -iy sd0
Writing MBR at offset 0.
Enter fullscreen mode Exit fullscreen mode

(Optional) If you want to check:

# fdisk sd0                
Disk: sd0   geometry: 1946/255/63 [31266816 Sectors]
Offset: 0   Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
 0: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
*3: A6      0   1   2 -   1945 254  63 [          64:    31262426 ] OpenBSD      
Enter fullscreen mode Exit fullscreen mode

Then you can dd install70.img to it:

# dd if=install70.img of=/dev/rsd0c bs=1m
504+0 records in
504+0 records out
528482304 bytes transferred in 7.602 secs (69514499 bytes/sec)
Enter fullscreen mode Exit fullscreen mode

Linux

(Optional) Clean your MBR:

# dd if=/dev/zero of=/dev/sda count=4096
Enter fullscreen mode Exit fullscreen mode

then you transfer install70.img to it:

# dd if=install70.img of=/dev/sda bs=1M conv=fsync
Enter fullscreen mode Exit fullscreen mode

With these two last steps, you have SD card and thumb drive ready to rock. Now we connect it, make some adjustments and ready to install.

Installation

After both disks ready, you get your cable (ATTENTION) connect it on correct GPIO's pins, plug it on computer (and turn it on, if you didn't connected the +5V pin). See both connection options bellow.

Connecting on board

To start, you'll need to connect the cable on raspberry pi on GPIO. The pins are 4 (5V), 6 (GND), 8 and 10 (TX/RX).

No red pin GPIO (neither 2 or 4) connection with USB cable plugged for power supply.

BEWARE!!!:

If you want to connect your raspberry pi in your computer AND on power, you need only 3 wires on GPIO.

if you connect both, you'll FRY your USB port AND your Raspberry Pi.

If you want to doit all by the UART/Serial cable, this is how to connect it.

Console

OpenBSD

After connecting you run (verify your device, on /dev/cu*):

# cu -l /dev/cu.usbserial -s 115200 
Enter fullscreen mode Exit fullscreen mode

Linux

On Linux , after connection you'll need to run:

# screen /dev/ttyUSB0 115200
Enter fullscreen mode Exit fullscreen mode

You'll see:

U-Boot 2021.07 (Aug 12 2021 - 02:45:29 -0600)

DRAM:  948 MiB
RPI 3 Model B+ (0xa020d3)
MMC:   mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: usb dr_mode not found
USB DWC2
scanning bus usb@7e980000 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
7[r[999;999H[6n8Scanning disk mmc@7e202000.blk...
** Unrecognized filesystem type **
Card did not respond to voltage select! : -110
Scanning disk mmcnr@7e300000.blk...
Disk mmcnr@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0...
** Unrecognized filesystem type **
Found 5 disks
Missing RNG device for EFI_RNG_PROTOCOL
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootaa64.efi
170694 bytes read in 10 ms (16.3 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Booting /efi\boot\bootaa64.efi
disks: sd0* sd1
>> OpenBSD/arm64 BOOTAA64 1.6
boot> 
Enter fullscreen mode Exit fullscreen mode

If you don't press anything, it will boot automatically. If you want to set some U-Boot options, press something to get U-Boot> prompt.

Configure UART/Serial console

Before begin the installation, you need to setup boot environment with:

# echo "enable_uart=1
program_usb_boot_mode=1" >> /SDCARD/BOOT/config.txt
Enter fullscreen mode Exit fullscreen mode

This will guarantee that your raps boot config will enable Serial/UART console.

Test it before install, you need to see the raspi console booting.

Installation Options

After all set, SD Card, thumb drive, UART cable, serial console, turn it on..

Installing

All installation will be straight forward. On <ENTER> mark is to inform that enter was pressed after option. Let's go:

U-Boot 2021.07 (Aug 12 2021 - 02:45:29 -0600)

DRAM:  948 MiB
RPI 3 Model B+ (0xa020d3)
MMC:   mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: usb dr_mode not found
USB DWC2
scanning bus usb@7e980000 for devices... 5 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0 
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
7[r[999;999H[6n8Scanning disk mmc@7e202000.blk...
** Unrecognized filesystem type **
Card did not respond to voltage select! : -110
Scanning disk mmcnr@7e300000.blk...
Disk mmcnr@7e300000.blk not ready
Scanning disk usb_mass_storage.lun0...
** Unrecognized filesystem type **
Found 5 disks
Missing RNG device for EFI_RNG_PROTOCOL
No EFI system partition
BootOrder not defined
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootaa64.efi
170694 bytes read in 10 ms (16.3 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Booting /efi\boot\bootaa64.efi
disks: sd0* sd1
>> OpenBSD/arm64 BOOTAA64 1.6
boot> 
type 0x0 pa 0x0 va 0x0 pages 0x1 attr 0x8
type 0x7 pa 0x1000 va 0x1000 pages 0x1ff attr 0x8
type 0x2 pa 0x200000 va 0x200000 pages 0x4000 attr 0x8
type 0x7 pa 0x4200000 va 0x4200000 pages 0x3cf5 attr 0x8
type 0x9 pa 0x7ef5000 va 0x7ef5000 pages 0x16 attr 0x8
type 0x7 pa 0x7f0b000 va 0x7f0b000 pages 0x31ef6 attr 0x8
type 0x4 pa 0x39e01000 va 0x39e01000 pages 0x1 attr 0x8
type 0x7 pa 0x39e02000 va 0x39e02000 pages 0x1 attr 0x8
type 0x2 pa 0x39e03000 va 0x39e03000 pages 0x100 attr 0x8
type 0x1 pa 0x39f03000 va 0x39f03000 pages 0x2a attr 0x8
type 0x0 pa 0x39f2d000 va 0x39f2d000 pages 0x7 attr 0x8
type 0x4 pa 0x39f34000 va 0x39f34000 pages 0x1 attr 0x8
type 0x6 pa 0x39f35000 va 0xa3863000 pages 0x1 attr 0x8000000000000008
type 0x4 pa 0x39f36000 va 0x39f36000 pages 0x2 attr 0x8
type 0x0 pa 0x39f38000 va 0x39f38000 pages 0x1 attr 0x8
type 0x6 pa 0x39f39000 va 0xa3867000 pages 0x3 attr 0x8000000000000008
type 0x4 pa 0x39f3c000 va 0x39f3c000 pages 0x1 attr 0x8
type 0x6 pa 0x39f3d000 va 0xa386b000 pages 0x4 attr 0x8000000000000008
type 0x0 pa 0x39f41000 va 0x39f41000 pages 0x1 attr 0x8
type 0x4 pa 0x39f42000 va 0x39f42000 pages 0x2 attr 0x8
type 0x0 pa 0x39f44000 va 0x39f44000 pages 0x2 attr 0x8
type 0x4 pa 0x39f46000 va 0x39f46000 pages 0x1 attr 0x8
type 0x0 pa 0x39f47000 va 0x39f47000 pages 0x1 attr 0x8
type 0x4 pa 0x39f48000 va 0x39f48000 pages 0x2 attr 0x8
type 0x0 pa 0x39f4a000 va 0x39f4a000 pages 0x1 attr 0x8
type 0x4 pa 0x39f4b000 va 0x39f4b000 pages 0x2 attr 0x8
type 0x2 pa 0x39f4d000 va 0x39f4d000 pages 0x1403 attr 0x8
type 0x5 pa 0x3b350000 va 0xa4c7e000 pages 0x10 attr 0x8000000000000008
type 0x2 pa 0x3b360000 va 0x3b360000 pages 0xa0 attr 0x8
type 0xb pa 0x3f100000 va 0xa4c8e000 pages 0x1 attr 0x8000000000000000
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2021 OpenBSD. All rights reserved.  https://www.OpenBSD.org

OpenBSD 7.0 (RAMDISK) #1250: Thu Sep 30 17:13:12 MDT 2021
    deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/RAMDISK
real mem  = 970891264 (925MB)
avail mem = 904114176 (862MB)
random: boothowto does not indicate good seed
mainbus0 at root: Raspberry Pi 3 Model B Plus Rev 1.3
cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
cpu0: 512KB 64b/line 16-way L2 cache
cpu0: CRC32,ASID16
efi0 at mainbus0: UEFI 2.8
efi0: Das U-Boot rev 0x20210700
simplefb0 at mainbus0: 1824x984, 32bpp
wsdisplay0 at simplefb0
wsdisplay0: screen 0 added (std, vt100 emulation)
"system" at mainbus0 not configured
"axi" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
bcmclock0 at simplebus0
bcmmbox0 at simplebus0
bcmgpio0 at simplebus0
bcmaux0 at simplebus0
bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
bcmintc0 at simplebus0
pluart0 at simplebus0: console
bcmsdhost0 at simplebus0: 250 MHz base clock
sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
dwctwo0 at simplebus0
bcmdog0 at simplebus0
bcmrng0 at simplebus0
"thermal" at simplebus0 not configured
"local_intc" at simplebus0 not configured
sdhc0 at simplebus0
sdhc0: SDHC 3.0, 200 MHz base clock
sdmmc1 at sdhc0: 4-bit, sd high-speed, mmc high-speed
"firmware" at simplebus0 not configured
"power" at simplebus0 not configured
"mailbox" at simplebus0 not configured
"gpiomem" at simplebus0 not configured
"fb" at simplebus0 not configured
"vcsm" at simplebus0 not configured
"clocks" at mainbus0 not configured
"phy" at mainbus0 not configured
"arm-pmu" at mainbus0 not configured
agtimer0 at mainbus0: 19200 kHz
"leds" at mainbus0 not configured
"fixedregulator_3v3" at mainbus0 not configured
"fixedregulator_5v0" at mainbus0 not configured
"bootloader" at mainbus0 not configured
usb0 at dwctwo0: USB revision 2.0
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, SB16G, 0080> removable
sd0: 15193MB, 512 bytes/sector, 31116288 sectors
uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev 2.00/1.00 addr 1
uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 2
bwfm0 at sdmmc1 function 1
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 2 not configured
manufacturer 0x02d0, product 0xa9a6 at sdmmc1 function 3 not configured
uhub2 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems product 0x2514" rev 2.00/b.b3 addr 3
umass0 at uhub2 port 3 configuration 1 interface 0 "SanDisk Cruzer Fit" rev 2.00/1.26 addr 4
umass0: using SCSI over Bulk-Only
scsibus1 at umass0: 2 targets, initiator 0
sd1 at scsibus1 targ 1 lun 0: <SanDisk, Cruzer Fit, 1.26> removable serial.07815571030319106005
sd1: 15267MB, 512 bytes/sector, 31266816 sectors
softraid0 at root
scsibus2 at softraid0: 256 targets
root on rd0a swap on rd0b dump on rd0b
WARNING: CHECK AND RESET THE DATE!
gpio at bcmgpio0 not configured
bwfm0: failed loadfirmware of file brcmfmac43455-sdio.raspberrypi,3-model-b-plus.bin
mue0 at uhub2 port 1 configuration 1 interface 0 "Standard Microsystems LAN7800" rev 2.10/3.00 addr 5
mue0: LAN7800, address b8:27:eb:4f:3f:6f
ukphy0 at mue0 phy 1: Generic IEEE 802.3u media interface, rev. 2: OUI 0x0001f0, model 0x0013
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
Welcome to the OpenBSD/arm64 7.0 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? I <ENTER>
At any prompt except password prompts you can escape to a shell by
typing '!'. Default answers are shown in []'s and are selected by
pressing RETURN.  You can exit this program at any time by pressing
Control-C, but this can leave your system in an inconsistent state.

Terminal type? [vt220] <ENTER>
System hostname? (short form, e.g. 'foo') OpenBSD7<ENTER>

Available network interfaces are: bwfm0 mue0 vlan0.
Which network interface do you wish to configure? (or 'done') [bwfm0] mue0<ENTER>
IPv4 address for mue0? (or 'autoconf' or 'none') [autoconf] <ENTER>
IPv6 address for mue0? (or 'autoconf' or 'none') [none] <ENTER>
Available network interfaces are: bwfm0 mue0 vlan0.
Which network interface do you wish to configure? (or 'done') [done] <ENTER>
Using DNS domainname PiDomain
Using DNS nameservers at 1.1.1.1 9.9.9.9

Password for root account? (will not echo) <SOME PASSWORD> <ENTER>
Password for root account? (again) <SAME PASSWORD> <ENTER>
Start sshd(8) by default? [yes] <ENTER>
Setup a user? (enter a lower-case loginname, or 'no') [no] pi <ENTER>
Full name for user pi? [pi] raspberry pi <ENTER>
Password for user pi? (will not echo) <USER PASSWORD> <ENTER>
Password for user pi? (again) <USER PASSWORD> <ENTER>
WARNING: root is targeted by password guessing attacks, pubkeys are safer.
Allow root ssh login? (yes, no, prohibit-password) [no] <ENTER>

Available disks are: sd0 sd1.
Which disk is the root disk? ('?' for details) [sd0] <ENTER>
Disk: sd0   geometry: 1936/255/63 [31116288 Sectors]
Offset: 0   Signature: 0xAA55
            Starting         Ending         LBA Info:
 #: id      C   H   S -      C   H   S [       start:        size ]
-------------------------------------------------------------------------------
*0: 0C      2  10   9 -      3  15  12 [       32768:       16384 ] Win95 FAT32L
 1: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 2: 00      0   0   0 -      0   0   0 [           0:           0 ] unused      
 3: A6      3  15  13 -      5 122  53 [       49152:       38912 ] OpenBSD     
Use (W)hole disk or (E)dit the MBR? [whole] w <ENTER>
Creating a msdos partition and an OpenBSD partition for rest of sd0...done.
newfs_msdos: /dev/r0000000000000000.i: No such file or directory
The auto-allocated layout for sd0 is:
#                size           offset  fstype [fsize bsize   cpg]
  a:           369.0M            65536  4.2BSD   2048 16384     1 # /
  b:           517.9M           821184    swap                    
  c:         15193.5M                0  unused                    
  d:           470.3M          1881952  4.2BSD   2048 16384     1 # /tmp
  e:           649.3M          2845216  4.2BSD   2048 16384     1 # /var
  f:          1937.9M          4175040  4.2BSD   2048 16384     1 # /usr
  g:           515.4M          8143936  4.2BSD   2048 16384     1 # /usr/X11R6
  h:          1680.9M          9199424  4.2BSD   2048 16384     1 # /usr/local
  i:            16.0M            32768   MSDOS                    
  j:          1387.6M         12641952  4.2BSD   2048 16384     1 # /usr/src
  k:          5295.2M         15483712  4.2BSD   2048 16384     1 # /usr/obj
  l:          2337.9M         26328224  4.2BSD   2048 16384     1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] a <ENTER>
newfs: reduced number of fragments per cylinder group from 47224 to 46848 to enlarge last cylinder group
/dev/rsd0a: 369.0MB in 755648 sectors of 512 bytes
5 cylinder groups of 91.50MB, 5856 blocks, 11712 inodes each
/dev/rsd0l: 2337.9MB in 4788064 sectors of 512 bytes
12 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
newfs: reduced number of fragments per cylinder group from 60200 to 59720 to enlarge last cylinder group
/dev/rsd0d: 470.3MB in 963264 sectors of 512 bytes
5 cylinder groups of 116.64MB, 7465 blocks, 14976 inodes each
/dev/rsd0f: 1937.9MB in 3968896 sectors of 512 bytes
10 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0g: 515.4MB in 1055488 sectors of 512 bytes
4 cylinder groups of 128.84MB, 8246 blocks, 16512 inodes each
/dev/rsd0h: 1680.9MB in 3442528 sectors of 512 bytes
9 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0k: 5295.2MB in 10844512 sectors of 512 bytes
27 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
/dev/rsd0j: 1387.6MB in 2841760 sectors of 512 bytes
7 cylinder groups of 202.50MB, 12960 blocks, 25920 inodes each
newfs: reduced number of fragments per cylinder group from 83112 to 82448 to enlarge last cylinder group
/dev/rsd0e: 649.3MB in 1329824 sectors of 512 bytes
5 cylinder groups of 161.03MB, 10306 blocks, 20672 inodes each
Available disks are: sd1.
Which disk do you wish to initialize? (or 'done') [done] <ENTER>
/dev/sd0a (5a3f227dc5571ee7.a) on /mnt type ffs (rw, asynchronous, local)
/dev/sd0l (5a3f227dc5571ee7.l) on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0d (5a3f227dc5571ee7.d) on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0f (5a3f227dc5571ee7.f) on /mnt/usr type ffs (rw, asynchronous, local, nodev)
/dev/sd0g (5a3f227dc5571ee7.g) on /mnt/usr/X11R6 type ffs (rw, asynchronous, local, nodev)
/dev/sd0h (5a3f227dc5571ee7.h) on /mnt/usr/local type ffs (rw, asynchronous, local, nodev)
/dev/sd0k (5a3f227dc5571ee7.k) on /mnt/usr/obj type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0j (5a3f227dc5571ee7.j) on /mnt/usr/src type ffs (rw, asynchronous, local, nodev, nosuid)
/dev/sd0e (5a3f227dc5571ee7.e) on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid)

Let's install the sets!
Location of sets? (disk http nfs or 'done') [http] disk <ENTER>
Is the disk partition already mounted? [yes] no <ENTER>
Available disks are: sd0 sd1.
Which disk contains the install media? (or 'done') [sd1] sd1 <ENTER>
  a:           983040            49152  4.2BSD   2048 16384 16142 
  i:            16384            32768   MSDOS                    
Available sd1 partitions are: a i.
Which sd1 partition has the install sets? (or 'done') [a] <ENTER>
Pathname to the sets? (or 'done') [7.0/arm64] <ENTER>

Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-', e.g.: '-game*'. Selected sets are labelled '[X]'.
    [X] bsd           [X] base70.tgz    [X] game70.tgz    [X] xfont70.tgz
    [X] bsd.mp        [X] comp70.tgz    [X] xbase70.tgz   [X] xserv70.tgz
    [X] bsd.rd        [X] man70.tgz     [X] xshare70.tgz
Set name(s)? (or 'abort' or 'done') [done] <ENTER>
Directory does not contain SHA256.sig. Continue without verification? [no] yes <ENTER>

Installing bsd            0% |                          |     0       --:-- ETA
Installing bsd          100% |**************************| 13720 KB    00:01    
Installing bsd.mp       100% |**************************| 13782 KB    00:01    
Installing bsd.rd        82% |*********************     | 14208 KB    00:00 ETA
Installing bsd.rd       100% |**************************| 17118 KB    00:02    
Installing base70.tgz     0% |                          |     0       --:-- ETA
Installing base70.tgz    99% |************************* |   227 MB    00:00 ETA
Installing base70.tgz   100% |**************************|   227 MB    01:39    
Extracting etc.tgz        0% |                          |     0       --:-- ETA
Extracting etc.tgz      100% |**************************|   246 KB    00:00    
Installing comp70.tgz     0% |                          |     0       --:-- ETA
Installing comp70.tgz     2% |                          |  1408 KB    00:46 ETA
Installing comp70.tgz    99% |************************* | 67072 KB    00:00 ETA
Installing comp70.tgz   100% |**************************| 67418 KB    00:48    
Installing man70.tgz      0% |                          |     0       --:-- ETA
Installing man70.tgz    100% |**************************|  7580 KB    00:09    
Installing game70.tgz   100% |**************************|  2677 KB    00:01    
Installing xbase70.tgz  100% |**************************| 49023 KB    00:31    
Extracting xetc.tgz     100% |**************************|  7080       00:00    
Installing xshare70.tgz 100% |**************************|  4495 KB    00:08    A
Installing xfont70.tgz  100% |**************************| 22965 KB    00:08    
Installing xserv70.tgz  100% |**************************| 12354 KB    00:07    
Location of sets? (disk http nfs or 'done') [done] <ENTER>

What timezone are you in? ('?' for list) [Canada/Mountain] <YOUR TIMEZONE> <ENTER>
Saving configuration files... done.
Making all device nodes... done.
Multiprocessor machine; using bsd.mp instead of bsd.
Relinking to create unique kernel... done.

CONGRATULATIONS! Your OpenBSD install has been successfully completed!

When you login to your new system the first time, please read your mail
using the 'mail' command.

Exit to (S)hell, (H)alt or (R)eboot? [reboot] <ENTER>
syncing disks... done

rebooting...

Enter fullscreen mode Exit fullscreen mode

Answers noted:

  1. System hostname? (short form, e.g. 'foo') - Here you set your Raspberry pi's name.
  2. Which network interface do you wish to configure? (or 'done') [bwfm0] - On OpenBSD 7 you get a lot of things out of the box, here the mue0 interface is Ethernet.
  3. IPv4 address for mue0? (or 'autoconf' or 'none') [autoconf] - Here just pressing enter it will user dhcp as usual.
  4. Password for root account? - Create your root password (and confirm it next).
  5. Start sshd(8) by default? [yes] - I like to start sshd to remote access.
  6. Setup a user? (enter a lower-case loginname, or 'no') [no] - Here I created some normal user, it is optional.
  7. Allow root ssh login? (yes, no, prohibit-password) [no] - If you didn't create a normal user, you'll have to manually copy your ssh-key (and select prohibit-password), or you'll have to set to yes, so you'll have remote access; as root - BEWARE.
  8. Which disk is the root disk? ('?' for details) [sd0] - Here you select SD Card (sd0).
  9. Use (W)hole disk or (E)dit the MBR? [whole] - Let OpenBSD use whole disk.
  10. Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] - Let it use auto layout (unless you want to specify the partitions of your system.
  11. Location of sets? (disk http nfs or 'done') [http] - If you have internet connection, you can use http. If you are doing an offline install or it didn't found your network, you use disk.
  12. Is the disk partition already mounted? [yes] - Just to make sure to mount your thumb drive.
  13. Which disk contains the install media? (or 'done') [sd1] - Select it.
  14. Which sd1 partition has the install sets? (or 'done') [a] - Specify your partition with the install sets.
  15. Pathname to the sets? (or 'done') [7.0/arm64] - Default mount path.
  16. Set name(s)? (or 'abort' or 'done') [done] - All select (or select what you system profile).
  17. Directory does not contain SHA256.sig. Continue without verification? [no] - If you got the sig files and put it with install sets, select no. Otherwise you can select yes (but caution, this could be a security risk).
  18. What timezone are you in? ('?' for list [Canada/Mountain] - Write your Timezone.

And voilĆ , just reboot and your system is ready to go ;)

(Optional) Post-install

Network

To configure your device to use dhcp you need to create a /etc/hostname.<device> file, and include autoconf on it [updated, the best practice is autoconf on net config].

Example (as root):

# echo "inet autoconf" > /etc/hostname.mue0
# echo "inet6 autoconf" >> /etc/hostname.mue0
# chown root:wheel /etc/hostname.mue0
# chmod 0640 /etc/hostname.mue0
# sh /etc/netstart
Enter fullscreen mode Exit fullscreen mode

For wifi, see Further Links.

Time

If you get WARNING: CHECK AND RESET THE DATE! on dmesg or on console, you need to configure ntpd to start and ignore big time offset.

HDMI

If you want to get your raspi to activate the console on HDMI (it will break the serial console after kernel boot) you need to include set tty fb0 on /etc/boot.conf.

Disk Encryption

I didn't encrypted my disk, but if you want to, this tutorial is great.

Updating after install

After installation and date ok, you need to run:

# syspatch
Enter fullscreen mode Exit fullscreen mode

then

pkg_add -Uu
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

Installing OpenBSD on Raspberry Pi was fun. OpenBSD 7 runs flawlessly and you can use it as firewall (adding some usb ethernet adapter), as DNS server, and other stuff.

Tell me if you have any further questions or tips in comments.

bye ;)

Further Links

Credits

  • Pufferfish baby photo by Marty Wakat - shutterstock

Top comments (3)

Collapse
 
andypiper profile image
Andy Piper

Thanks for sharing. Is there any particular reason that you like OpenBSD over Debian / Raspberry Pi OS here? Also, Iā€™m curious how you can update the Pi firmware from OpenBSD, the rpi-eeprom-update comes with Pi OS?

Collapse
 
spacial profile image
Spacial

Great question Andy. I was interested on doing some firewall and VPN stuff for my home network. About updating the firmware, I didn't found any clue yet on OpenBSD (there are some firmware steps after syspatch that I didn't update the article yet, but I couldn't have time to verify if it is a device driver blob to talk to OpenBSD's kernel or if it is a raspberry pi firmware update blob, as soon I confirm this info, I'll update on text).

At this moment, I'll add a section to use Pi OS to update firmware before the OpenBSD installation.

Thanks for your attention and comment!

Collapse
 
andypiper profile image
Andy Piper • Edited

Great stuff, always interested to see what folks are doing with their Pi! It has been a long time since I've used a [*]BSD, so I was also curious about how it might work out.