wm: doc

ref: aaeb28aa8e5cf5a9fb58b4525d724ad4661f5abd
dir: /cpu-p9.ms/

View raw version
Configuring the cpu server for plan 9

First add your user to the adm group. See fossil-p9.

Afterwards, set your timezone, see timezone-p9.ms.

Next, make sure to configure your network information. See ndb-p9.ms.

Now, we prepare rc scripts that must run on system bootup:

term% mkdir /cfg/$sysname/
term% dircp /cfg/example /cfg/$sysname/

Now, we need to configure networking:

If you have static networking (eg, you have a virtual private server),
edit /cfg/$sysname/cpurc to uncomment this line:

ip/ipconfig -g your-gateway ether /net/ether0 your-ip-address your-subnet-mask

If you are using wifi and dynamic networking, you may need to add these lines:

bind -a '#l1' /net
echo 'key proto=wpapsk essid=ESSID !password='^`{cat /lib/wpa/ESSID} > /mnt/factotum/ctl
aux/wpa -2 -s 'ESSID' /net/ether1
ip/ipconfig ether /net/ether1

Replace ESSID and make sure to store the wifi password in /lib/wpa/ESSID.

Note: You may also want to copy these lines to /cfg/$sysname/termrc and also to run the
command manually, because by default, plan 9 runs as a terminal service. It will not
run as a cpu service until the cpu kernel has been compiled as described below.

Note: You *must* run ip/ipconfig before running ndb/dns (and possibly other
network services). Otherwise, you might see errors like:

ndb/dns: can't read my ip address

term% auth/wrkey
bad authentication password
bad authentication id
bad authentication domain
authid: glenda
authdom: example.com
auth password:
secstore password:

Make sure to configure the auth server, see auth-p9.ms.

Build the cpu kernel for x86:

cd /sys/src/9/pc
mk 'CONF=pccpuf'
term% 9fat:
term% cp /sys/src/9/pc/9pccpuf /n/9fat/
Add these lines to the beginning of /n/9fat/plan9.ini

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

[cpu]
bootfile=sdC0/!9fat!9pccpuf

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

[common]
nobootprompt=local!#S/sdC0/fossil

Make sure to replace sdC0 with your actual disk.
Make sure also to delete the pre-existing line:

bootfile=sdC0!9fat!9pcf

Clear nvram and then set a new password:

term% echo garbage >/dev/sdC0/nvram

Remember to replace sdC0 with your actual hard disk.

Set the password:

term% auth/keyfs

Add the hostowner bootes to sys and adm groups:

term% con -Cl /srv/fscons
prompt: uname bootes bootes
prompt: uname sys +bootes
prompt: uname adm +bootes
prompt: fsys main
main: create /active/cron/bootes bootes bootes d775
main: create /active/sys/log/cron bootes bootes a664

Append these lines to the bottom of /lib/ndb/auth:

hostid=bootes
       uid=!sys uid=!adm uid=*

You may need to reboot and login as hostowner (bootes) in order for
the next step to work.

If you do reboot, select 1 for Plan 9 CPU Kernel:

Plan 9 Startup Menu:
====================
    1. Plan 9 CPU Kernel
    2. Plan 9 Terminal Kernel
Selection[default==1 (10s timeout)]: 1

When prompted, fill in the following values:

authid: bootes
authdom: example.com
auth password:
secstore password:

Change the hostowner's password:

term% auth/keyfs
term% auth/changeuser bootes

If you are using 9front drawterm and want to connect in text-only mode
(no graphics) with the -G flag, you will need to edit $home/lib/profile
to remove calls to rio. Comment out line 31:

#		exec rio

You can run the below command:

term% mv (/usr/$user/lib/)^(profile profile.bak)
term% sed '31s/^/#/' /usr/$user/lib/profile.bak > /usr/$user/lib/profile

Then afterwards, you will be able to connect with drawterm -G as
follow:

$ drawterm -u $USER -h $SYSNAME -G

See also:

https://plan9.io/wiki/plan9/Configuring_a_Standalone_CPU_Server/index.html
https://9p.io/wiki/plan9/Drawterm_to_your_terminal/index.html
http://mirror.9grid.fr/mirror.9grid.fr/plan9-cpu-auth-server-howto.html