(λ (x) (create x) '(knowledge))

This Distro Is Not For You

Ignoring Stern Warnings, and Tinkering with Plan9 Anyways · January 15, 2021

We're ushering in the new year with an absolutely bizarre, but as far as I'm concerned wonderful Unix distro called Plan9! It's potentially something you've heard spoken of, and have probably been told that it is not something you want to partake in. And in all honesty, it's a far site from being usable in the modern world, at least for most people. But if you're curious about OS design, distributed systems, ANSI C, or just generally exploring unique complex software systems then Plan9 may be worth at very least a look. Besides, who actually reads warnings?

Now I would label myself a veteran Linux user, at this point it's been the only OS I've run with for well over a decade. I can't stand using anything else, and I'm entrenched enough in the desire to not use anything else to be a maintainer for a major distribution. So why am I even looking at something like Plan9? I'm happy in my little Linux world, and I'm really not leaving.

I think the official blame can be placed on my friend Eli, in a strange turn of events he sent me on a rabbit hole into the idyllic solarpunk life of 100 Rabbits. These guys (well guy and gal) are seriously cool. They live a subsistence liveaboard lifestyle on an 11ft schooner, which in and of itself is awesome, but even cooler is the fact that on said boat they write open source software and design video games and music (primarily with said open source tools!). Inside of this 100 rabbit strong rabbit hole is mention of many raspberry pi based tools one of which is a Plan9 based workstation named Usagi, which at the heart of things is meant to be a distraction free development system.

I for one was hooked, had to poke around and see exactly what that means, because I already feel like my Alpine systems running on cheap netbook (or lighter) hardware are pretty distraction free, what could be more distraction-less? Also, honestly the liveaboard development thing fascinates me enough to poke at all of this in and of itself; just for a taste.

The Install

Like most distros I spun up a little Qemu VM first. I used the helpful guides that 9front provides, and also went with their ISO since it appears to be the most well maintained. There's an active little community that hangs out in #cat-v on freenode which is devotedly helpful as well. With this mix of information the installation process was pretty easy. Boot the ISO and follow a little interactive installation program easy, and magically you get a little terminal instance! Pretty awesome stuff, but I quickly found out that that little terminal setup wouldn't allow for remote access. And while that would be fine for a VM, there's no world where I'll find myself hunched over in a little corner bound to a physical desktop system when I can remotely access something from a laptop!

I quickly started to dig out abandon hardware from past projects, piecemealing together spare ram and a hard drive into a little i3 NUC that used to be a promotional kiosk, and my deep dive into Plan9 truly began, in as similarly a simplistic manner as previously, though with a few caveats. I ended up spinning round in circles over an incorrect bootarg. Apparently Plan9 will spin and spin looking for a ps2 mouse if specified, and it defaults to that. However if you pass it any other option, such as usb which doesn't actually map to anything, then it'll boot right up. I had to ask some kind folks in #cat-v to get that tidbit of information.

Which actually highlights the only problem I've had with the system to this point. It's a learning curve, and documentation is a little bit sparse. There's nothing like the Arch Linux documentation, which will probably throw off a ton of people. But the system has man docs, and it has extremely legible c code, and the 9front folks have tried to provide some level of installation/configuration guides. But with something this niche you find wonderful little tidbits such as this guide to setup a standalone CPU/Auth/FS server. And in fact all of C04tl3's videos are replete with information about the Plan9 ecosystem.

I even found enough examples/info to compile vdir, a little visual directory utility, and customize rio a little bit. The best resources by far have been the system itself, but only time will really tell if I can make that carry over to learning a bit of ANSI C.


#!/bin/rc
window 0,0,175,200 stats -lcmew
window 0,210,300,400 vdir
window 0,410,300,550
  

Plan9 Customized!

Actually Rio (the Plan9 window manager) reminds me a lot of Mikrotik's Winbox tool, especially once you're using it remotely over Drawterm. I'm curious if they were inspired by that on some level, I've seen 9pfs ports pop open in their experimental software releases, so it makes you wonder..

The Linux Stuff

For any true Plan9 fans reading, I'm sorry this is the Linux part. I swear I'm absolutely enamored with Plan9 thus far, it's really cool, but if you page through the rest of the blog you'll quickly realize that I have a soft spot for Alpine Linux.

Anyways on that note, Alpine doesn't package Drawterm, and unfortunately I'm in no state currently to adopt that project. I'm just treading water maintaining my own packages right now. Thank god the source code is highly portable C and not something esoteric, with a little bit of Esper magic I was able to quickly "package" Drawterm.


{
   fetch={url="https://code.9front.org/hg/drawterm/archive/tip.tar.bz2",
		  git=false,
		  outf="drawterm.tar.bz2",
		  extract=true,
		  atype="bzip2"
   },
   builddir="/drawterm-*", --this compensates for the Mercurial hash changing
   depends={
	  alpine="make xorg-server-dev libxt-dev",
   },
   build={"CONF=unix make"},
   inst={{perms=755, {"drawterm"}, out="/usr/local/bin/"}}
}
  

This little Esper script gives me a quick portable way to compile drawterm on my Alpine systems, and it even runs on my Droid4! And really, this wasn't hard to figure out, I'm just shirking out of responsibility in the moment by using my own packaging.

What was harder to figure out, and involved entirely too much nmap scanning and old forum diving was figuring out how to port forward for the 9pfs auth protocol. I'm running my lab systems on an isolated LAN with a wireless bridge as the WAN, essentially double NAT, but it keeps everyone away from my toys. For me to be able to remotely drawterm into the system I ended up with the following NAT rules. Absolutely nothing earth shattering, but it seems to cover the auth protocols correctly and allows unfettered drawterm access. Everything is TLS encapsulated as well, assuming you're using the 9front Plan9 distro and their drawterm, and authentication happens against Factotum, so it's a nice secure keypair exchange like SSH.


chain=srcnat action=masquerade out-interface-list=WAN ipsec-policy=out,none
chain=dstnat action=dst-nat to-address=192.168.88.15 protocol=tcp in-interface=ether1 dst-port=564,567,17019,17020	
  

All of this work ends up with a little i3 NUC which I can remotely access whenever I need to and start fiddling around with acme. As you saw up above I have a little C work going, and pulled one of my own repos to try and muck around with some Fennel dev on Plan9! I however wasn't about to get Lua to compile yet, and I frankly suck at C. Intro to the C programming Language seems like a solid start, and Plan9 feels like the right system to learn and treat ANSI C as the power language it is.

Learn You Some ANSI C

So first impressions, Plan9 seems absolutely awesome if you actually want to learn something, which is the same thing that attracted me initially to Linux, and eventually to development and DevOps. Don't expect any hand holding, and it may very well not be for you, but if that doesn't scare you away give it a shot, you might be surprised!

Bio

(defparameter *Will_Sinatra* '((Age . 31) (Occupation . DevOps Engineer) (FOSS-Dev . true) (Locale . Maine) (Languages . ("Lisp" "Fennel" "Lua" "Go" "Nim")) (Certs . ("LFCS"))))

"Very little indeed is needed to live a happy life." - Aurelius