Every now and then I want to re-install OpenBSD on my little APU2 system, this time I wanted to benefit from the recent FFS2 improvements which requires filesystems to be recreated. It seems I struggle with remembering some bits and pieces of this process as I get older ;). This blog post is here to document what stuff I need to get the OpenBSD installer going! Yes, that also means I’m not documenting the OpenBSD installer here.
Requirements
- A system for downloading/writing installation media to an USB pendrive; I tend to use Ubuntu on my desktops.
- USB to serial gear and null modem cable.
- Physical access to the APU2.
Preparing the installation media
First thing is to download the installation media, I prefer the media with the installation sets included. So, open up a terminal and wget
that shit. Yes, the APU2 is amd64.
jmaas@mainframe:~/Downloads$ wget https://cdn.openbsd.org/pub/OpenBSD/6.7/amd64/install67.fs
--2020-06-15 17:28:55-- https://cdn.openbsd.org/pub/OpenBSD/6.7/amd64/install67.fs
Resolving cdn.openbsd.org (cdn.openbsd.org)... 151.101.38.217, 2a04:4e42:9::729
Connecting to cdn.openbsd.org (cdn.openbsd.org)|151.101.38.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 476545024 (454M) [application/octet-stream]
Saving to: ‘install67.fs’
install67.fs 100%[================================================================>] 454,47M 3,42MB/s in 2m 27s
2020-06-15 17:31:21 (3,10 MB/s) - ‘install67.fs’ saved [476545024/476545024]
jmaas@mainframe:~/Downloads$
While that download is running, try to find an USB pendrive of at least 1GB. Don’t you love the small OS footprint? Personally, I think it’s awesome! Anyway, plug it into the desktop machine and wipe it! Yeah, that’s right… we don’t want to bother with checking it’s contents first. YOLO!
If you don’t know what the device name is that will be given by the Linux overlords these days, check dmesg | tail
. You can wait for the systemd folks to fuck this up too. Wait… for… it… Anyway, mine is presented to me as /dev/sdc
, now into the kill:
jmaas@mainframe:~/Downloads$ sudo wipefs --all /dev/sdc
/dev/sdc: 5 bytes were erased at offset 0x00008001 (iso9660): 43 44 30 30 31
jmaas@mainframe:~/Downloads$
Now we can dump the installation media onto the drive, no need for fancy tools here.
jmaas@mainframe:~/Downloads$ sudo dd if=./install67.fs of=/dev/sdc
930752+0 records in
930752+0 records out
476545024 bytes (477 MB, 454 MiB) copied, 169,783 s, 2,8 MB/s
jmaas@mainframe:~/Downloads$ sudo eject /dev/sdc
jmaas@mainframe:~/Downloads$
You can now safely pull the USB pendrive from the port.
Setting up the serial console
Since my desktop machine is actually a laptop I need to use an USB to serial adapter. I’ve had some issues in the past getting some of those to work with Linux, so’ll dump the vendor & product information here, it might be useful for someone out there.
jmaas@mainframe:~$ sudo lsusb -s 003:003
Bus 003 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
jmaas@mainframe:~$
For connecting to the APU2 I also need to attach a DB-9 null-modem cable to the USB to serial adapter. A new device should appear in the /dev
directory, in my case it’s /dev/ttyUSB0
. If it doesn’t, well… you’re out of luck I guess.
jmaas@mainframe:~$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 jun 16 07:35 /dev/ttyUSB0
jmaas@mainframe:~$
On the software side of things I tend to just use Putty these days, it’s what I have to use @work anyway (Windows) and it’s good enough for this simple task. If you don’t have access to Putty check out minicom. In any case you need to use the following settings for the serial connection:
Setting | Value |
---|---|
Device | /dev/ttyUSB0 |
Type | Serial |
Speed | 115200 |
Data bits | 8 |
Stop bits | 1 |
Parity | None |
Flow Control | XON/XOFF |
Starting the installation
Now we’re ready to boot into the OpenBSD installer, plug the USB pendrive into the APU2, connect the serial cable and power-on the system. You’ll have to be quick and press ALF-F10 in time to be able to select the USB pendrive as the boot device. On the OpenBSD boot loader prompt, you’ll need to setup the serial connection first.
boot> stty com0 115200
boot> set tty com0
boot> <ENTER>
The kernel will now boot and the installer will be started! The installation process is nicely documented in the FAQ so pleasse use that if you need help.