Plan 9, attempt 2. This time I’m running Plan 9 4th edition on my Raspberry Pi 3B using Richard Miller’s RPi port. This is what Devine Lu Linvega and Steve Lord did. Why plain 4th edition and not 9front? I’ve tried 9front before. Steve Lord summed up my feelings well:

While [Richard Miller] saw 9Front as a fork, I’d consider significant novel innovation versus a filling the base userland with cruft as a key distinction between fork and distribution.

What’s so special about Richard Miller’s port? Quoting Richard himself in Steve Lord’s blog post:

For the Raspberry Pi port I added one architecture-dependent directory to the kernel source, but the portable parts of the kernel, and everything outside the kernel, is absolutely untouched 4th Edition Bell Labs code.

Awesome. Let’s see what this thing can do.

My Goal

I want to learn and build things.

What can I learn from this operating system, and what can I build with the ideas that this operating system presents?

– Drew DeVault 3

First Impressions

I have tried 9front before, but this is my first impression of this distribution of Plan 9. I am very pleasantly surprised. It boots in under a second, and at boot there is a tutorial of rio and acme open and ready to try. This helps a lot. Just like vimtutor did for vim, these tutorials helped me learn and practice the basics. rio is not as weird and annoying as I thought before, and I could get used to it.

One annoyance is that it seems like there are some things that require the keyboard (like scrolling) and some things that require the mouse (e.g. switching windows). I would rather not move my hand back and forth so much. Maybe there are more efficient ways to do this that I haven’t learned, or maybe it’s just not that big a deal.

Overall, this distribution feels fresh and clean compared to 9front. There’s no doom port or game console emulators that barely work or obnoxious De Raadt quotes. I can install my own userspace programs, and if this kernel from 2002 works with only a port to the hardware platform I’m using, that’s fine with me.

First task: editing these notes

This was very hard, and I thought at multiple points that I would never get it to work, but here I am, editing my notes!

There are two ways I could have gotten my notes on a Plan 9 system. First, I could expose a 9P filesystem from another system and mount them on Plan 9. Also, I keep my notes in Nextcloud. The main interface to Nextcloud is Webdav (I think even the desktop clients use Webdav). I wasn’t sure how difficult it would be to get Web and Webdav working, but I knew that one of the best things about Plan 9 was 9P, so I wanted to try that first.

But before I could get started with either of those options, I needed network connectivity. My Raspberry Pi 3B has Ethernet and Wifi, but unfortunately I didn’t have access to Ethernet at the time, so I had to try Wifi. I knew that Richard Miller’s Plan 9 image had support for the Pi’s Wifi, but I was pretty sure that the last official version of Plan 9 didn’t have much if any Wifi support. This is where I ran into one of the biggest problems with Plan 9: the included documentation is great, but outside of that there if very little support available. Since Wifi wasn’t part of the official version and isn’t documented in man pages in the operating system, it was very difficult to find out how to turn it on.

In the end, I found help on the Plan 9 mailing list. Richard Miller has posted how to set up Wifi with his image a couple times there when people have asked 4. I’m not sure if these instructions are written down anywhere else. I don’t know how anyone got it working before those people asked. Maybe reading the source code helps. In any case, I found the mailing list to be extremely valuable because it is one of the only places where information about Plan 9 is documented.

Just getting the Wifi working taught me a lot about Plan 9. There are a lot of things I want to follow up on and learn more about. For example, step 1 was binding an Ethernet device to /net/ether1. I don’t know exactly how this works, but I know that section 3 of the manual is entirely kernel devices that you can access via bind(1).

Next, I wanted to expose a 9P filesystem from one of my Linux computers. The 9fs manual on Plan 9 mentions the u9fs program that does this, but I couldn’t find a copy of the source code except on my Plan 9 system, and it seems like a really old program that might not even work anymore. I couldn’t find a program for exposing a 9P filesystem in plan9port; I only see programs for mounting filesystems there. Disappointed, I turned to plan B, accessing my Nextcloud server directly via Webdav.

Right away, I found that someone already wrote a program that mounts Webdav as a filesystem on Plan 9. Perfect. According to the mailing list, it can be found at /n/sources/contrib/steve/wdfs.tbz 5. This was a foreign language to me, but I eventually found the code at http://9p.io/sources/contrib/steve/wdfs.tbz. I couldn’t figure out how to get this on my Plan 9 system though! The 9p.io website mentions that you can get access to the source code by typing 9fs sources at a terminal on Play 9, but that points to an old bell-labs.com domain that no longer exists:

term% 9fs sources
srv: dial tcp!sources.cs.bell-labs.com!9fs: cs: temporary problem: dns: dns failure

You can point 9fs to other domains, but I couldn’t find a way to point it to a 9p.io host that serves 9P. I found a 9front host that serves 9front source code, but the mentioned contrib directory wasn’t there. In the end, I used hget and manually typed in the URL of the tarball to download it via the Web. This is not very Plan 9-like, but it’s the only thing I have found that works so far. This tarball contained the source code with no README, but it did have a mkfile. Building failed when a dependency wasn’t found. I found it in the same contrib/steve directory. Compiling the dependency and wdfs worked perfectly. It was one of the easiest things I had done so far, which was encouraging!

At this point I tried navigating to my Nextcloud server in Plan 9’s web browser. It failed to load with this TLS-related error:

webfs: tlsClient: fd out of range or not open
next https://nextcloud.neolog.xyz/ (but for error)

I tried upgrading the root CA list from curl.haxx.net just in case the included list was too old (they’re from 2015). This didn’t fix it. I didn’t see any mention of this problem on the mailing list or anywhere on the Web, so I gave up and returned to trying to expose 9P from a Linux system that already has my notes synced. I will try this again later. My next tool will be reading the source code to find out the reason for the error.

I searched on the Web for any way of serving a 9P filesystem from Unix. This was surprisingly difficult, because the search results are dominated with news and people asking for help using 9P to communicate with Linux VMs either via qemu or Microsoft WSL2. While Linux implements 9P for this purpose, it seems to only have support for mounting 9P filesystems. I didn’t find any built-in userspace program that would expose the filesystem on a TCP port. Eventually I found an obscure Go library that implements 9P 6. It includes a program for serving the filesystem over the network. This little program is amazing, and it worked! On my Plan 9 system, I did 9fs 192.168.0.13 /n/Notes and got connected and writing immediately!

Screenshot of Plan 9

Plan 9’s impact on me (so far)

I have been working on this for almost a week’s worth of weekday evenings. Using Plan 9 has been very challenging, but I have loved every minute of it. First, rio, the window system. I was surprised that I actually enjoy using rio. I expected to be annoyed by not being able to snap windows to a grid. At first it seemed like going back to Windows 95, but without any minimize or maximize buttons. Forget about tiling, I was struggling just to get a window to fill the screen without manually clicking on each edge of the window and dragging to the size I wanted! However, after using it for a while I learned and adapted to it, and now I find it clean and even fun. It has a few tricks up its sleeve that I didn’t expect.

I expected that using a operating system that was abandoned sometime around 2002 would be discouraging. Here is a promising operating system with so many good ideas, but it was never finished and it could never do anything useful today. This proved to be not true. I’m using Plan 9 4th edition with a few patches to get it working on my hardware, and it’s great! It’s refreshing, and I could do real work with it. I just have a lot to learn.

I was surprised by how little documentation there is about Plan 9 outside of the system itself. It’s a reletively famous operating system. There’s a Wikipedia page for it, and I’ve known about it for almost as long as I’ve known about Unix. But nobody seems to be writing about Plan 9 except for “my first impressions” kind of articles. Counterintuitively, this leaves me feeling intrigued and even more interested to keep learning about it.

I think there are two reasons for this. First, it makes me feel the way I did when I first started using Linux. I was so excited to explore a new world and see what the technology could do. Now, I’ve been using Linux for over 10 years. That feeling has worn off. To me, Linux is a powerful tool that still excites me, but I know it quite well. I find myself hungry to explore a new world again, and Plan 9 satisfies that desire. Second, It’s exciting that Plan 9 is so good even though it has been mostly untouched for almost 20 years. It is unfinished, but I can build on the scaffolding. Anything I build will likely only be for myself, and I probably won’t have much help. I love building things, and it is extremely rewarding to get something working with almost no help from anyone else. If I don’t pay attention to Linux for a while, all kinds of new features and new programs will be added, too many for me to ever use or understand. In Plan 9, nothing will happen except what I do myself (and a handful of other enthusiasts who are also building for themselves).