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…

I downloaded the amd64 torrent from the ISO section…

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…

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.


Let’s try again.

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

sudo apt install qemu qemu-utils qemu-system
qemu-img create -f qcow2 9front.qcow2.img 30G
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 \
-device scsi-cd,drive=vd1,bootindex=0

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.


Tried it again. I don’t know how to scroll up and down in the terminal. I just use random clicks on the scrollbar. After a while I discovered that the terminal window doesn’t scroll (or stopped scrolling?) as I type at the bottom. I tried to find the file where I get to change the initial screen resolution but failed. I was able to maximize the Qemu window regardless but was unable to undo this. Gnome tells me something about “wants to something-something shortcuts” but apparently it doesn’t matter what I answer. I don’t quite understand how the mouse inside and the mouse outside the Qemu window works. Something about Ctrl-Alt-G changes this. When I closed the terminal, I did not know how to open a new one. As I can’t undo the maximizing of the Qemu window, I managed to have Gnome show me all the windows and there I just killed the Qemu window. I think I learned absolutely nothing about 9front today.

– Alex Schroeder 2020-08-09 18:26 UTC

Today, I tried again. I tried to say 1920x1080x32 but it was too big and the bottom was off screen. I used an external mouse where the middle mouse button is a scroll wheel. That was awkward, but at least I could now use the right mouse button to call up a menu with which to start new shell windows and to resize them. I still don’t know where I could increase the font size. There is a font setting in the rc file but I don’t know how to pick a font size. I was able to read some man pages but I didn’t understand what they were trying to tell me (init, boot). I tried to edit a file using sam, thinking that maybe with a bit of ed and vi experience I might be able to insert some text and write it to disk, but somehow that also didn’t work. Half knowledge is not going to cut it, I fear.

– Alex Schroeder 2020-08-10 09:27 UTC

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 - 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:

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.

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.

– Alex Schroeder 2020-08-10 22:00 UTC

Today I noticed that the file /cfg/plan9.ini exists. I fired up acme and edited it. It took me a while to realize that I needed to double-click on “Putall” and middle-click to execute it in order to save the file. When I figured it out, I noticed that I didn’t have the permissions to overwrite that file. At least I managed to quit the editor. I was fascinated by the idea of putting the commands into a buffer and have them be executable. It reminded me of Jef Raskin’s book, The Humane Interface. Coming from Emacs, I guess it’s not so bad as long as you know there are only a dozen commands or so that you really need. Whether that’s true, I don’t know.

– Alex 2020-08-11 17:50 UTC

Today I discovered that the Plan 9 ISO image I downloaded isn’t actually what you would use. It’s the image of the CDROM that you use to install Plan 9. That’s why the plan9.ini is read-only and why 9fs 9fat fails. My problem was that I had started reading section “4.3 - Performaning a simple install” and stopped once I got something that looked like a working system. I had not run the actual installer (“inst/start”).

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”.


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. 😄

– Alex 2020-08-12 07:57 UTC

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


– Alex 2020-08-12 11:21 UTC

On IRC, moody said, “I see the issue you ran in to. When you escaped to the shell during the boot process you were in the paqfs. It’s like the Linux initrd. My guess is that your USB controller isn’t supported. I am happy you got it working with Qemu.” 🙂

– Alex 2020-08-24 17:11 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Just say HELLO