sirjofri

Hello, I'm sirjofri and I'm quite new to 9-world. I encountered many challenges, especially for beginners. So this is a collection of challenges and solutions, step by step guides and quick tips I found useful.

Most of the time I use the 9front distribution and inferno. Ok, well, inferno often just acme sac, I even use it from my job to connect to 9gridchan chat.

LENOVO T61

My main 9front machine is a lenovo T61. My installation procedure looks like this:

First I make my default installation routine, exactly like the fqa states (http://fqa.9front.org/fqa4.html). It really is just following the guide and the installation wizard. The next step involves adjusting the plan9.ini. The machine specific settings for my T61 are:

monitor=vesa
vgasize=1280x1024x32
*acpi=
mouseport=ps2intellimouse

What I really want to use (I mean, hey, it's a laptop), is wifi. For my device I need to add the correct device drivers, in my case "wpi-3945abg". My wifi card is slow, but I was able to work via drawterm from my windows machine, so it's fine.

% cp source/to/wpi-3945abg /lib/firmware/
% cd /sys/src/9/pc
% mk install
#    Then I need to [install the kernel | http://fqa.9front.org/fqa7.html#7.2.5] to my boot partition. This may be different in your setup!
% 9fs 9fat
% rm /n/9fat/9bootfat
% cp /386/9bootfat /n/9fat/
% chmod +al /n/9fat/9bootfat
% cp /386/9pc /n/9fat/

The next thing to do is binding the network card to my namespace. I do this in /cfg/$sysname/termrc (or /cfg/$sysname/cpurc):

bind -a '#l1' /net

Then the device should show up in /net:

% lc /net
arp        esp/       icmp/      ipmux/     ndb
bootp      ether0/    icmpv6/    iproute    rudp/
cs         ether1/    il/        ipselftab  tcp/
dns        gre/       ipifc/     log        udp/

You can then find networks in range inside the /net/ether1/ifstats file. To connect to one of them you need to setup your secrets and start wpa:

#   Add your secret WPA key. essid is case sensitive!
% echo 'key proto=wpapsk essid=yournetwork !password=yourwpakey' > /mnt/factotum/ctl
% cat /mnt/factotum/ctl      # verify
key proto=wpapsk essid=yournetwork !password?
% aux/wpa -2 /net/ether1

Connecting to the wifi network:

% echo essid yournetwork > /net/ether1/clone
% ip/ipconfig -p ether /net/ether1
% cat /net/ndb      # verify

There's a nice autowifi script from jeremy (9fans discord server) that can handle automatically connecting to your wifi networks.


ONE-MACHINE MAIL CLIENT SETUP

Please also have a look at mail configuration and the 9front fqa. Especially the information for reading mail in the fqa is pretty much the same thing I did for my configuration.

Sending Mail

With much help from kvik I was able to setup my single machine for sending mail. This might not be useful for multi-machine setups with multiple users etc., but in my case (using only one machine) it seems to work fine.

At first I tried fiddling around with the information from mail configuration, but nothing worked as I wanted. Then kvik showed me an easy way to send mail from 9front machines.

cp /mail/lib/rewrite.gateway /mail/lib/rewrite

Then change all that YOURDOMAIN.COM stuff to the default domain you want to use. According to kvik this is optional and is not used in this setup, but it doesn't hurt.

The more important step is setting up the /mail/lib/remotemail file. That script is called by the queue to actually send the mails. So here we basically receive the mail information and replace it with our delivery system. kvik uses basically this file:

#!/bin/rc
sender=$upasname
user=$sender
switch($sender){
case user@example.com
    dom=example.com
    user=user
    smtp=tcp!smtp.example.com!587
case user2@example.com
    dom=example.com
    user=user2
    smtp=tcp!smtp.example.com!587
case *
    exit addr.not.set
}
shift 3
exec /bin/upas/smtp -a -h $dom -u $user $smtp $sender $*

Of course you need to adjust the account details. Also don't forget to add your credentials to factotum. They look like:

% cat /mnt/factotum/ctl
key proto=pass server=smtp.example.com service=smtp user=user !password?

(Factotum is an essential feature for plan9 installations, so you should definitely know how to add keys to it.)

The above remotemail uses the upasname= variables to switch between the addresses. You can send test mails via:

% upasname=user@example.com mail -s TEST destination@example.com

The first connection will fail. That's because you still need to add the certs for the other server. You can find the hash inside /sys/log/smtp:

% cat /sys/log/smtp
sysname Oct 28 20:20:09 cert for mx01.example.com not recognized: sha256=XXXXX

Then add this hash to your /sys/lib/tls/smtp

% echo 'x509 sha256=XXXXX' >> /sys/lib/tls/smtp

and try sending your test mail again.

If that works fine you can also use acme for composing and sending mail. I also set up upas/fs with the same account information (at the moment I only use that one mail account on my machine), so I can read and write mail from one acme session.

Reading mail in acme is pretty easy. You just do what you want. I should mention that you can mark mails as Delmesg, then you need to Put that page to actually delete the messages.

For writing mail middle-click the Mail tag. A new and empty window opens. This is where I was lost. There's almost no information online and on the system. You can also not find examples anywhere, so I asked kvik and he provided a nice example. If you think about it, that's what you could already expect:

To: destination@example.com
CC: cc-destination@example.com
Subject: [SPAM] NEED TO SEND YOU $100000000 DOLLARS

Hi, I am the Prince of Uruk-Hai and am sending out spam to people...

(The example subject and content are so funny that I included them here.)

Then hitting Post will send that mail. Notice that the acme window is marked as written and the Post is still there, but the mail will be sent. I can imagine that your mail turns into real spam if you hit Post again and again...

So that's about sending mail with acme. Now I need to figure out how to send attachments, but I can imagine that's another story.

Marshal(1) handles mail parsing. It receives the mail message and parses it's plain text header information to build an actual mail in the correct format. It understands the following headers for attachments:

Attach: /path/to/file
Include: /path/to/file

You can use more than one of these header lines to attach multiple files.


GRIDFACE

Today I quickly created gridface, a 9gridchan face(6) provider. It's nothing special, it's not even magic. It's … just a mkfile. You can find more information in the github repo.

gridface is installed on griddisk (including the readme file, so you don't need to open github if you're going to use it). It's path is /n/griddisk/lib/face . gridface being a normal directory (like most things in 9), you can easily bind it to $home/lib/face or /lib/face , so faces(1) can find it.

Note that it wouldn't be that easy to make this mkfile if plan9 wasn't utf8 capable (filenames with @-signs in a shared network) and had no mutable namespaces. plan9 is great, I love it.