2020-08-07 Plan 9

There is quite some love for Plan 9 to find online. And I find it fascinating. My main problem is that I love Emacs and they make fun of Emacs. Instead, we get acme. In any case… I went to the 9front website…

9front

I downloaded the amd64 torrent from the ISO section…

ISO

I wrote the iso to my USB stick…

sudo dd bs=4M if=9front-7781.38dcaeaa222c.amd64.iso of=/dev/sdb conv=fdatasync

I rebooted my computer and hit the right key as it was booting so that I could choose to boot from the USB stick…

I saw lots of output about IRQ 11 issues and listings of my disk partitions…

I was asked for the bootargs…

Section 4.2.2.3 - Bootargs

Uh, what?

I escaped to a shell and looked at “/shr” but didn’t find my “9front.iso”. I did see the “/shr/usb” folder and all that, but all the folders were empty.

I looked around for a while, and then I rebooted into my regular system.

That was my Plan 9 adventure.

OK.

Let’s try again.

Make a new directory called 9front, and move the ISO you downloaded in there. We’ll use Qemu.

-net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user
-device virtio-scsi-pci,id=scsi
-drive if=none,id=vd0,file=9front.qcow2.img
-device scsi-hd,drive=vd0
-drive if=none,id=vd1,file=9front-7781.38dcaeaa222c.amd64.iso
-device scsi-cd,drive=vd1,bootindex=0

Section 3.3.1 - Qemu

And it boots! And I can keep hitting Return and the defaults all work. Yay!

Gotta work on that screen resolution, though. Or on the default font size. This stuff is tiny.

​#Plan 9

Later the same day, I tried resolutions like 1280x1024x32 and 1400x1050x32 and that worked. Still don’t know how to increase font size, though. I noticed an IRC client called ircrc and tried to run it. It said something about no IP number, which makes sense. There’s a section on adding networking to Qemu. I tried sections 3.3.1.4.1 - Linux VDE but that didn’t work. After installing vde2, there still isn’t a tunctl command. The vde_switch and slirpvde commands “worked” without it, but I don’t know how much that means. Replacing the -net user option with -net vde didn’t allow ircrc to work. there is no ping command to test basic networking. No progress was made.

Current startup script:

#!/bin/sh
cd ~/9front/
exec qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \
     -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \
     -device virtio-scsi-pci,id=scsi \
     -drive if=none,id=vd0,file=9front.qcow2.img \
     -device scsi-hd,drive=vd0 \
     -drive if=none,id=vd1,file=9front-7781.38dcaeaa222c.amd64.iso,format=raw \
     -device scsi-cd,drive=vd1,bootindex=0

Appending format=raw to the second -drive silenced a warning I kept getting.

@glenda pointed me at a blog post by Nicolas S. Montanaro.

@glenda

9front guide

It starts with instructions on how to build the amd64 kernel.

cd /
rc /sys/lib/rootstub
objtype=amd64 mk install
…
6c -FTVw auth.c
<eof> cannot open auth.6 - 'auth.6' no creates
…

Oh well.

It is only now that I understand what the “post-install” section was referring to when I was reading the Qemu section. Once you did the “real” installation from the CDROM ISO to the virtual disk partition, you change the Qemu startup so that it doesn’t use the CDROM ISO anymore:

exec qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \
     -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \
     -device virtio-scsi-pci,id=scsi \
     -drive if=none,id=vd0,file=9front.qcow2.img \
     -device scsi-hd,drive=vd0

And now “9fs 9fat” also works and I can edit /n/9fat/plan9.ini. I now use vgasize=1440x900x32. I changed the font in lib/profile to /lib/font/bit/terminus/unicode.18.font.

I’m starting to wonder how I’d best use Plan 9. Do I really want to run it from a USB stick? I guess I could… But perhaps it would be better to run it from Qemu for a few years. A maximized Qemu running on the second virtual desktop? I never use virtual desktops. I usually just use a small number of maximized windows: Emacs, Tilix, Firefox, and each of these comes with their own set of buffers, windows, panes, tabs, and whatever they are called. For that to work I need to figure out what my display resolution is, I think… I looked around, looked at the Qemu man page, discovered that -display sdl doesn’t work, discovered that -full-screen was unnecessary, all I needed was to use Ctrl+Alt+f to toggle full-screen. OK, and now my only problem is that 1440×900 is not quite my laptop’s display resolution, I need 1920x1080x32! Perhaps the problem I had previously (bottom off-screen) disappears when I go full-screen. So that’s what I did.

9fs 9fat
acme /n/9fat/plan9.ini

Change the resolution… use “Put” to save (doubleclick using the left mouse button, execute using the middle mouse button), then “Exit”.

reboot

Just checking…

And now in Gnome I open the terminal emulator, run 9front, which runs qemu, which opens a bug Plan 9 window, which I maximise using Ctrl-Alt-f and send to the next virtual desktop using Ctrl-Alt-Shift-Down. Now I can switch between Gnome and Plan 9 using Ctrol-Alt-Up/Down. 😄

Here’s a screenshot of Plan 9 with `mothra showing my website:

Screenshot

Additionally, by default the pi does not boot in something called "hdmi safe mode", which allows for maximum compatibility with hdmi output. This means that though the pi may be booting properly (as indicated by the green status led quickly blinking once the pi is first started and then turning off), the screen will not display any output. To fix this I needed to set a parameter called `hdmi_safe` in the `config.txt` file to `1`. That puts the pi into safe mode, which fixed the issue for me. – My First Look at Plan 9.

My First Look at Plan 9