mblognl

About Me | Blog | Books | RSS

Exploring 9front and Plan 9

Checking out 9front/Plan 9 and some cool Thinkpad hardware.

Why 9front?

thistimedefinitely.front.png

Over the holiday period I took the steps towards fully exploring the 9front/Plan 9 ecosystem. It has turned up on the radar for some time now, however if my memory treats me correctly, the first exposure I was overwhelmed. Recently I discovered adventuresin9 YouTube channel randomly which sprouted the interest again. After trying out 9front on VM via Proxmox I decided that I needed to experience it on bare metal.

This led to a couple of quests with older laptops to bring them back to life in order to get them running this lesser known OS.

There was something about the stark, minimalist approach, the art on the cover of the purchased manual, and the general demeanour of the contributors that hooked me. It's hard to explain but I liken it to finding a band you'd never heard of from a past era and then finding out they have a sprawling back catalogue to digest.

Also, with my interest in the C language, finding out that 9front has it's own dialect and that the whole OS is written in less than 6000 lines I felt this may be a place to learn about operating system architecture and kernels etc This space will evolve as I experiment, explore, and expand my knowledge.

What have I done so far?

Here is a list of the hardware I've managed to get 9front to run on:

Thinkpad T420:

thinkpad.jpg

I found one of these laptops on Facebook marketplace for £10 including the power adaptor. Initial thoughts was that the hardware was in pretty good condition given the age. However the laptop did not boot. I would get the initial green power led but then nothing. After searching online and diving into a variety of vintage posts I came to the conclusion that the system board must be kaput.

Luckily replacement parts for this model is still readily available on eBay etc. so I ordered a new motherboard from Latvia. This took a couple of weeks to arrive and once received I was eager to give it a crack

I have experience in fixing 'things' but this was my first laptop motherboard replacement. Once observation that really sticks out is the ease of replacing components in these devices. In more recent laptops I've opened up they seem difficult to get to the 'guts'. The whole replacement took about an hour from scratch and I only had 2 leftover screws!

The laptop understandably was missing a sdd so I added my own Kingston 120gb. There was an extra 4gb RAM in the 2nd port which gives the laptop 8gb in total.

The install is covered below and mostly I followed 9lab Thinkpad T420 guide this helped with the wifi firmware and getting the initial boot working. Key benefit was getting the firmware:

% ramfs ; cd /tmp
% hget -o iwn-firmware-5.11p1.tgz \
  http://firmware.openbsd.org/firmware/6.9/iwn-firmware-5.11p1.tgz
% tar xzf iwn-firmware-5.11p1.tgz
% cp firmware/iwn-6005 /lib/firmware

Once booted and I followed the install guide, running inst/start and following the prompts, it was pretty straightforward. I didn't sway from the defaults for this laptop, using the default fs and partition suggestions.

Raspberry Pi 3b

I installed 9front on a Raspberry Pi 3b which is running 9front successfully. There was a couple of guides that helped along the way:

Next Steps

Connect to wifi

bind -a '#l1' /net
aux/wpa -s <SSID> -p /net/ether1
# Enter password when prompted...
ip/ipconfig

To test connectivity you can try: ip/ping 8.8.8.8 for example and you should get a positive response.

I then moved to something more reliable that I got from the 9lab guide above. The script runs on boot and you can choose to fix to an SSID or skip to desktop.

Note: If you get the password incorrect you're going to see a DHCP error. So far my only way to reset this is to fshalt -r reboot the system and try again, this is super annoying when you have a dodgy key char in the password. 🫠

Man Pages

man.9front.org

This is the way to read about built in functions, commands and applications. I use lookman a lot to find words in man pages and then load the page by man <subject> for example:

man wpa

returns:

WPA(8)                                                     WPA(8)

NAME
     wpa - Wi-Fi Protected Access setup

SYNOPSIS
     aux/wpa [ -dp12 ] [ -s essid ] dev

DESCRIPTION
     Wpa handles the authentication and key exchange with WPA
     protected wireless networks.

     The dev parameter specifies the network interface that needs
     to be setup with WPA.  The essid can be set with the -s
     option. Otherwise, the previously configured essid on the
     interface will be used.  The -p option will prompt and
     install the preshared key or pap/chap credentials into fac-
     totum, otherwise the key has to be already present in facto-
     tum or an interactive key prompter like auth/fgui (see
     factotum(4)) needs to provide it.

     The authentication protocol is initiated by the wireless
     access point so wpa will background itself after the
     keyprompt and establish the encryption automatically as
     needed.  The optional -1 or -2 arguments can be used to
     select between WPA1/TKIP (default) or WPA2/CCMP encryption
     with WPA PSK.

     The -d option enables debugging and causes wpa to stay in
     foreground writing protocol messages to standard error.

EXAMPLES
     Setup wireless encryption:
     % bind -a '#l1' /net
     % aux/wpa -s 9HAL -p /net/ether1
     !Adding key: proto=wpapsk essid=9HAL
     password: *****
     !
     % ip/ipconfig ether /net/ether1

SOURCE
     /sys/src/cmd/aux/wpa.c

SEE ALSO
     factotum(4), ipconfig(8)

HISTORY
     Wpa first appeared in 9front (March, 2013).

As you can see, the man pages are well structured and thorough.

USB Storage

The USB storage mounts on /shr/<device-name> and I moved the files straight from there. I think there may be mount option just like Linux/Unix but I've not worked that out but there is a man mapge.

Uxn

I wanted to explore that ecosystem from within 9front. If you've not come across Uxn/HundredRabbits please check them out.

Web Browsing

I have installed Netsurf (the alternative browser) and there is also Mothra which is really cool. Both provide very minimal web experiences, with Mothra not supporting any JS or 'modern' browsing experiences. To be fair, most of my browsing is reading code or docs/blogs which render fine. I even checked out this blog which translates really well.

Future

Useful Resources

Created by Emacs 30.1 (Org mode 9.7.11)