alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

plan9-journey.txt (9317B) [raw]


      1 == Plan 9 Journal ==
      2 
      3 tags: plan9
      4 
      5 My journey in installing and using the 9front fork of plan9 on
      6 bare metal hardware (an old Thinkpad X220). Mostly just musings
      7 and intermittent problem solving. Mildly interesting at best.
      8 
      9 [Thu Mar 24 02:54:53 EDT 2022]
     10 
     11 This is my third time booting this system. Still can't get
     12 wifi to work. There's a message at boot about missing firmware.
     13 Something like /lib/firmware/iwn-6005 maybe? Need to check to
     14 see if theres proprietary blobs I'm missing...
     15 
     16 Writing in acme(1) of course. It's maybe the most familiar
     17 interface to the system (from my time poking around plan9port).
     18 
     19 Goals for tonight:
     20 
     21 - read intro(1) and linked pages
     22 
     23 My date is wrong by 4hr exactly. Wonder if there's an ntp equivalent?
     24 It's showing the UTC time as EDT, but when I run `date -u` it's got
     25 the wrong GMT... hm. Probably should set my timezone to UTC and see
     26 if that helps on reboot?
     27 
     28 ...
     29 
     30 Found $home/lib/profile. Realized $path doesn't exist. Just a series
     31 of bind mounts into /bin . Why not? One mechanism that works. Let the
     32 kernel search the union directory...
     33 
     34 ...
     35 
     36 Figured out my wireless issues -- I was right! I need firmware. Found
     37 the relevant portion in plan9.ini(8):
     38 
     39           iwl     Intel Wireless WiFi Link mini PCI-Express adapters
     40                   require firmware from
     41                   http://firmware.openbsd.org/firmware/*/iwn-firmware*.tgz
     42                   to be present on attach in /lib/firmware or /boot.
     43 
     44 Now just to figure out how to get the drivers on a thumbdrive... maybe
     45 it'd be easier to reboot with ethernet plugged in first.
     46 
     47 
     48 [Fri Mar 25 01:04:01 EDT 2022]
     49 
     50 I booted tonight with ethernet connected. Time still wrong. But we
     51 have webfs(4)!
     52 
     53 Things automagically worked--I was able to use mothra(1) to connect
     54 to 9front.org, so that felt great.
     55 
     56 The next logical step seemed to be to leave the system using ssh(1).
     57 First take failed. Maybe factotum(4) isn't running?
     58 
     59 Looking for answers here:
     60 
     61 	https://pspodcasting.net/dan/blog/2019/plan9_desktop.html
     62 
     63 Hm seems it should just work. Why do I get the following?
     64 
     65 	term% ssh <user>@sdf.org
     66 	ssh: read1: eof
     67 
     68 
     69 [Sat Mar 26 02:27:37 EDT 2022]
     70 
     71 Another day another boot. I put /etc/firmware/iwn* from my OpenBSD
     72 install on a USB and successfully got it to mount on 9front (not
     73 hard--just plug and check /shr)... but even with the firmware in
     74 /lib/firmware it didn't work! hmm maybe I'll copy to /boot too?
     75 
     76 At least the desktop guide above taught me about /dev/kmesg! I
     77 no longer have to remember what it said at boot time :)
     78 
     79 [Mon Apr 11 03:35:57 EDT 2022]
     80 
     81 Been a hot sec. Life got busy. Went on a company trip to Asheville,
     82 NC and then a bachelor party in Vegas. Caught a stomach bug and
     83 ended up spending most of the party in the hotel room. Still a story,
     84 I guess. Just not the one I expected to be telling.
     85 
     86 Anyways, I'm not quite sure where I left off. src/net.sh and src/res.sh
     87 both worked so I was up, fullscreen, and on wifi in about 3 min.
     88 
     89 Maybe I'll try to take a whack at ircrc(1) or email? Probably good to get
     90 SSH up too...
     91 
     92 end of night update: ircrc(1) worked great, no issues! ssh(1) still
     93 not working. I checked the server logs and it said "unable to negotiate,
     94 client offered: ssh-rsa", so I wonder if the client's cipher's are
     95 too old? The 9front fqa says that it supports chacha20-poly1305, which
     96 I think openssh should support on the server side... so why is the
     97 handshake failing? unclear.
     98 
     99 maybe I'll ask in #cat-v on IRC next time I boot :)
    100 
    101 Some other things I tried:
    102 
    103 1. Creating a SSH key (as documented in rsa(8)):
    104 
    105 	term% auth/rsagen -t 'service=ssh' >ssh.key
    106 	term% cat ssh.key >/mnt/factotum/ctl
    107 	term% ssh ajk@sdf.org
    108 	ssh: read1: eof
    109 
    110 That should have added it to factotum(4) for retrieval. hm.. I mean
    111 obviously the SSH server doesn't expect the key, but it shows that it's
    112 not like ssh(1) is keeling over because of lack of key (I don't think.).
    113 
    114 [Tue Apr 12 03:27:55 EDT 2022]
    115 
    116 I did it! At long last, a working ssh(1).
    117 
    118 I browsed the mailing list for a while and finally stumbled upon
    119 this patch [1] that linked to the fact that in 2021-09 openssh
    120 deprecated the ssh-rsa cipher (which from the sshd logs was what
    121 I was offering...).
    122 
    123 I'm not sure _why_ this patch didn't seem to make it into my install,
    124 but sure enough I was able to do a system update and rebuild from
    125 source and my new ssh(1) works out of the box! (I double checked and
    126 the patch is indeed applied). So the fix was:
    127 
    128 	term% sysupdate
    129 	term% cd /
    130 	term% . /sys/lib/rootstub
    131 	term% cd /sys/src
    132 	term% mk install
    133 
    134 As described in the fqa: http://fqa.9front.org/fqa5.html#5.1
    135 
    136 [1]: https://inbox.vuxu.org/9front/CD1ED7F51E72A0050786E39FADF6EBFE@felloff.net/
    137 
    138 
    139 [Thu Apr 14 02:46:06 EDT 2022]
    140 
    141 Tonight's goal: move this blog to the interwebs. Up until now
    142 it's lived on this thinkpad as /usr/glenda/notes.txt, but I
    143 (1) want to back it up and (2) want to share it in case it
    144 helps anyone else!
    145 
    146 Now that I have ssh(1) working, and given that 9front recently
    147 added git(1), it should be pretty trivial to publish to my
    148 gopherhole, just add it to the repo and commit and push!
    149 
    150 I had to first generate an ssh key as listed in rsa(8) and add
    151 it to factotum(4) so that I could clone via ssh:
    152 
    153   % auth/rsagen -t 'service=ssh role=client' > ssh.key
    154   % cat ssh.key >/mnt/factotum/ctl
    155   % auth/rsa2ssh ssh.key  # copy to clipboard, add to authorized_keys
    156   
    157 Then:
    158 
    159   % git/clone git@alexkarle.com:alexkarle.com akcom
    160   % cd akcom
    161   % mv /usr/glenda/notes.txt gopher/notes/all/plan9.txt
    162   % git/commit gopher/notes/all/plan9.txt
    163   <do the weird dance with 9term in blue hold mode>
    164   % git/push
    165 
    166 By the "weird dance" I mean:
    167 
    168   1. Type my commit message
    169   2. Type CTRL-D and newline
    170   3. Hit escape?
    171 
    172 Whacky.
    173 
    174 I couldn't get git/diff <sha> to show the diff, so instead I checked
    175 my diff with git/export HEAD, which worked great.
    176 
    177 Oh and I put my git config in $home/lib/git/config (name/email).
    178 
    179 The date is still 4hr off, so sourcehut rendered the commit as "3hr in
    180 the future" :) whoops!
    181 
    182 [Wed Apr 13 23:41:38 EDT 2022]
    183 
    184 Time travel! Look at me! haha I figured out my 4hr issue.
    185 Turns out my bios time was UTC but when I booted into 9front
    186 it thought it was EDT (since that's my locale). Now
    187 date -u and friends work as expected. I feel a bit silly
    188 for not checking sooner.
    189 
    190 Other known issues to sort out another night:
    191 
    192 * I have to execute the following (src/res.sh) each boot
    193   to get the right screen resolution--add to startup script?
    194   or /cfg/plan9.ini?
    195 
    196     @{rfork n; aux/realemu; aux/vga -m vesa -l 1366x768x16}
    197 
    198 * Battery doesn't show in stats(8) despite having apm0= and
    199   *acpi= in /cfg/plan9.ini
    200 
    201 * Suspend on laptop lid close doesn't work (should it?)
    202 
    203 * /lib/firmware isn't mounted at boot time -> no wifi drivers
    204   -> I have to run the following to join my network each time
    205   I boot (src/net.sh):
    206 
    207 	bind -a '#l1' /net
    208 	aux/wpa -p -2 -s <NetworkName> /net/ether1
    209 	ip/ipconfig ether /net/ether1
    210 
    211 I think if I'm serious about making use of this system (beyond
    212 the just poking around for fun / seeing how it feels), I'll need
    213 to pour over the fqa in detail, read more man pages, and maybe
    214 search around the community spaces. It's been a real fun "can you
    215 boot it" challenge, and I've already been inspired by some of
    216 the design philosophy, but I'm clearly very green at getting
    217 anything working.
    218 
    219 
    220 [Sat Apr 16 23:14:18 EDT 2022]
    221 
    222 Another night, another challenge. Let's try to figure out how
    223 to get my alexkarle.com site to build on 9front. This should
    224 be interesting because we have:
    225 
    226 1. A C markdown-like compiler (nihdoc) to port
    227 2. A makefile to port
    228 
    229 Hopefully it's a chance to learn both 6c(1) and mk(1)!
    230 
    231 Let's start with hello world in plan9-C, as discussed in
    232 "C Programming in Plan 9", from cat-v [1]
    233 
    234 #include <u.h>
    235 #include <libc.h>
    236 
    237 void
    238 main()
    239 {
    240 	print("hello, world\n");
    241 	exits("wat");
    242 }
    243 
    244 Compile and marvel at string exit messages:
    245 
    246 term% 6c hello.c
    247 term% 6l hello.6
    248 term% 6.out
    249 hello, world
    250 term% echo $status
    251 6.out 1480: wat
    252 
    253 Aaaand at this point in the night I'm realizing that porting
    254 anything substantial is gonna be a mess. So here's to just
    255 writing plaintext for gopher and git/push-ing that into the
    256 void! For now, at least.
    257 
    258 [1]: http://doc.cat-v.org/plan_9/programming/c_programming_in_plan_9
    259 
    260 
    261 [Mon Apr 18 22:57:23 EDT 2022]
    262 
    263 Guess who's back, back again.
    264 
    265 I wonder if there's a bit of inertia in plan9 just because I put
    266 it on my laptop and need to go pull out a screwdriver to swap
    267 back to OpenBSD. Definitely.
    268 
    269 Don't get me wrong, I like acme(1). I like the feel of the system.
    270 But... it ain't easy. And I can't do things I'm supposed to be
    271 doing in the evenings (catching up on email, etc).
    272 
    273 With that in mind... maybe I'll try to set up email tonight?
    274 
    275 I think it's OK to put a hold on the akcom building. No need to
    276 jump straight into C programming. Let's use the system more!
    277 
    278 First stop, the fqa! At this point, it'd be wise to download
    279 locally:
    280 
    281 	term% hget http://fqa.9front.org/dash1.survivalevasionandescape.pdf >fqa.pdf
    282 
    283 Ahh free from the browser again :)
    284 
    285 Yet again lost in the fqa and didn't make progress on my "goal".
    286 
    287 TODO:
    288 
    289 * Read mail(1)
    290 * Set up an email account I don't have data I'm afraid to lose
    291 * Read upasfs(4), reread fqa on mail
    292 
    293 Learned today:
    294 
    295 * The editor used by git(1) is hold(1) (5 lines of rc?!)
    296 * hostowner is "root" for processes, not files