GOPHERSPACE.DE - P H O X Y
gophering on alexkarle.com
Plan 9 Journal
==============
date: 2022-04-18
tags: plan9

My journey in installing and using the 9front fork of plan9 on
bare metal hardware (an old Thinkpad X220). Mostly just musings
and intermittent problem solving. Mildly interesting at best.

[Thu Mar 24 02:54:53 EDT 2022]

This is my third time booting this system. Still can't get
wifi to work. There's a message at boot about missing firmware.
Something like /lib/firmware/iwn-6005 maybe? Need to check to
see if theres proprietary blobs I'm missing...

Writing in acme(1) of course. It's maybe the most familiar
interface to the system (from my time poking around plan9port).

Goals for tonight:

- read intro(1) and linked pages

My date is wrong by 4hr exactly. Wonder if there's an ntp equivalent?
It's showing the UTC time as EDT, but when I run `date -u` it's got
the wrong GMT... hm. Probably should set my timezone to UTC and see
if that helps on reboot?

...

Found $home/lib/profile. Realized $path doesn't exist. Just a series
of bind mounts into /bin . Why not? One mechanism that works. Let the
kernel search the union directory...

...

Figured out my wireless issues -- I was right! I need firmware. Found
the relevant portion in plan9.ini(8):

          iwl     Intel Wireless WiFi Link mini PCI-Express adapters
                  require firmware from
                  http://firmware.openbsd.org/firmware/*/iwn-firmware*.tgz
                  to be present on attach in /lib/firmware or /boot.

Now just to figure out how to get the drivers on a thumbdrive... maybe
it'd be easier to reboot with ethernet plugged in first.


[Fri Mar 25 01:04:01 EDT 2022]

I booted tonight with ethernet connected. Time still wrong. But we
have webfs(4)!

Things automagically worked--I was able to use mothra(1) to connect
to 9front.org, so that felt great.

The next logical step seemed to be to leave the system using ssh(1).
First take failed. Maybe factotum(4) isn't running?

Looking for answers here:

https://pspodcasting.net/dan/blog/2019/plan9_desktop.html

Hm seems it should just work. Why do I get the following?

term% ssh @sdf.org
ssh: read1: eof


[Sat Mar 26 02:27:37 EDT 2022]

Another day another boot. I put /etc/firmware/iwn* from my OpenBSD
install on a USB and successfully got it to mount on 9front (not
hard--just plug and check /shr)... but even with the firmware in
/lib/firmware it didn't work! hmm maybe I'll copy to /boot too?

At least the desktop guide above taught me about /dev/kmesg! I
no longer have to remember what it said at boot time :)

[Mon Apr 11 03:35:57 EDT 2022]

Been a hot sec. Life got busy. Went on a company trip to Asheville,
NC and then a bachelor party in Vegas. Caught a stomach bug and
ended up spending most of the party in the hotel room. Still a story,
I guess. Just not the one I expected to be telling.

Anyways, I'm not quite sure where I left off. src/net.sh and src/res.sh
both worked so I was up, fullscreen, and on wifi in about 3 min.

Maybe I'll try to take a whack at ircrc(1) or email? Probably good to get
SSH up too...

end of night update: ircrc(1) worked great, no issues! ssh(1) still
not working. I checked the server logs and it said "unable to negotiate,
client offered: ssh-rsa", so I wonder if the client's cipher's are
too old? The 9front fqa says that it supports chacha20-poly1305, which
I think openssh should support on the server side... so why is the
handshake failing? unclear.

maybe I'll ask in #cat-v on IRC next time I boot :)

Some other things I tried:

1. Creating a SSH key (as documented in rsa(8)):

term% auth/rsagen -t 'service=ssh' >ssh.key
term% cat ssh.key >/mnt/factotum/ctl
term% ssh ajk@sdf.org
ssh: read1: eof

That should have added it to factotum(4) for retrieval. hm.. I mean
obviously the SSH server doesn't expect the key, but it shows that it's
not like ssh(1) is keeling over because of lack of key (I don't think.).

[Tue Apr 12 03:27:55 EDT 2022]

I did it! At long last, a working ssh(1).

I browsed the mailing list for a while and finally stumbled upon
this patch [1] that linked to the fact that in 2021-09 openssh
deprecated the ssh-rsa cipher (which from the sshd logs was what
I was offering...).

I'm not sure _why_ this patch didn't seem to make it into my install,
but sure enough I was able to do a system update and rebuild from
source and my new ssh(1) works out of the box! (I double checked and
the patch is indeed applied). So the fix was:

term% sysupdate
term% cd /
term% . /sys/lib/rootstub
term% cd /sys/src
term% mk install

As described in the fqa: http://fqa.9front.org/fqa5.html#5.1

[1]: https://inbox.vuxu.org/9front/CD1ED7F51E72A0050786E39FADF6EBFE@felloff.net/


[Thu Apr 14 02:46:06 EDT 2022]

Tonight's goal: move this blog to the interwebs. Up until now
it's lived on this thinkpad as /usr/glenda/notes.txt, but I
(1) want to back it up and (2) want to share it in case it
helps anyone else!

Now that I have ssh(1) working, and given that 9front recently
added git(1), it should be pretty trivial to publish to my
gopherhole, just add it to the repo and commit and push!

I had to first generate an ssh key as listed in rsa(8) and add
it to factotum(4) so that I could clone via ssh:

  % auth/rsagen -t 'service=ssh role=client' > ssh.key
  % cat ssh.key >/mnt/factotum/ctl
  % auth/rsa2ssh ssh.key  # copy to clipboard, add to authorized_keys
  
Then:

  % git/clone git@alexkarle.com:alexkarle.com akcom
  % cd akcom
  % mv /usr/glenda/notes.txt gopher/notes/all/plan9.txt
  % git/commit gopher/notes/all/plan9.txt
  
  % git/push

By the "weird dance" I mean:

  1. Type my commit message
  2. Type CTRL-D and newline
  3. Hit escape?

Whacky.

I couldn't get git/diff  to show the diff, so instead I checked
my diff with git/export HEAD, which worked great.

Oh and I put my git config in $home/lib/git/config (name/email).

The date is still 4hr off, so sourcehut rendered the commit as "3hr in
the future" :) whoops!

[Wed Apr 13 23:41:38 EDT 2022]

Time travel! Look at me! haha I figured out my 4hr issue.
Turns out my bios time was UTC but when I booted into 9front
it thought it was EDT (since that's my locale). Now
date -u and friends work as expected. I feel a bit silly
for not checking sooner.

Other known issues to sort out another night:

* I have to execute the following (src/res.sh) each boot
  to get the right screen resolution--add to startup script?
  or /cfg/plan9.ini?

    @{rfork n; aux/realemu; aux/vga -m vesa -l 1366x768x16}

* Battery doesn't show in stats(8) despite having apm0= and
  *acpi= in /cfg/plan9.ini

* Suspend on laptop lid close doesn't work (should it?)

* /lib/firmware isn't mounted at boot time -> no wifi drivers
  -> I have to run the following to join my network each time
  I boot (src/net.sh):

bind -a '#l1' /net
aux/wpa -p -2 -s  /net/ether1
ip/ipconfig ether /net/ether1

I think if I'm serious about making use of this system (beyond
the just poking around for fun / seeing how it feels), I'll need
to pour over the fqa in detail, read more man pages, and maybe
search around the community spaces. It's been a real fun "can you
boot it" challenge, and I've already been inspired by some of
the design philosophy, but I'm clearly very green at getting
anything working.


[Sat Apr 16 23:14:18 EDT 2022]

Another night, another challenge. Let's try to figure out how
to get my alexkarle.com site to build on 9front. This should
be interesting because we have:

1. A C markdown-like compiler (nihdoc) to port
2. A makefile to port

Hopefully it's a chance to learn both 6c(1) and mk(1)!

Let's start with hello world in plan9-C, as discussed in
"C Programming in Plan 9", from cat-v [1]

#include 
#include 

void
main()
{
print("hello, world\n");
exits("wat");
}

Compile and marvel at string exit messages:

term% 6c hello.c
term% 6l hello.6
term% 6.out
hello, world
term% echo $status
6.out 1480: wat

Aaaand at this point in the night I'm realizing that porting
anything substantial is gonna be a mess. So here's to just
writing plaintext for gopher and git/push-ing that into the
void! For now, at least.

[1]: http://doc.cat-v.org/plan_9/programming/c_programming_in_plan_9


[Mon Apr 18 22:57:23 EDT 2022]

Guess who's back, back again.

I wonder if there's a bit of inertia in plan9 just because I put
it on my laptop and need to go pull out a screwdriver to swap
back to OpenBSD. Definitely.

Don't get me wrong, I like acme(1). I like the feel of the system.
But... it ain't easy. And I can't do things I'm supposed to be
doing in the evenings (catching up on email, etc).

With that in mind... maybe I'll try to set up email tonight?

I think it's OK to put a hold on the akcom building. No need to
jump straight into C programming. Let's use the system more!

First stop, the fqa! At this point, it'd be wise to download
locally:

term% hget http://fqa.9front.org/dash1.survivalevasionandescape.pdf >fqa.pdf

Ahh free from the browser again :)

Yet again lost in the fqa and didn't make progress on my "goal".

TODO:

* Read mail(1)
* Set up an email account I don't have data I'm afraid to lose
* Read upasfs(4), reread fqa on mail

Learned today:

* The editor used by git(1) is hold(1) (5 lines of rc?!)
* hostowner is "root" for processes, not files


[Fri Dec 29 02:05:24 4ST 2023]

Years later, I'm back! I took out the old X220 to see if it
was still viable and rediscovered this install. Glad I didn't
wipe it.

First mystery on the docket was the battery. Since I'm not sure
how the battery holds up generally anymore, I definitely want
to monitor it. stats(8) wasn't showing it, but if I run acpi(8)
first:

% aux/acpi
% stats # in the same term

It works fine. I bet I need to run acpi on boot. Here comes a
reboot!

I realized that /cfg/plan9.ini may not be having any effect...
modifying /n/9fat/plan9.ini (per this [site]) using:

term% 9fs 9fat
term% ed /n/9fat/plan9.ini

[site]: https://pspodcasting.net/dan/blog/2019/plan9_desktop.html

...

no dice on *acpi=1, but at least I have a workaround
(running aux/acpi first); plus, editing the vgasize there
means I no longer need to run my res.sh script! So little
wins :)

[Mon Jan  1 17:16:07 EST 2024]

Edit on the latest *acpi= post.. it slowed the system to
a CRAWL. So removed that.

[Sat Jan  6 22:40:00 EST 2024]

Sitting by the fire on the eve of our first big winter storm
in the new house! Hoping to get snowed in :)

Just leant my dad my X13 which was running OpenBSD for him to
use as a linux box indefinitely, so this install is my primary
laptop for the foreseeable future (I have a linux desktop for
modern conveniences, so this is for funsies).

I got nihdoc(1) to build with pcc(1) last time, so I _should_
be close to a full alexkarle.com build. I need to brush up on
my rc(1) vs sh(1) to port some shell scripts. Who knew C was
more portable than sh(1)?

...

got distracted making a Glog script / plumbing the git shas.

[Sun Jan  7 14:32:29 EST 2024]

We got the snow after all :) been a cozy day by the fire. As
it gets dark / post shoveling is the perfect time to attempt
to publish this burrow.

I don't seem to see scp or rsync clones; I suppose the move would
just be to mount the remote server hosting my gopherhole and
go from there. Thinking maybe sshfs(4) will be simplest without
having to install 9p on the server.

...

turns out it was even simpler than sshfs(4) (which did work
for cp(1)); tar | ssh is a great trick!

tar cz `{ls | grep -v '.git'} |
  ssh ajk@akarle.com 'cd /var/gopher && tar xvzf -'


[Mon Jan 15 13:29:08 EST 2024]

A bit of a different experiment these past couple p9 sessions.
I've been using pta [1] for my plain text accounting for ~4mo
now (with a backfill of all of 2023). I obviously can't log
into my banks to get transaction history via mothra(1), but
I thought it'd still be fun to get a pta-like clone up and
running on Plan 9 to see how we're doing financially. Turns
out it's just a great excuse to learn some awk(1), since
porting perl seems to be doable but likely a pain.. I only use
a subset of the features anyways, so it's been a fun learning
experience!

[1]: https://mandoc.bsd.lv/pta