# Plan 9 on Raspberry Pi This is a series of loosely edited notes I made for myself while figuring out how to get Plan 9 running on my Raspberry Pi 3B+. I don't have any experience with any other computers. I started with Richard Miller's port of Plan 9, which was very easy to get running but I ran into some difficulties viewing some sites in Abaco and wanted to try 9front to compare. I was unable to get wifi working on 9front (there is no driver) so gave up and returned to Plan 9. # SD image It's possible to create an image using an existing Plan 9 set up but I don't know how to do that. Instead, I used a pre-made image. Download the zipped image from here: => https://9p.io/wiki/plan9/download/ ## macOS Extract the image. ``` gunzip <...pi3.img> ``` Check which disk is your SD card - e.g. /dev/disk4. Make sure you get the right one! ``` diskutil list ``` Repartition the disk and copy the image across. ``` sudo diskutil partitionDisk /dev/diskN 1 MBR "Free Space" "%noformat%" 100% diskutil unmountDisk /dev/diskN sudo dd bs=1m if=9pi.img of=/dev/rdiskN; sync ``` You can press ctrl-T to see progress. When it's done, you can eject the disk. ``` sudo diskutil eject /dev/rdiskN ``` ## Linux Should be the same? ## Windows Not sure - please let me know if you can complete this section. Put the SD card in your Pi and power it on! # Initial boot You should see some start up text on the screen, then Plan 9's windowing system 'rio' will start. If it doesn't start, you may notice that the start up text includes a prompt about whether to boot from tcp or local. Hit Enter to boot from local. You may then see a prompt asking for the user. Enter 'glenda'. If you are still at a prompt after this, you can enter 'rio' to start it manually. ## Issues If the Pi keeps restarting or is stuck on a rainbow square, then it's probably underpowered. I'm using a 5V 2.4A supply for this. ## Rio introduction You will see some windows on the screen, including two with some helpful text. If you've never used Plan 9 before, read through these text so you know a little about interacting with rio and editing files in acme. Create a new window with a terminal prompt by right clicking, releasing on new and then clicking and dragging out the window size with the right mouse button. New windows created this way start with a terminal prompt. ## Creating a new user You are currently signed in as the user glenda, which I believe is an admin user. You can create a new user named and give them system and admin access by entering the following into the terminal prompt: ``` con -l /srv/fscons unname uname sys + uname adm + ``` The first command is connecting you to the file system (called fossil) server. The rest are commands for the file server server. You can quit by typing Control-\ and then q. ## Edit cmdline.txt At the prompt, enter: ``` c: ls /n/c ``` This is mounting the boot part of the Pi image at /n/c then listing its contents. Edit the contents of cmdline.txt ``` acme /n/c/cmdline.txt ``` In acme, change the contents of the file to read: ``` readparts=1 nobootprompt=local user= nvram=#s/sdM0/nvram ether1=type=4330 ``` Everything needs to be on a single line. You can middle click on Put to save the changes and then Exit to return to the terminal prompt. These changes will enable wifi and cause the system to automatically sign in as the new user. I'm not sure what readparts and nvram do exactly... you can look at cmdline-wifi.txt or some of the other files in /n/c to see where I found these. If you are using a wired connection, you can try adding ipconfig= on the end to automatically configure IP via DHCP upon boot. ## Shutting down/restarting ``` fshalt ``` This stops the fileserver. You can then cut the power and reboot. Normally you can restart by entering: ``` fshalt -r ``` but for some reason this does not pick up the changes to cmdline.txt. You should always shut down the file server before powering off or restarting. # Starting up again rio won't start automatically the first time. I think this is because the user is not fully set up yet. Enter rio at the terminal prompt. You'll see a grey screen this time, with no windows. From now on, I'm not going to clarify when to open a window to run something in a terminal - I'll just show the commands. ## Run new user script and restart ``` /sys/lib/newuser fshalt -r ``` This time rio should automatically start. ## Connect to wifi ``` bind -a '#l1' /net aux/wpa -2p -s /net/ether1 ip/ipconfig ether /net/ether1 ``` If you're using wired internet with DHCP, then you shouldn't need to do anything. ## Start DNS resolver and connection service ``` ndb/dns -r ndb/cs ``` ## Start web file system ``` touch /usr//lib/webcookies webfs ``` ## Start a browser ``` abaco ``` # Set correct date/time I'm not sure how to set the system clock manually. You can set the timezone and then synchronise the time with an internet server. First, see what timezones exist and note the name of the one you want to use. ``` lc /adm/timezone ``` Then copy that file to /adm/timezone/local ``` cp /adm/timezone/Australia_Victoria /adm/timezone/local ``` This might need a restart to take effect. To sync with a time server (you'll have to find one you want to use): ``` aux/timesync -n au.pool.ntp.org ``` # To do How to set up wifi, sync time on boot. How to set up email