I've decided to go completely rogue.

I'm running OpenBSD 5.7 on a normal, amd64 laptop, but I've done a couple things out of the ordinary:

I'm going to explain the first, using RunIt instead of the normal init system. It's important to note that RunIt can be run either as an entire init system, or only as a service supervisor on top of the standard init system. While the second option seems to be considered better in almost every circumstance, I've decided to completely remove the original init binary from my system and go with RunIt all the way.

Why? Because I'm going completely rogue. Remember?

A Little About RunIt

My introduction to RunIt was using Dragora Linux. I was trying to find a Linux-based alternative to Gentoo that still didn't have systemd. I was first impressed with RunIt's speed--much faster than OpenRC or systemd. It's more similar to OpenRC, although without a few of the niceties and without explicitly parallel boot. But given how fast it is, even on my much older hardware, I don't see the benefit of parallel boot with it.

RunIt is mostly a service supervisor--much like OpenRC--but it also includes a replacement for the init process. I assume this is so that it can also be a total init system without any external dependencies at all. While I do not think there are any existing distros or OSes that use RunIt in this manner (I could easily be mistaken, it is hard to tell), it is as much a supported option as using it on top of the systems vanilla init system.

As with all init replacement systems I know of (systemd exlcluded--depending on if you consider it a replacement for sysvinit or now the default), RunIt also works on BSD systems. So let's see how it works.

It Just Works.

As a pleasant surprise, following the instructions on the RunIt site works fairly well, even though the OpenBSD instructions are for 2.9 and we are now up to 5.7. And yes, there are instructions specifically for OpenBSD, as well as a set of default scripts included with RunIt for OpenBSD. I decided to start with OpenBSD before I knew either of these things, and so that certainly was a bit good luck.

I did discover a few inconsistencies with my experience and the instructions, and so I will recount how I did it here. This is basically the same as the RunIt site's instructions, but with a couple minor tweaks.

Given that I'm working outside the ports and pkg system, almost everything is done manually. I don't even have X11 running (and I'm not really sure if I want to do it through portage or xenocara yet, but that's a different story). I did have to install wget, although I uninstalled it afterwards since ultimately I want it to be done through portage.

Actually Installing RunIt on OpenBSD

Before anything else, I have to warn you that this kind of thing will almost certainly end in disaster. There is a very good chance that you will not be able to boot your machine after attempting this. You've been warned!

First, create the unpacking and installation directories, then download and unpack the sources.

# mkdir /package
# chmod 1755 /package
# cd /tmp
# wget http://smarden.org/runit/runit-2.1.2.tar.gz
# gunzip runit-2.1.2.tar.gz
# cd /package
# tar -xvf /tmp/runit-2.1.2.tar.gz

I will admit, I missed GNU tar's ability to guess compression formats and untar/decompress in one command.
RunIt very conveniently (for our purposes) makes almost no assumptions at all about its environment, and so must be compiled from scratch. If you're onboard with replacing your init system by hand and replacing pkg and ports with portage, this should be easy for you to stomach.

# cd /package/admin/runit-2.1.2
# package/install

You can also try `package/install-man`, but since I'm mostly interested in the less innovative side of RunIt, I haven't bothered with the man pages yet. I probably will have to do this eventually!

While this has 'installed' RunIt, it hasn't actually installed it as our init system. It's only compiled the binaries and put them in places we can find them. So let's start actually replacing init.

We start by setting up the init scripts that RunIt will use.

# mkdir /etc/runit
# cp -p /package/admin/runit/etc/openbsd/[123] /etc/runit/

Next, we must install the runit binaries so the system can find them

# install -m0500 /package/admin/runit/command/runit* /sbin/

The last thing to do before wiping out the old init system is to make sure we will get a tty to use when we start up using runit.

Since I'm following the RunIt site's instructions, now i have to use tty 5. I would much rather be dropped to a tty automatically at the end of init, but I'm not entirely sure how to accomplish this yet. One downside of going rogue is that it's rare for anything to work perfectly.

# mkdir -p /etc/sv/getty-5
# cp /package/admin/runit/etc/openbsd/getty-ttyC4/run /etc/sv/getty-5
# cp /package/admin/runit/etc/openbsd/getty-ttyC4/finish /etc/sv/getty-5
# mkdir /service
# ln -s /etc/sv/getty-5 /service/

Now we pull the old switcheroo on the init binary! The moment that at least I have been waiting for with bated breath!

# cp /sbin/init /sbin/init.bsd
# install /sbin/runit-init /sbin/init

Now, reboot into your bastard OpenBSD system.

# reboot

When you get the message that RunIt has entered stage 2, hit Control+Alt+F5, and you will be in a normal tty. If you didn't get a tty, or RunIt had a blowout, then I have no idea what went wrong. The best I can suggest is to log in from a live environment and put /sbin/init.bsd back as /sbin/init, and hope for the best.

So now I have an OpenBSD machine that boots using RunIt. I don't really know what I expected--the machine does boot a little faster--but otherwise it's still pretty normal.

Well, we'll see how well things go when I install Portage on it :)