💾 Archived View for gemini.circumlunar.space › users › kraileth › neunix › eerie › 2019 › openbsd_on… captured on 2023-03-20 at 19:25:50. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
Here I'm republishing an old blog post of mine originally from October 2019. The article has been slightly improved.
Earlier this year I came by an old SunFire v100 that I wrote about in my previous article. After taking a look at the hardware and the LOM, it’s time to actually do something with it! And that of course means to install an operating system first.
A SPARC in the night - SunFire v100 exploration
OpenBSD, huh? Yes, I usually write about FreeBSD and that's in fact what I tried installing on the machine first. But I ran into problems with it very early on (never even reached single user mode) and put it aside for later. Since I powered up the SunFire again last month, I needed an OS now and chose OpenBSD for the simple reason that I have it available.
First I wanted to call this article simply "OpenBSD on SPARC" - but that would have been misleading since OpenBSD used to support 32-bit SPARC processors, too. The platform was just put to rest after the 5.9 release.
Version 6.0 was the last release of OpenBSD that came on CD-ROM. When I bought it, I thought that I'd never use the SPARC CD. But here was the chance! While it is an obsolete release, it comes with the cryptographic signatures to verify the next release. So the plan is to start at 6.0 as I can trust the original CDs and then update to the latest release. This will also be an opportunity to recap on some of the things that changed over the various versions.
I had already prepared the machine for installation previously, so I only needed to make a serial connection and everything was good to go. If you're in need of doing this and don't feel like reading the whole previous article, here's the important steps:
1. Attach power to go to the lom prompt
2. Issue _boot forth_ and then _poweron_ to go to the loader
3. At the ok prompt use _setenv boot-device cdrom disk_ to set the boot order
4. Set an alias for the CD-ROM device with _nvalias cdrom /pci@1f,0/ide@d/cdrom@3,0:f_
5. Reset the machine with _reset-all_ or _powerdown_ and then _poweron_ again
Booting up the OpenBSD 6.0 sparc64 CD (PNG)
Insert the OpenBSD installation CD for SPARC64 and after just a moment you should be in the installation program.
OpenBSD's installation program is very simple. It's basically an installation script that asks the user several questions and then goes ahead and does the things required for the desired options. In the Linux world e.g. Alpine Linux does the same, and I've always liked that approach.
OpenBSD 6.0 installer started (PNG)
On a casual installation, the script would ask for the keyboard layout. But since we're installing over serial here, that doesn't matter. It asks for the kind of terminal instead. Since our CPU architecture is SPARC64, OpenBSD assumes we're using a Sun Terminal. Well, I don't, so I choose _Xterm_.
Of course we need a hostname for the new system. Since it's Puffy (the OpenBSD mascot) on SPARC here, I settled on _spaffy_. 😉
Choosing the root password (PNG)
Next is network configuration. DHCP is fine for this test machine. Then the root password is being set.
Of course I want to access the box over SSH later, so that I don't need the serial connection anymore and can put the machine in a different room. Compared to many x86 servers it's not as loud as those, but still quite a bit louder than you would want a machine sitting directly next to you to be. Allowing root over SSH is _very_ bad practice, so I create a user next and disallow remote root logins.
Selecting the partitioning (PNG)
Then I choose my timezone. Next is deciding on the partitioning. There I noticed a difference compared to i386/amd64 installations. I have a habit of creating partition B first (to put the swap space on the beginning of the drive). When I tried to do this, the installer told me that this architecture didn't allow doing that. I assume that limitation is due to Sun's partitioning scheme _VTOC_ that is being used on the SPARC machines. So I created them in order instead.
What you can see on the screenshot is OpenBSD's default partitioning. It's more complex than many people may be used to, but for a good reason. Remember that you can mount filesystems with different options? That way you can e.g. have /tmp mounted _noexec_. OpenBSD makes good use of this, e.g. enabling or disabling W^X protection on a filesystem-wide base. This is not a production machine, though, and the drive is fairly small for today's needs. So in the end I went with a much simpler way of dividing the drive.
Selecting the distribution sets to install (PNG)
Finally I need to choose what to install. OpenBSD offers so-called "sets" for various parts of the full operating system. Since I'm only installing 6.0 as a starting point, I go with the minimum required options: The kernel (_bsd_) and the base system.
I have no use for the install (ramdisk) kernel (_bsd.rd_) or the SMP-enabled multi processor kernel (_bsd.mp_). Also I don't need the system compiler (_comp_), manpages (_man_) or small games (_game_). Of course I also don't need the X11-related sets either.
Then the installer goes off and prepares everything. When it has finished, the only thing that is left is rebooting the system (and removing the CD). Now we can also change the boot order in the ok prompt to set it to booting from disk only, speeding up the boot time very slightly:
ok> setenv boot-device disk
And that's it! Now I have an old but known good version of OpenBSD on my SunFire box.
Freshly installed OpenBSD 6.0 booted up (PNG)
Alright. What's next? Running a 3 years old version of OpenBSD is probably not that good an idea if newer versions are available for this architecture - and they are.
So the first thing to do is fetching the ramdisk kernel of version 6.1 and the signature for it. Then I check the integrity of the kernel with _signify(1)_. Everything is fine, so I go on and replace the standard kernel with the install kernel for the newer version. There's probably a better way to do this, but the SPARC bootcode seems to have "bsd" as the kernel file name hard-coded and I admittedly didn't dig very deep to figure out a different way of booting alternate kernels.
Getting 6.1 ramdisk kernel and verifying signature (PNG)
After restarting, the systems boots into the install kernel. This time I select upgrade instead of install, of course. The installer then checks the existing operating system (or at least the root partition).
I then select http for the location of the sets and point the installer to a mirror that still holds the old releases.
Installer started in upgrade mode (PNG)
Next is selecting the distribution sets to be installed. Again I choose only the bare minimum, since this upgrade is just an intermediary step to upgrading all the way to a current release.
In earlier versions of OpenBSD, _etc_ was a separate set. Since the files required to check newer releases are in /etc, I'd have chosen a different installation strategy if they were still available separately. However the etc set has been included in the big _base_ set for a while now.
After the sets have been downloaded and extracted the upgrade is mostly complete. The remaining things are done in the live system. So it's time to complete this step and reboot.
Configuration files get updated on first boot after the OS upgrade (PNG)
OpenBSD automatically updates various configuration files for the new release. If you pay attention, you'll see that there is one case where the changes could not be merged automatically. So I will need to see to that myself.
The system also looked to see if newer firmware was available. However this was not the case (which really is no wonder on this old machine).
Merging OpenSSH config and adding installurl (PNG)
After doing the manual merge of the OpenSSH configuration, it's time to do the final tasks to complete the upgrade. OpenBSD keeps a detailed upgrade guide for each version that lists the required manual steps. In fact you should read it _before_ doing the upgrade, since it can involve steps that need to be done prior to booting the install kernel and updating the base system! I skipped them, because they didn't apply in my case - e.g. I hadn't installed the manpages anyway.
I chose to only set the installurl since that one is really convenient. Actually I should remove some obsolete files from the filesystem, too. But I decided to leave this for later as there is another method to do so.
Getting the system updated to 6.2 means repeating what I did for the 6.1 update: Get the ramdisk kernel for the new release as well as the signature and verify it. Once that's done, another reboot is in order.
Downloading and preparing OpenBSD 6.2 install kernel (PNG)
One thing that's different is that the installer now defaults to fetching from the web and not from CD. And thanks to setting the installurl before I rebooted, it also knows the default mirror to get the sets from. Which makes the process of upgrading even more straight-forward and convenient.
OpenBSD 6.2 installer: Now knows the URL to fetch from (PNG)
Finishing the upgrade after the actual unpacking of the new files takes a bit longer for this version. After making all known device nodes, the installer re-links the kernel! This is due to a new feature called _KARL_ (Kernel Address Randomized Link). The idea here is that the objects that make up the kernel are linked in random order for each reboot, essentially creating a new and unique kernel every time. This makes it much harder or even impossible to use parts of the kernel otherwise known to be in certain memory regions for sophisticated attacks.
OpenBSD 6.2 introduced Kernel re-linking ("KARL") (PNG)
Oh, and did you notice that the _bsd.mp_ set is gone? This machine only has a single-core CPU and therefore the SMP kernel doesn't make much sense. The installer detected the CPU and did not offer to install the SMP kernel (even though it of course is still available for machines with multiple cores).
As always, the system needs to rebooted after the upgrade is complete. Just a moment later I'm greeted by my new OpenBSD 6.2! Again I'm skipping the manual steps to be taken afterwards.
Preparing and doing the upgrade for 6.3 is just like you've seen twice now, so I'm not going to repeat it. There's one new feature in the installer that could be mentioned, though: After the upgrade is complete, the reboot option is now the default thing that the installer offers instead of just dropping you to a shell. This means you can save another 6 keystrokes when updating! Yay! 😉
OpenBSD 6.3 install kernel: Rebooting after completion is now the default choice (PNG)
The upgrade to 6.4 is simply more of the same. Of course I did that step, but I'm cutting it out here. 6.5 is the most recent release as I'm writing this (though 6.6 is already around the corner). This means I'm going to do one more upgrade, following the process that we know pretty well by now: Get and verify bsd.rd, boot it and select "Upgrade".
Choosing all the sets except for X11-related ones for 6.5 (PNG)
This time I decide to install all the sets except for anything X11-related. The SunFire v100 is a server-class machine which does not even have a graphics card! For that reason there's no VGA port to connect a monitor to, either. And while X11 could still be of some use, it's simply not required at all.
Upgrade to OpenBSD 6.5 complete (PNG)
Again the upgrade process takes a bit longer, but that's only thanks to the additional sets (as well as the base distribution getting a little bigger and bigger with each release). After just a little while everything is done and there's one more reboot to make.
OpenBSD 6.5 booted up and ready (PNG)
All done! I now have a fine OpenBSD 6.5 system up and running on my old SPARC64 box. And even better: Everything has been cryptographically verified to be the data that I want and no bad person has tempered with it. Sure, the system has not been cleaned up, yet - and it's just 6.5-RELEASE with no errata fixes applied. Still I'd say: We're off to a good start! Aren't we?
In the next post I intend to explore the system a little and find out where there are differences from a common amd64 installation of OpenBSD.
Running OpenBSD on SPARC64 (HTTPd, packages, patching, X11, ...)