Inferno OS Wiki

plan 9 tutorial[] Зеркало MagmaSoft

* Plan9Tutorial

* Login


1. Plan9

[ Plan9] is an operating system designed by developers at Bell Labs.

Although Plan 9 derives from Unix it uses a different approach, and is not compatible with Unix like Operating Systems.. Commands differ, the internal workings differ, setup, configuration and maintenance differ.

See the [ Plan9 Homepage] for lots of Talk about this.

2. About this Tutorial

This Tutorial walks through setup and configuration and maintenance tasks of a Network of Plan9 machines, taking into account the most recent kernels and tools (at the time of writing, of course).

A rather good understanding of computers and operating systems is required, you should at least know Linux or any other Unix like operating system from the point of view of a Systemadministrator.

I have put it together while figureing out things out for myself. The main source of information have been the excelent manual pages of Plan9 as well as the papers, all found on the Plan9 [ homepage].

There are two intended modes of reading:

Newcomers: should be able to read and execute this tutorial from top to bottom and find themselves left with a working Plan9 network  Recidivists: should find it easy to encounter the bits and pieces of information they always wanted to have in one place 

While following the steps, one should be able to copy and paste the given examples (with shaded background) either directly to the target system, or, as I do often for the Xen/textonly installations, copy them to an open editor window of the host operating system, modify what needs to, and copy and paste from the editor window to the Plan9 console or terminal.

Since this is a [ Wiki], the whole tutorial is made up of single Wiki pages containing just the information of a certain context, and can be accessed directly. Find here the list of pages of the tutorial:


3. A Plan9 Network

in Plan9 (almost) any resource can be on another machine in the Network so, there are several roles a machine can take:


Every end user is working with a terminal. A terminal machine has mouse, keyboard and a graphics display. It needs not have a hard disk, since files can be provided by a fileserver. The program drawterm simulates the behaviour of a terminal under other operating systems thus can be used as a terminal too.  fileserver: the name is ambiguous, since a fileserver really is a program serving files either locally or via the network. As a machine, a "fileserver" runs a fileserver, thus providing its disk space, to other computers. Mainly: space for the user to store data as well as the program files the user is executing.

There can be several "fileservers" in a network, and a user will surely use external fileservers like for example the [ Plan9 sources] fileserver.  cpuserver: programs can be executed either locally or on a cpuserver; also processortime is a shared resource to Plan9. There can be several cpuservers in a Plan9 Network.  authserver:

A Plan9 network is "hold together" by an authserver. This is a program which authenticates users of an authentication domain via the network. For security reasons it is recommendable to run the authserver on a dedicate machine, which would then be the "authserver". So in one Plan9 network there is just one authentication server. In practice the authentication domain will be a string the same as the DNS domain of the network, or a subdomain of it. 

4. Kernel types

File, cpu and authentication server normally don't need a mouse, keyboard, and display, since they should be left alone and are probably locked away in a serverroom.

The Plan9 kernel can be (re)compiled to accomplish the different tasks described in "A Plan9 Network", as well as with the drivers needed for a certain hardware configuration. Thus the kernel size is kept small and more space for user processes is left.

There is a distinction between "cpu" and "terminal" kernels:


at bootup a terminal kernel asks for a username. This user will be the hostowner until the next reboot. If any resource on the network which requires authorization is accessed, authentication against the user with the same name in the authserver is initiated. BR It is often handy to have a terminal kernel around even on cpu machines for administrative and maintenance tasks, because you can become any user without being asked for a password.  cpu: a cpu kernel reads the username (an password) of the hostowner either from nvram, or from a 1 block partition on the harddisk which is used to simulate the nvram. Thus the cpu kernel can startup without user interaction. 

During the boot process an initial rc script is run. On a terminal kernel it is looked for at /rc/bin/termrc, on the cpu kernel in /rc/bin/cpurc

Include(Plan9Tutorial/SetupConsiderations, 'Setup Considerations', 1)

5. Os Installation

You will (obviously) have to install Plan9 on several computers. For this you have several choices:

* Install on a dedicated hardware: o

See the [ official installation instructions]  * Installation under Qemu o

./QemuInstall  * Installation under Xen o


After this you can proceed with the network setup.

If you are using Xen instances - which do not provide a grafical environment, you will want to connect to your Plan9 computers via [ drawterm] which runs under Linux, OsX and Windows.

6. Setup of different Services

Include(Plan9Tutorial/AuthServer, 'Authentication Server', 2)

Include(Plan9Tutorial/FileServer, 'CPU & Fileserver', 2)

6.1. Connecting with a Terminal

* TODO: there are several forms how to get to a terminal, e.g. installing Plan9 under Qemu. However I'd like to facilitate a prefabricated Qemu-Term kernel and setup, which doesn't need the setup CD then. TODO: termrc and especially /lib/ndb/* setup for the terminal 

6.2. Secstore

There are essentially two tasks to set up and fill a secstore for a user:

* creating the secstore user on the authserver with an "administrative" account * creating a (factotum) file on the secstore as the secstore user 

The first step has already been done for the hostowner user of the authserver. We repeat the command here for reference, you must be logged in as the hostowner on the authserver: