Dave's OpenBSD Blog 1. Installation, disklabels
Over the span of a week, I’ve read the first three chapters of Absolute OpenBSD, 2nd Edition (nostarch.com). Here’s a quick summary (in my words):
-
Chapter 1: RTFM or die
-
Chapter 2: Pre-installation hardware and filesystem checklist
-
Chapter 3: Installation
I’ve gotten through the first 50 pages of the book pretty quickly, but I’m sure my pace will slow way down once I hit more things to do and try.
Installation
I’d installed OpenBSD on my old 32-bit Compaq laptop before a couple years ago. The installer doesn’t seem to have changed much since then. A bunch of blue text scrolls by as it starts up and detects hardware. Then you’re in the installer.
OpenBSD’s installer is pretty hardcore. I love a good text interface and believe that brevity can be a virtue, but this is brutal. I don’t see any reason why there couldn’t be an additional option for each step to provide guidance and explain the options available. (The interface could remain unchanged for old pros.)
For example, when picking the location of the file sets (OpenBSD allows you to install only the parts you need), it’s not clear whether or not you need to mount the media or not. And I’ll be darned if I could figure out how to list available WiFi ESSIDs. Better hope you remember yours. Oh, and type it perfectly the first time or you’re gonna have to wait for a bit to get another go at it…
Again, I love a fast text interface, but this is like trying to solve a puzzle in Colossal Cave Adventure:
YOU ARE STANDING IN A DEVICE NODE east THERE ARE SOME DRIVES HERE look drives SOME OF THEM APPEAR TO BE SCSI DRIVES. MAYBE YOU CAN MOUNT ONE? mount a drive YOU HAVE FALLEN INTO A PIT AND DIED.
Well, that’s what documentation is for, right? I just needed to RTFM. The thing is, here’s what the FAQ says:
Choose (I)nstall and follow the instructions.
I also discovered that there is more information for each platform. Here’s the i386 install instructions:
Which is better, but won’t exactly walk a newbie through finding the sets on a USB flash drive (which I assume is still the most popular option for OS installs in the preset era - I don’t miss "burning another coaster" to try out distros).
By contrast, Slackware’s installer treats finding the "software series" (counterpart to OpenBSD’s "file sets") on a USB flash drive a first-class option.
The "interesting" parts of the installation are:
-
Setting up the network (well, Ethernet’s easy. WiFi is cumbersome.)
-
Finding the installation media (file sets)
-
Partitioning and labeling the disk
None of these things are really hard. They just take some experience and/or reading. In particular, the OpenBSD partition and label scheme will require some reading. OR you can just let the installer use the whole disk and go with the defaults, which seems like a perfectly valid thing to do unless you’re setting up a database server or other task-specific instance.
Disklabels
As mentioned above, OpenBSD’s handling of disks - particularly how it sets up default partitions is something you’ll need to learn about if you’re going to make any customizations. Or, as in my case, you’re just wanting to learn. The book goes into this in detail.
The book lead me to the disklabel(8)
utility, and the accompanying man page really is excellent. For example, it has an explanation of the automatic disk allocation as performed during installation (unless you choose to customize it).
The man page also has an example that shows how to view the current allocation on a disk. Here’s the output on my laptop after the automatic disk allocation:
# disklabel -h wd0 # /dev/rwd0c: type: ESDI disk: ESDI/IDE disk label: TOSHIBA MK8025GA duid: 5eeb200ab13a8ea4 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 9729 total sectors: 156301488 # total bytes: 74.5G boundstart: 64 boundend: 156301488 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 1.0G 64 4.2BSD 2048 16384 12960 # / b: 2.1G 2097216 swap # none c: 74.5G 0 unused d: 4.0G 6549952 4.2BSD 2048 16384 12960 # /tmp e: 7.7G 14938528 4.2BSD 2048 16384 12960 # /var f: 6.0G 31184000 4.2BSD 2048 16384 12960 # /usr g: 1.0G 43766912 4.2BSD 2048 16384 12960 # /usr/X11R6 h: 10.6G 45864064 4.2BSD 2048 16384 12960 # /usr/local i: 2.7G 68032736 4.2BSD 2048 16384 12960 # /usr/src j: 6.0G 73780928 4.2BSD 2048 16384 12960 # /usr/obj k: 33.3G 86363840 4.2BSD 2048 16384 12960 # /home
(By the way, I kept wondering why my laptop didn’t have an sd0
. It’s because
this ancient machine has an actual spinning IDE platter drive. So it’s wd0
as
shown above.)
For comparison, here’s how my disk was partitioned on the Vultr VM instance:
openbsd$ doas disklabel -h sd0 # /dev/rsd0c: type: SCSI disk: SCSI disk label: Block Device duid: 3285349b17381d96 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 3263 total sectors: 52428800 # total bytes: 25600.0M boundstart: 64 boundend: 52428800 drivedata: 0 16 partitions: # size offset fstype [fsize bsize cpg] a: 22679.5M 64 4.2BSD 2048 16384 38144 # / b: 256.0M 46447776 swap # none c: 25600.0M 0 unused d: 2664.4M 46972064 4.2BSD 2048 16384 12960 # /usr/local
So that’s a big win for the OpenBSD man pages so far.
The installer is not a joy to use, but I don’t think it would take a huge amount of additional effort to make it way more pleasant for newbies.
It looks like I’ve found the installer source. It’s in "miniroot" and the bulk of it is a 3k line ksh script called install.sub:
-
github.com: miniroot / install.sub
-
cvsweb.openbsd.org: miniroot / install.sub
It would be really interesting to see how easy it might be to make improvements to this script. And equally interesting to see how amenable the OpenBSD folk would be to some big UX changes therein.