Install OpenBSD 6.9 in a Raspberrypi 3B+

OpenBSD documentation: https://ftp.openbsd.org/pub/OpenBSD/6.9/arm64/INSTALL.arm64

1. Materials

  • Raspberrypi 3b+
  • UART to USB (required)
  • Raspberry case
  • microSD card (and some way to connect it to the PC)
  • Ethernet connection

2. Pre-steps

2.1. Download minroot

REMEMBER: this is OpenBSD 6.9 (maybe it’s old when you read this1).

wget https://cdn.openbsd.org/pub/OpenBSD/6.9/arm64/miniroot69.img

2.2. Flashing minroot

Find the microsdcard with fdisk -l, my case is /dev/sdd

Flash it:

dd if=miniroot69.img of=/dev/sd<X> bs=1M

Connect the sdcard to the rpi

3. Installation

3.1. Accessing UART

I lost 2 days because I had a bad UART/USB converter, if you have to buy one this one2 works (i’ve seen other people used it to install openbsd on rpi3b too so I bought it too).

Connect ground to pin 6, UART tx (send) to pin 8 and UART rx (receive) to pin 10 https://pinout.xyz/pinout/uart#

Install screen (for linux, or use putty, or whatever).

Find the device with dmesg | grep tty in my case /dev/ttyUSB0.

Execute this and wait:

sudo screen /dev/ttyUSB0 11520

Connect ethernet to rpi3b and connect the UART/USB USB to the PC. Try to connect it to the motherboard USBs, I had problems with the case ones.

Then power the rpi3b (5V 2.5A).

screen starts showing us OpenBSD install process

U-Boot 2021.01 (Apr 16 2021 - 15:39:01 +1000)

DRAM:  948 MiB
RPI 3 Model B (0xa02082)
MMC:   mmc@7e202000: 0, mmcnr@7e300000: 1
Loading Environment from FAT... *** Warning - bad CRC, using default environment

In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:

...

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

3.2. Install OpenBSD

The OpenBSD installer is quite good so you shoudln’t have any problem from here, press I to install and follow the process.

3.2.1. Network

smsc0 is ethernet:

Which network interface do you wish to configure? (or 'done') [done] smsc0
IPv4 address for smsc0? (or 'dhcp' or 'none') [dhcp] 192.168.1.2
Netmask for smsc0? [255.255.255.0]
IPv6 address for smsc0? (or 'autoconf' or 'none') [none] none
Available network interfaces are: bwfm0 smsc0 vlan0.

Default gateway:

Default IPv4 route? (IPv4 address or none) 192.168.1.1

3.2.2. DNS Domain Name

DNS domain name? (e.g. 'example.com') [my.domain]

3.2.3. DNS

3.2.4. Users

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

3.2.5. Disk

Available disks are: sd0.
Which disk is the root disk? ('?' for details) [sd0]
Disk: sd0       geometry: 7764/255/63 [124735488 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 ] 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
Creating a msdos partition and an OpenBSD partition for rest of sd0...done.
/dev/rsd0i: 32668 sectors in 8167 FAT16 clusters (2048 bytes/cluster)
bps=512 spc=4 res=1 nft=2 rde=512 mid=0xf8 spf=32 spt=63 hds=255 hid=32768 bsec=32768
The auto-allocated layout for sd0 is:
#                size           offset  fstype [fsize bsize   cpg]
  a:          1024.0M            65536  4.2BSD   2048 16384     1 # /
  b:          1165.3M          2162688    swap
  c:         60906.0M                0  unused
  d:          4096.0M          4549312  4.2BSD   2048 16384     1 # /tmp
  e:          5914.7M         12937888  4.2BSD   2048 16384     1 # /var
  f:          6144.0M         25051136  4.2BSD   2048 16384     1 # /usr
  g:          1024.0M         37634048  4.2BSD   2048 16384     1 # /usr/X11R6
  h:          8537.8M         39731200  4.2BSD   2048 16384     1 # /usr/local
  i:            16.0M            32768   MSDOS
  j:          2048.0M         57216608  4.2BSD   2048 16384     1 # /usr/src
  k:          6144.0M         61410912  4.2BSD   2048 16384     1 # /usr/obj
  l:         24776.2M         73993824  4.2BSD   2048 16384     1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] A

3.2.6. Sets

Location of sets? (disk http nfs or 'done') [http]
HTTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]
(Unable to get list from ftp.openbsd.org, but that is OK)
HTTP Server? (hostname or 'done') [cdn.openbsd.org]
Server directory? [pub/OpenBSD/6.9/arm64]
Unable to connect using https. Use http instead? [no] yes

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] base69.tgz    [X] game69.tgz    [X] xfont69.tgz
    [X] bsd.mp        [X] comp69.tgz    [X] xbase69.tgz   [X] xserv69.tgz
    [X] bsd.rd        [X] man69.tgz     [X] xshare69.tgz
Set name(s)? (or 'abort' or 'done') [done]
Get/Verify SHA256.sig   100% |**************************|  1544       00:00
Signature Verified
Get/Verify bsd          100% |**************************| 13333 KB    00:03
Get/Verify bsd.mp       100% |**************************| 13407 KB    00:03
Get/Verify bsd.rd       100% |**************************| 16958 KB    00:04
Get/Verify base69.tgz   100% |**************************|   219 MB    00:49
Get/Verify comp69.tgz   100% |**************************| 64340 KB    00:14
Get/Verify man69.tgz    100% |**************************|  7561 KB    00:02
Get/Verify game69.tgz   100% |**************************|  2676 KB    00:00
Get/Verify xbase69.tgz  100% |**************************| 25544 KB    00:06
Get/Verify xshare69.tgz 100% |**************************|  4503 KB    00:01
Get/Verify xfont69.tgz  100% |**************************| 39345 KB    00:09
Get/Verify xserv69.tgz  100% |**************************| 10943 KB    00:03
Installing bsd          100% |**************************| 13333 KB    00:02
Installing bsd.mp       100% |**************************| 13407 KB    00:02
Installing bsd.rd       100% |**************************| 16958 KB    00:02
Installing base69.tgz   100% |**************************|   219 MB    01:16
Extracting etc.tgz      100% |**************************|   254 KB    00:00
Installing comp69.tgz   100% |**************************| 64340 KB    00:38
Installing man69.tgz    100% |**************************|  7561 KB    00:07
Installing game69.tgz   100% |**************************|  2676 KB    00:00
Installing xbase69.tgz  100% |**************************| 25544 KB    00:13
Extracting xetc.tgz     100% |**************************|  7103       00:00
Installing xshare69.tgz 100% |**************************|  4503 KB    00:09
Installing xfont69.tgz  100% |**************************| 39345 KB    00:16
Installing xserv69.tgz  100% |**************************| 10943 KB    00:04
Location of sets? (disk http nfs or 'done') [done]

3.2.7. Timezone

What timezone are you in? ('?' for list) [Canada/Mountain] Europe/Madrid

3.2.8. Finishing

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]

4. Installed OpenBSD

Note: UART still works, keep using it if you want or ssh to it.

4.1. Mandatory screenfetch

                                        _
                                       (_)
              |    .
	    .   |L  /|   .          _          user@hostname
      _ . |\ _| \--+._/| .       (_)         OS: OpenBSD
     / ||\| Y J  )   / |/| ./                Kernel: 6.9 GENERIC.MP#1134 arm64
    J  |)'( |        ` F`.'/        _        Uptime: 6m
  -<|  F         __     .-<        (_)       Packages: 20
    | /       .-'. `.  /-. L___              Shell: ksh (ksh)
    J \      <    \  | | O\|.-'  _           Disk: 1.2G / 56.4G (2%)
  _J \  .-    \/ O | | \  |F    (_)          CPU: ARM Cortex-A53 r0p4
 '-F  -<_.     \   .-'  `-' L__              RAM: 34MiB / 912MiB
__J  _   _.     >-'  )._.   |-'
 `-|.'   /_.          \_|   F
  /.-   .                _.<
 /'    /.'             .'  `\
  /L  /'   |/      _.-'-\
 /'J       ___.---'\|
   |\  .--' V  | `. `
   |/`. `-.     `._)
      / .-.\
      \ (  `\
       `.\

5. Footnotes

Footnotes:

1

Don’t use old software

2

4pin PL2303 USB to UART TTL Cable Module RS232 Serial 4-pin PL2303HX Cable