Table of Contents

Overview

This exploration of Plan9 consists of many Xen virtual machines running in the LAIR.

hostname RAM disk OS Kernel Description
p9auth.offbyone.lan 256MB 4GB (/) Plan9 9xenpccpuf-pae Authentication Server
p9cpuf.offbyone.lan 768MB 4GB (/) Plan9 9xenpccpuf-pae CPU/Fileserver (Fossil+Venti)
p9cpu0.offbyone.lan 256MB netboot Plan9 9xenpccpuf-pae CPU Server (netboot)
p9cpu1.lair.lan 256MB netboot Plan9 9xenpccpuf-pae
p9cpu2.lair.lan 256MB netboot Plan9 9xenpccpuf-pae
p9cpu3.lair.lan 256MB netboot Plan9 9xenpccpuf-pae
p9cpu4.lair.lan 256MB netboot Plan9 9xenpccpuf-pae

News

TODO

Network Configuration

Machine Interface IP Address MAC Address
p9auth.offbyone.lan ether0 10.80.2.50 00:16:3e:42:ee:30
p9cpuf.offbyone.lan ether0 10.80.2.51 00:16:3e:42:ee:31
p9cpu0.offbyone.lan ether0 10.80.1.52 00:16:3e:42:ee:39
p9cpu1.lair.lan ether0 10.80.1.81 00:16:3e:42:ee:45
p9cpu2.lair.lan ether0 10.80.1.82 00:16:3e:42:ee:46
p9cpu3.lair.lan ether0 10.80.1.83 00:16:3e:42:ee:47
p9cpu4.lair.lan ether0 10.80.1.84 00:16:3e:42:ee:48

Xen Config Files

The standard config file for plan9 is:

kernel = "/xen/boot/9xenpccpuf-pae.gz"
#kernel = "/xen/boot/9xenpcf-pae.gz"
memory = 128
name = "plan9"
vif = [ 'mac=00:16:3e:42:ee:31' ]
disk = [ 'file:/xen/images/plan9.disk,sda,w',
         'file:/xen/images/plan9.iso,sdb,r' ]

# This is the equivalent of plan9.ini:
extra="""
bootargs=local!#S/sd00/fossil
venti=#S/sd00/arenas
"""

p9cpu[0-4]

The Plan9 CPU servers with a root obtained over the network have config files as follows:

##########################################################################
# LAIR Xen VM configuration file
##########################################################################

#################################################
#  Kernel + memory size
#
kernel  = "/xen/boot/9xenpccpuf-pae.gz"
#kernel = "/xen/boot/9xenpcf-pae.gz"
memory  = 256

#################################################
#  Disk device(s).
#
#disk   = [ 'file:/xen/images/p9cpu1.disk,sda,w' ]

#################################################
#  Hostname
#
name    = "p9cpu1"

#################################################
#  Networking
#
vif = [ 'mac=00:16:3e:42:ee:45' ]

#################################################
#  Behaviour
#
#restart = 'never'

#################################################
#  Misc. Settings
#
#vfb = [ 'type=vnc,vncdisplay=8' ]

#################################################
#  Plan9.ini
#
extra="""
[menu]
menuitem=cpu, Plan 9 CPU Kernel
menuitem=terminal, Plan 9 Terminal Kernel
menudefault=cpu, 10

[cpu]
bootfile=sd00!9fat!9xenpccpuf-pae

[terminal]
bootfile=sd00!9fat!9pcf

[common]
auth=10.80.2.50
fs=10.80.2.51
nobootprompt=tcp! -g 10.80.1.1 ether /net/ether0 10.80.1.125 255.255.255.0
"""

Installation

Prior work on this particular task was always halted due to some combination of CPU feature / lack of supported feature in Plan9 (needing PAE support when running PAE… needing 64-bit support when running a full 64-bit environment, etc.)

Luckily, over the past year, support for 64-bit (via the PAE supporting Plan9 files) has appeared.

A transcript of the install follows:

creating disk image

yourmambas:~# dd if=/dev/zero of=/xen/images/plan9.disk bs=1M count=4096
4096+0 records in
4096+0 records out
4294967296 bytes (4.3 GB) copied, 71.4128 s, 60.1 MB/s
yourmambas:~# 

plan9 install config file

The following works for the Xen config to install Plan9:

##
## plan9install.conf - Xen config file for installing Plan9 in a
##                     paravirtualized domU
##
## Based on instructions found at:
##     http://plan9.bell-labs.com/wiki/plan9/installing_in_xen_3.0/index.html
##

##
## Kernel Configuration (use installer kernel)
##
kernel = "/xen/boot/9xeninst-pae.gz"

##
## Memory Configuration
##
memory = 128

##
## domU particulars (ID name, MAC)
##
name = "plan9install"
vif = [ 'mac=00:16:3e:42:ee:31' ]

##
## Disk Configuration
##
disk = [ 'file:/xen/images/plan9.disk,sda,w',
         'file:/xen/images/9atom.iso,sdb,r' ]

##
## Virtualized Frame Buffer Settings
##
vfb = [ 'type=vnc,vncdisplay=9' ]

##
## Other domU settings
##
restart = 'never'

##
## plan9.ini - exported via the domU "extra" parameter
##
extra="""
nobootprompt=local!/boot/bzroot
bootfile=sd01!cdboot!bootdisk.img
"""

boot

yourmambas:~# xm create -c /xen/conf/plan9install.conf

If successful, the VM boots, and we attach the console, the following is seen:

Using config file "/xen/conf/plan9install.conf".
Started domain plan9install

Plan 9 (xen-3.0-x86_32p)
127 holes free
001a2000 0342e000 53002240
53002240 bytes free
cpu0: 1866MHz GenuineIntel Xeon5000-series (cpuid: AX 0x06F6 DX 0xBFEBFBFF)
#l0: xen: 100Mbps port 0x0 irq -1: 00163e42ee31
128M memory: 52M kernel data, 75M user, 303M swap
cpu0: spurious interrupt 101, last 0
sdxen: waiting for vbd 2048 to connect
sdxen: backend /local/domain/0/backend/vbd/21/2048/ secsize 512 sectors 8388608
sdxen: waiting for vbd 2064 to connect
sdxen: backend /local/domain/0/backend/vbd/21/2064/ secsize 512 sectors 553416
#S/sd00/data: no partitions
#S/sd01/: part cdboot 217284 223044
kfs...version...time...

init: starting /bin/rc
/bin/dossrv: serving #s/dos
dev 3 sector 18, write: 0, should be 4608
dev 3 sector 0, write: 0, should be 4608
dev 3 sector 18, write: 0, should be 4608
dev 3 sector 9, write: 0, should be 4608
dev 3 sector 4347, write: 0, should be 4608
use DMA for ide drives[yes]: 
echo: write error: bad process or channel control request
echo: write error: bad process or channel control request
rio: can't open display: initdisplay: /dev/draw/new: unknown device in # filename


failed to start rio.  you can start a text-based installation by running

        inst/textonly


init: starting /bin/rc
% 

installer

To really kick things off, launch the text-based installer:

% inst/textonly

and follow the prompts:

configfs

First order of business, determine the type of filesystem we want (fossil or fossil+venti)… for auth server, we just want fossil… for fileserver, we want fossil+venti.

Wed Oct 20 18:40:49 BST 2010 Installation process started

--------------------------------------

Preparing menu...
The following unfinished tasks are ready to be done:
        configfs        - choose the type of file system to install
        stop    - save the current installation state, to be resumed later

Task to do [configfs]: 

--------------------------------------
You can install the following types of file systems:

        fossil                  the new Plan9 fileserver
        fossil+venti    fossil + a archival dump server

File system (fossil, fossil+venti)[fossil]: fossil+venti

--------------------------------------

partdisk

Now comes the time to set up disk partitions. Luckily, we can likely just go with the defaults.

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install

The following unfinished tasks are ready to be done:
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        stop    - save the current installation state, to be resumed later

Task to do [partdisk]: 

--------------------------------------
The following disk devices were found.

sd00 - Xen block device

sd01 - Xen block device

Disk to partition (sd00, sd01)[no default]: sd00
The disk you selected HAS NO master boot record on its first sector.
(Perhaps it is a completely blank disk.)
You need a master boot record to use the disk.
Should we install a default master boot record?

Install mbr (y, n)[no default]: y

fdisk

The actual disk partitioning tool. We want the default, so 'w'rite and 'q'uit!

This is disk/fdisk; use it to create a Plan 9 partition.
If there is enough room, a Plan 9 partition will be
suggested; you can probably just type 'w' and then 'q'.

cylinder = 8225280 bytes
'* p1                    0 522        (522 cylinders, 3.99 GB) PLAN9
>>> w
>>> q

--------------------------------------

prepdisk

Plan9, in a similar fashion to BSD systems, utilizes slices (or a soft partitioning scheme). Here we set that up (run with defaults):

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)

The following unfinished tasks are ready to be done:
        prepdisk        - subdivide plan 9 disk partition
        stop    - save the current installation state, to be resumed later

Task to do [prepdisk]: 

--------------------------------------
The following Plan 9 disk partitions were found.

/dev/sd00/plan9
  empty                 0 8385867    (8385867 sectors, 3.99 GB)

Plan 9 partition to subdivide (/dev/sd00/plan9)[/dev/sd00/plan9]: 

disk/prep

The partition subdivider (disk slices). Again, run with defaults— 'w'rite and 'q'uit!

This is disk/prep; use it to subdivide the Plan 9 partition.
If it is not yet subdivided, a sensible layout will be suggested;
you can probably just type 'w' and then 'q'.

no plan9 partition table found
9fat 204800
nvram 1
fossil 1258625
arenas 6293128
isect 314656
swap 314657
' 9fat                  0 204800     (204800 sectors, 100.00 MB)
' nvram            204800 204801     (1 sectors, 512 B )
' fossil           204801 1463426    (1258625 sectors, 614.56 MB)
' arenas          1463426 7756554    (6293128 sectors, 3.00 GB)
' isect           7756554 8071210    (314656 sectors, 153.64 MB)
' swap            8071210 8385867    (314657 sectors, 153.64 MB)
>>> w
>>> q

--------------------------------------

fmtfossil

Our disk storage is handled by fossil, our filesystem/fileserver thing.

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition

The following unfinished tasks are ready to be done:
        fmtfossil       - initialize disks for a fossil server
        stop    - save the current installation state, to be resumed later

Task to do [fmtfossil]: 

--------------------------------------
You have the following fossil partitions.

Fossil partition to format (/dev/sd00/fossil)[/dev/sd00/fossil]: 
Done.

--------------------------------------

mountfs

Mount our root filesystem (much like during a Debian install we have a /target which is the eventual booting filesystem where all the files are dumped during installation).

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server

The following unfinished tasks are ready to be done:
        mountfs - choose and mount file system partition
        stop    - save the current installation state, to be resumed later

Task to do [mountfs]: 

--------------------------------------
The following partitions named fossil* were found.

Please choose one to use as the installation file system
for your Plan 9 installation.

--rw-r----- S 0 glenda glenda 644416000 Feb 11  2010 /dev/sd00/fossil

Fossil partition (/dev/sd00/fossil)[/dev/sd00/fossil]: 

--------------------------------------

Preparing menu...% fossil/fossil -c . /env/fossilconf
prompt: % mount -c /srv/fossil /n/newfs
fsys main create /active/adm adm sys d775
prompt: fsys main create /active/adm/users adm sys 664
prompt: uname upas :upas
prompt: users -w
        nuser 6 len 96
prompt: fsys main create /active/dist sys sys d775
prompt: fsys main create /active/dist/replica sys sys d775
prompt: fsys main create /active/dist/replica/client sys sys d775
prompt: fsys main create /active/dist/replica/client/plan9.db sys sys 664
prompt: fsys main create /active/dist/replica/client/plan9.log sys sys a664
prompt: 

configdist

Where are we getting our distribution data from, local storage or network? local CD image!

The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition

The following unfinished tasks are ready to be done:
        configdist      - choose the source of the distribution archive
        download        - download or continue to download the distribution archives
        stop    - save the current installation state, to be resumed later

Task to do [configdist]: 

--------------------------------------
Are you going to download the distribution
from the internet or do you have it on local media?

Distribution is from (local, net)[local]: 

--------------------------------------

mountdist

Where are we getting the installation files from? (CD image!)

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive

The following unfinished tasks are ready to be done:
        mountdist       - locate and mount the distribution
        download        - download or continue to download the distribution archives
        stop    - save the current installation state, to be resumed later

Task to do [mountdist]: 

--------------------------------------
Please wait... Scanning storage devices...
        /dev/sd00/9fat
        /dev/sd00/arenas
        /dev/sd00/data
        /dev/sd00/fossil
        /dev/sd00/isect
        /dev/sd00/nvram
        /dev/sd00/swap
        /dev/sd01/cdboot
        /dev/sd01/data

The following storage media were detected.
Choose the one containing the distribution.

        /dev/sd00/fossil (plan9 fossil)
        /dev/sd01/cdboot (microsoft fat)
        /dev/sd01/data (iso9660 cdrom)

Distribution disk [no default]: /dev/sd01/data
% 9660srv
/bin/9660srv 2757: serving /srv/9660
% mount /srv/9660 /n/distmedia /dev/sd01/data

Which directory contains the distribution?
Any of the following will suffice (in order of preference):
        - the root directory of the cd image
        - the directory containing plan9.iso
        - the directory containing plan9.iso.bz2
Typing `browse' will put you in a shell that you can use to
look for the directory.

Location of archives [browse]: /

--------------------------------------

fmtventi

Taking care of venti… some other fileserver/filesystem data management thing.

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive
        mountdist       - locate and mount the distribution

The following unfinished tasks are ready to be done:
        fmtventi        - initialize disks for a venti server
        copydist        - copy the distribution into the file system
        stop    - save the current installation state, to be resumed later

Task to do [fmtventi]: 

--------------------------------------
You have the following Venti arena partitions.
--rw-r----- S 0 glenda glenda 3222081536 Feb 11  2010 /dev/sd00/arenas

Venti arena partitions to use [/dev/sd00/arenas]: 
You have the following Venti index partitions.
--rw-r----- S 0 glenda glenda 161103872 Feb 11  2010 /dev/sd00/isect

Venti index partitions to use [/dev/sd00/isect]: 
Formatting Venti arenas and indices this takes a while .
/dev/sd00/arenas ...
fmtarenas /dev/sd00/arenas: 6 arenas, 3,221,282,816 bytes storage, 524,288 bytes for index map
done with /dev/sd00/arenas
/dev/sd00/isect ...
fmtisect /dev/sd00/isect: 19,569 buckets of 215 entries, 524,288 bytes for index map
done with /dev/sd00/isect
Done formatting Venti arenas and indices.
Storing Venti config on /dev/sd00/arenas...
Initializing index...
fmtindex: 6 arenas, 19,569 index buckets, 3,221,184,512 bytes storage
Done with Venti!

--------------------------------------

copydist

Finally, copying the standard Plan9 distribution to our hard drive!

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive
        mountdist       - locate and mount the distribution
        fmtventi        - initialize disks for a venti server

The following unfinished tasks are ready to be done:
        copydist        - copy the distribution into the file system
        stop    - save the current installation state, to be resumed later

Task to do [copydist]: 

--------------------------------------
|############################################################| 100% 
--------------------------------------

bootsetup

Set up our boot sector/boot loader stuff.

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive
        mountdist       - locate and mount the distribution
        fmtventi        - initialize disks for a venti server
        copydist        - copy the distribution into the file system

The following unfinished tasks are ready to be done:
        bootsetup       - create a boot floppy or configure hard disk to boot plan 9
        stop    - save the current installation state, to be resumed later

Task to do [bootsetup]: 

--------------------------------------

Initializing Plan 9 FAT configuration partition (9fat)

rc (bootsetup): null list in concatenation

--------------------------------------

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive
        mountdist       - locate and mount the distribution
        fmtventi        - initialize disks for a venti server
        copydist        - copy the distribution into the file system

The following unfinished tasks are ready to be done:
        bootsetup       - create a boot floppy or configure hard disk to boot plan 9
        stop    - save the current installation state, to be resumed later

Task to do [bootsetup]: 

--------------------------------------

Initializing Plan 9 FAT configuration partition (9fat)

Initializing Plan 9 FAT partition.
add 9load at clust 2
Initializing FAT file system
type hard, 12 tracks, 255 heads, 63 sectors/track, 512 bytes/sec
Adding file /n/newfs/386/9load, length 264364
add 9load at clust 2
used 268288 bytes
% cp /n/newfs/386/9load /n/9fat/9load
% cp /n/newfs/386/9pcf /n/9fat/9pcf

There are myriad ways to boot a Plan 9 system.
You can use any of the following.

  floppy - create a boot floppy
  plan9  - make the plan 9 disk partition the default for booting
  win9x  - add a plan 9 option to windows 9x boot menu
  winnt  - add a plan 9 option to windows nt/2000/xp boot manager

If you are upgrading an extant third edition installation and booting
from something other than a floppy, you needn't run anything here.
Just type ctl-d.
Enable boot method (floppy, plan9, win9x, winnt)[no default]: plan9
If you use the Windows NT/2000/XP master boot record
or a master boot record from a Unix clone (e.g., LILO or
FreeBSD bootmgr), it is probably safe to continue using
that boot record rather than install the Plan 9 boot record.

Install the Plan 9 master boot record (y, n)[no default]: y
Setting Plan 9 partition active.

The Plan 9 partition is now marked as active.

--------------------------------------

finish

Too good to be true? We're done with the main install!

Preparing menu...
The following tasks are done: 
        configfs        - choose the type of file system to install
        partdisk        - edit partition tables (e.g., to create a plan 9 partition)
        prepdisk        - subdivide plan 9 disk partition
        fmtfossil       - initialize disks for a fossil server
        mountfs - choose and mount file system partition
        configdist      - choose the source of the distribution archive
        mountdist       - locate and mount the distribution
        fmtventi        - initialize disks for a venti server
        copydist        - copy the distribution into the file system
        bootsetup       - create a boot floppy or configure hard disk to boot plan 9

The following unfinished tasks are ready to be done:
        finish  - finish the installation and reboot
        stop    - save the current installation state, to be resumed later

Task to do [finish]: 

--------------------------------------
We need to write the state of the current installation to the install floppy,
so that you can pick up from here if, for example, you want to set up
more boot methods.

Please make sure the install floppy is in the floppy drive and press enter.

At this point, we don't exactly have the means of creating a floppy, so we will shut down the VM via a Plan9 key sequence:

^T^Tr

Essentially– press: CTRL-T CTRL-T followed by 'r'.

Then you should see something resembling the following:

cpu0: exiting
yourmambas:~# 

plan9 config files

plan9.ini

In /n/9fat, we have plan9.ini. It contains:

[menu]
menuitem=cpu, Plan 9 CPU Kernel
menuitem=terminal, Plan 9 Terminal Kernel
menudefault=cpu, 10

[cpu]
bootfile=sd00!9fat!9xenpccpuf-pae

[terminal]
bootfile=sd00!9fat!9pcf

[common]
nobootprompt=local!#S/sd00/fossil
venti=#S/sd00/arenas

ndb/local

The local network database configuration file, located in: /lib/ndb/local

Create via: cat >/lib/ndb/local «EOF

p9auth

# /lib/ndb/local
# LEG16112006
#
# main network database configuration file


#  files comprising the database
database=
    file=/lib/ndb/local
    file=/lib/ndb/common
    file=/lib/ndb/auth

ipnet=offbyone.lan ip=10.80.2.0 ipmask=255.255.255.0
    dnsdomain=offbyone.lan
    dns=10.80.2.1
    ntp=10.80.2.1
    smtp=10.80.2.17
    authdom=offbyone.lan
    auth=p9auth
    cpu=p9cpuf
    fs=p9cpuf

# what's my name:
ip=10.80.2.50 sys=p9auth

# localhost
ip=127.0.0.1 sys=localhost dom=localhost

auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com

p9cpuf

# /lib/ndb/local
# LEG17112006
#
# main network database configuration file

#  files comprising the database
database=
    file=/lib/ndb/local
    file=/lib/ndb/common

ipnet=offbyone.lan ip=10.80.2.0 ipmask=255.255.255.0
dnsdomain=offbyone.lan
dns=10.80.2.1
ntp=10.80.2.1
smtp=10.80.2.17
authdom=offbyone.lan
auth=p9auth
cpu=p9cpuf
fs=p9cpuf

ip=10.80.2.51 sys=p9cpuf
ip=127.0.0.1 sys=localhost dom=localhost

auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com

cpurc

The local network database configuration file, located in: /rc/bin/cpurc

Create via: cat >/rc/bin/cpurc «EOF

p9auth

#!/bin/rc
# /rc/bin/cpurc
# LEG16112006
#
# cpurc for authserver

echo -n cpu > /env/service
date > /env/boottime

# replace FILESERVER with the name of your file server
# here we start with kfs, your local disk file system
fileserver=kfs

# default authdom
authdom=offbyone.lan

# the local domain to be used in the faces database
facedom=offbyone.lan

# mount points
mntgen -s slashn && chmod 666 /srv/slashn

# configure ip address
ip/ipconfig

# name translation, cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
ndb/dns -r

# extract info about our network from ndb
ndb/query ipnet $$authdom |rc

# parallelism for mk
NPROC = `{wc -l </dev/sysstat}

# we use the fileserver for syncing time
aux/timesync -f -l $fs

# start the secstored
auth/secstored

# authserver
auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
auth/cron >>/sys/log/cron >[2=1] &

# services available to networks
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service il
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp

p9cpuf

#!/bin/rc
# /rc/bin/cpurc
# LEG17112006
#
# cpurc for fileserver

echo -n cpu > /env/service
date > /env/boottime

# replace FILESERVER with the name of your file server
# here we start with kfs, your local disk file system
fileserver=p9cpuf

# default authdom
authdom=offbyone.lan

# the local domain to be used in the faces database
facedom=offbyone.lan

# mount points
mntgen -s slashn && chmod 666 /srv/slashn

# configure ip address
ip/ipconfig

# name translation, cs sets /dev/sysname
ndb/cs
sysname=`{cat /dev/sysname}
ndb/dns -r

# extract info about our network from ndb
ndb/query ipnet $$authdom |rc

# parallelism for mk
NPROC = `{wc -l </dev/sysstat}

# The fileserver will also be timeserver with stratum 9
aux/timesync -n -l -S 9

# services available to networks
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service il
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp

updates

In order to keep the Plan9 source tree up-to-date with the latest changes, we'll want to do the following:

% 9fs sources
% cd /n/sources
% ls
9grid   adm   contrib   dist   du   extra   fastos    lsr   patch   plan9   wiki   xen
% replica/pull -v /dist/replica/network
c 386/9load
c 386/9loaddebug
c 386/9loadlite
...
% 

unreplicated new files

Over time, it would seem, new files would be added to the source tree. By default, a replica/pull operation would not pull down a local copy of those new files, as indicated by the following output:

% 9fs sources
% replica/pull -v /dist/replica/network
! 386/9loadnousb: not replicated; will not update
! sys/src/9/kw/devtwsi.c: not replicated; will not update
c sys/src/9/omap/beagle
! rc/bin/cpurc: locally modified; will not update [1975 1207348151 -> 899 1287807456]
% 

So new files will not be pulled down, and locally modified files will not be overwritten. There are facilities for taking care of this, especially to get those new files in the replication tree. We need to utilize the -s argument to replica/pull, and provide it a path to the file in question. To fix the 386/9loadnousb, for instance:

% replica/pull -v -s 386/9loadnousb /dist/replica/network
c 386/9loadnousb
! sys/src/9/kw/devtwsi.c: not replicated; will not update
! rc/bin/cpurc: locally modified; will not update [1975 1207348151 -> 899 1287807456]
% 

Simply repeat the process for all additional files (I'd imagine there'd be some way of extending greater flexibility to include many new files if need be)… then, on a subsequent replica/pull, you should only see the entry for the locally modified files (or the files you don't care about replicating).

installing contrib

From the standard Plan 9 distribution, the contrib tool does not appear to be installed.. this is apparently a package provided by fgb.

contrib variants

Instead of just contrib/install, there are actually a suite of commands available for usage, including contrib/gui and contrib/listcontrib/install as we use it is actually located in /bin/contrib/install, so changing into /bin/contrib and taking a look around will yield other tools.

contrib

Bell Labs hosts a Plan 9 sources repository at: sources.cs.bell-labs.com

When one runs: 9fs sources

This sources data becomes available via a (I believe) 9p network filesystem connection, as is witnessed by running ns after doing the 9fs sources above:

% ns
...
mount  '#s/sources' /n/sources

With the running of 9fs sources, the Plan9 and contrib sources are attached to our filesystem at: /n/sources/

Looking in /n/sources/contrib/, we can see all the directories of the various Plan9 contributors. By using the contrib(1) command, we can install additional software onto our Plan9 machine.

Additionally, if one visits:

They can see a list of the available software to install.

vim

As an example to illustrate software installation, we will look at the installation of a Plan9 port of vim, so that we'll have a usable means of editing files.

We'll go through the process:

% 9fs sources
% cat /n/sources/contrib/stefanha/INDEX
vim: enhanced vi editor (install using contrib(1)).
% contrib/install stefanha/vim
...
% 

It'll proceed to obtain and build a local copy of vim, at which point (barring any errors), we should have vim installed, and can run it from an available terminal in rio (it needs the graphical environment).

libssh2

Sometimes a program/facility is not available for direct installation via contrib(1). In this case, we have to follow different paths to arrive at our desired destination.

We will look at building a copy of the Plan9-native ssh2 client.

% 9fs sources
% cp /n/sources/contrib/john/libssh2.tgz /usr/glenda/
% cd
% tar -zxf libssh2.tgz
% cd libssh2-release
% cat README
Compiling SSH2 for Plan 9
=========================
Just run the script "RUNME" located in the top level of the archive. This will produce
an executable in the same directory.
% ./RUNME
rm -f *.[56789qv] *.a[56789qv]
libz.a8 doesn't exist: assuming it will be an archive
pcc -c -I. adler32.c
pcc -c -I. compress.c
pcc -c -I. crc32.c
...

libssh2 appeared to fail during compile… I was unable to run the precompiled binary… might be some sort of 386/amd64 issue. Moving on to something else (openssh).

NOTE: pcc is the Plan9 POSIX/ANSI C compiler, a piece of the Plan9 APE (ANSI/POSIX Environment). In this regard, openssh/openssl are not considered native Plan9 applications.

openssh

It appears as though there has been a port of OpenSSH_4.7p1 (openssh) and its prerequisite OpenSSL 0.9.8g (openssl). We will explore the installation of this as well.

% 9fs sources
post...
% contrib/install fgb/openssh
missing dependencies: openssl
% 

Whoops… looks like we need to install openssl first.

openssl

As indicated, we first need to install openssl before proceeding with the openssh installation:

% 9fs sources
post...
% contrib/install fgb/openssl
a 386/lib/ape/libcrypto.a 664 sys sys 1195454963
a 386/lib/ape/libssl.a 664 sys sys 1195454955
...

back to openssh

After installing openssl, I proceeding with my openssh install:

% contrib/install fgb/openssh
a 386/bin/openssh 20000000755 sys sys 1200910695
a 386/bin/openssh/scp 755 sys sys 1200910669
a 386/bin/openssh/sftp 755 sys sys 1200910670
a 386/bin/openssh/ssh 775 sys sys 1200910696
...

To actually run the OpenSSH client:

% cd /386/bin/openssh
% ./ssh wedge@lab46.offbyone.lan
wedge@lab46.offbyone.lan's password:
...
wedge@lab46:~$ who | grep $USER
wedge    + pts/3      2010-10-30 21:31    .      20595 (p9cpuf.offbyone.lan)
wedge    - pts/10     2010-10-30 08:52  00:25    13366 (telstar.lair.lan)
wedge@lab46:~$ 

SUCCESS! Not 100% usable (ANSI colors do not work in the Plan9 terminal), but I can ssh OUT… still can't ssh IN… but then again, that's what drawterm is for.

x11

There appear to be some ports of X11 to Plan9. I'm going to attempt to install the fgb X11:

% 9fs sources
% contrib/install fgb/X11
missing dependencies: freetype z
% contrib/install fgb/freetype
missing dependencies: z
% contrib/install fgb/z
a 386/lib/ape/libz.a 664 sys sys 1195172454
...
% contrib/install fgb/freetype
a 386/lib/ape/libfreetype.a 664 sys sys 1195179341
...
% contrib/install fgb/X11
a 386/bin/X11 20000000775 sys sys 1210053730
...

python

There have been a few ports of python over the years to Plan 9… the latest I have heard of is Python 2.5.1, via bichued's directory, but that no longer appears to be present on the main sources.

I was successful in finally locating it on another Plan 9 mirror (sources.lsub.org), so that procedure is as follows:

cpu% contrib/install bichued/python
a 386/bin/python 775 sys sys 1250390421

cpu% 

hg

With the successful installation of python, I was able to proceed with mercurial:

cpu% contrib/install bichued/hg

cpu% 

drawterm

To connect to this plan9 concoction graphically, using drawterm (happily from my Mac):

telstar:~$ ./drawterm-osx-intel -a p9auth.offbyone.lan -c p9cpuf.offbyone.lan -u glenda

term file access

I just noticed this while exploring the Plan 9 filesystem from my drawterm session… if you go to: /mnt/term

You see the root filesystem of the local system (ie I see / on my Mac). That is freaking awesome. File access instantly.

This adds some interesting considerations regarding the role of the Plan9 Terminal to CPU Server/File Server.

network config

cpu% ipconfig -g gateway ether /net/ether0 ip mask
cpu% 

stats

To get a hold on what's actually going on, I realized that the graphical stats utility one sees during a graphical install can be invoked via the stats command.

Firing this up in an open terminal, you can right click to add/drop various subsystems… I ended up going for a stats display showing load, mem, and ether (during my libssh2 and openssh installs, it was quite telling).

It also dies when trying to show stats on swap if it isn't enabled. So at least I have a good test of knowing if swap is enabled or not.

abaco

To get abaco running, we need to mount webfs (run as glenda):

% webfs -c /usr/glenda/lib/L.webcookies -m /mnt/web
% 

From trial and error, I determined that we don't want to mount webfs on /mnt/webfs, but instead on /mnt/web.

Also, the cookies file is (apparently) needed, and I found glenda already had the L.webcookies file, so I used that.

Heck yeah. Now we can run abaco:

% abaco http://www.google.com/

Web browser goodness!

plan9port

Plan9 from User Space, is a port of the various Plan9 tools and servers to the UNIX environment.

Located here:

Installing

The downloaded archive is a .tgz, which wants to expand into a plan9/ directory. The recommended location to extract it into is /usr/local.

To properly build some of the graphical tools, various X development headers need to be installed. On Debian, that can be accomplished as follows:

unix:~# aptitude install libx11-dev libxext-dev libxt-dev
...

Once those are in place, we'll proceed with the actual build:

unix:~# cd /usr/local
unix:/usr/local# tar -zxf /path/to/plan9port.tgz
unix:/usr/local# cd plan9
unix:/usr/local/plan9# ./INSTALL
+ Mailing list: http://groups.google.com/group/plan9port-dev
+ Issue tracker: http://code.swtch.com/plan9port/issues/
+ Submitting changes: http://swtch.com/go/codereview
 
* Resetting /usr/local/plan9/config
* Compiler version:
        gcc version 4.4.5 (Debian 4.4.5-6) 
* Running on Linux: checking for NPTL...
        NPTL found.
* Building everything (be patient)...
* Installing everything in /usr/local/plan9/bin...        
* Cleaning up...                                            
* Renaming hard-coded /usr/local/plan9 paths...           
* Building web manual...
* Done.                          

* Add these to your profile environment.
        PLAN9=/usr/local/plan9 export PLAN9
        PATH=$PATH:$PLAN9/bin export PATH
unix:/usr/local/plan9# 

Plan9 Mirrors

In the event of the main Bell Labs Plan9 sources resource being down, it would be nice to still be able to access the resources located there, through a mirror.

As it would seem, there do not appear to be that many (still working) Plan 9 mirros as identified on the various Plan 9 wiki pages… but after some googling I found the following:

cpu% 9fs sources.lsub.org
post…
cpu% ns | grep lsub.org
mount  '#s/sources.lsub.org' /n/sources.lsub.org
cpu% 

Unfortunately, not all mirrors mirror the entire archive (nor do all mirrors necessarily have up-to-date archive synchronizations).

Useful links referenced during this endeavor:

I was having a heck of a time getting glenda to be able to write to normal things on the disk… I ended up reinstalling with the 9atom distribution, and things seem to be better.

I'm also running this immediately upon login:

ip/ipconfig
ndb/dns -r

But, I found this page with what looks like some good information:

More google searches keep turning up additional tutorials:

Plan9 on VirtualBox 4

Updates/Sources

For managing Plan9 sources / keeping the system up-to-date:

Kernel Compile

To compile a Plan 9 kernel: