9front CPU server setup

tags: plan9 · tutorials

The contents of /net/ndb will be useful throughout the whole process; have them visible in another window:

; ip/ipconfig
; cat /net/ndb
ip=192.168.1.152 ipmask=255.255.255.0 ipgw=192.168.1.3
	sys=cirno
	dns=192.168.1.1
	dns=192.168.1.1

Boot settings

The 9fat partition contains the kernel, bootloader and boot settings. Add the following lines to plan9.ini. Make sure the values match your own configuration:

; 9fs 9fat
; cd /n/9fat
; cat >> plan9.ini

user=glenda
cpu=192.168.1.152
auth=192.168.1.152
authdom=someauth
service=cpu
^D

user is kinda like the root user on UNIX systems, cpu and auth define the IP addresses for the CPU and auth server respectively, authdom is the domain name of our the server, and service=cpu starts the CPU listener at boot time.

9front needs to boot hands-free, so the bootargs prompt has to be skipped. To do that, change the bootargs variable (its values might be different) in plan9.ini:

bootargs=local!/dev/sdE0/fs
# change to...
noobootprompt=local!/dev/sdE0/fs -m 291 -A -a tcp!*!564

Auth server

Set up the auth server hostowner’s name and password; authid and authdom have to match the values in plan9.ini:

; auth/wrkey
bad nvram des key
bad authentication id
bad authentication domain
authid: glenda
authdom: someauth
secstore key:
password: <your_pass>

Add glenda’s password. This has to be the same as the one you typed in wrkey(8). Always run keyfs(4) before modifying keys:

; auth/keyfs
; auth/changeuser glenda
Password: <your_pass>
Confirm password: <your_pass>
assign new Inferno/POP secret? [y/n]: y
make it the same as Plan 9 password? [y/n]: y
Expiration date (YYYYMMDD or never)[never]:
Post id:
User's full name: 
Department #:
User's email address:
user glenda installed for Plan 9

; auth/enable glenda

Network database

Add the following lines to /lib/ndb/local (pay close attention to detail, especially ip=):

; cat >> /lib/ndb/local

authdom=someauth auth=192.168.1.152

ipnet=iphome ip=192.168.1.0 ipmask=255.255.255.0
	ipgw=192.168.1.3
	auth=192.168.1.152
	authdom=someauth
	fs=192.168.1.152
	cpu=192.168.1.152
	dns=192.168.1.1
^D

ipnet can be anything.

Sync the changes and reboot the system:

; echo sync >> /srv/hjfs.cmd
; fshalt -r

On reboot

Enable networking:

; bind -a '#l0' /net
; ip/ipconfig
; ip/ipconfig ether /net/ether0

Drawterm as glenda:

$ drawterm -u glenda
cpu[cpu]: 192.168.1.152
auth[192.168.1.152]:
glenda@someauth dp9ik password: <your_pass>

Start a rio(1) instance:

cpu% rio -s -i riostart

/cfg/$sysname/cpustart contains commands that run on boot. You can put whatever you want in it — I’m going to just add the same commands I ran after we rebooted to make my life easier.

; mkdir /cfg/$sysname
; cat > /cfg/$sysname/cpustart
bind -a '#l0' /net
ip/ipconfig
ip/ipconfig ether /net/ether0
cat /net/ndb
^D

New user

Add the new user to the file server, add it to some standard groups and assign it a password:

; echo newuser christos >> /srv/hjfs.cmd
; echo newuser sys +christos >> /srv/hjfs.cmd
; echo newuser adm +christos >> /srv/hjfs.cmd
; echo newuser upas +christos >> /srv/hjfs.cmd
; echo newuser cron +christos >> /srv/hjfs.cmd
; auth/keyfs
; auth/changeuser christos
...
; auth/enable christos

Let the new user “speak for” for other users by adding the following lines to /lib/ndb/auth:

; cat >> /lib/ndb/auth
hostid=christos
	uid=!sys uid=!adm uid=*
^D

Reboot for the changes to take effect:

; fshalt -r

Drawterm as christos and run newuser(8) to set up his home directory:

$ drawterm -u christos
...
; /sys/lib/newuser