Plan 9

Glenda, the Plan 9 Mascot

Plan 9 from Bell Labs is a research OS family, created at Bell Labs by many of the same people who created Unix, like Ken Thompson, Dennis Ritchie and Rob Pike. Its distinguishing features include the use of files with the 9P protocol for most, if not all resources in the operating system (including graphics), and private namespaces, where each process can have a different view of the file system. Interest in Plan 9 stems out of curiosity, admiration and idealism.

History and philosophy

Plan 9 is fundamentally an operating system created to address the practical use of the Unix system since it left Bell Labs, especially in the commercial setting. The world had changed since the days of Research Unix, and graphics and networking had become monumentally important in the computer space. Organisations outside Bell Labs shaped the development of Unix, with the adoption of sockets from BSD and the X Window System from MIT that bent and twisted the "Unix philosophy".

The developers of Plan 9, then, set out to develop a new operating system for research, exploring areas such as distributed computing, naturally graphics and networking, and heterogenous access to system resources. While Plan 9 is not Unix, it is to an extent Unix-like, and feels rather like the later versions of Research Unix after the flight of Unix outside of Bell Labs (and even has some of the features of those later Research Unix releases).

Licensing

The first and second editions of Plan 9 were only available to universities, for an exorbitant fee in book and CD form. The third edition of Plan 9 was released under the Plan 9 Licence in 2000, which Richard Stallman considered non-free. The fourth edition was released under the Lucent Public Licence in 2002 which the FSF does consider free but not GPL-compatible, along with the distribution becoming openly developed and updated daily. In 2014, Plan 9 was relicenced under GPLv2 for the University of California, Berkeley's Akaros operating system (to much distaste).

This author interprets the licence situation of Plan 9 to be dual licensing under both the Lucent Public License 1.02 and the GNU General Public License 2. You may be able to guess which license the community prefers.

There is a perception in the Plan 9 pommunity that it was due to the prohibitive cost and later licence confusion that Plan 9 made much ground commercially.

Distributions

9front is at the forefront of Plan 9 Ontologically-Oriented Technology, including new advancements such as better hardware support, audio, wireless networking and new programs like NES, SNES, Game Boy, GBA and Genesis emulators and a paint program. If you want to run Plan 9, this is probably the way to go. Most of this article assumes you are using 9front.

Concepts

Graphics

Graphics is considered ubiquitous in Plan 9, and while Plan 9 features the ancient and revered Unix toolkit (awk, grep, cat), it is therefore not plausible to use without graphics.

Plan 9's graphical shell is called Rio. (How to use Rio follows shortly.) The way Plan 9 abstracts graphics hardware is through offering drawing surfaces as character files. Applications write to this file with drawing commands usually using libdraw. Rio uses the top-level surface to draw to the whole screen, and each new Rio window creates a new drawing surface, and using private namespaces, provides that surface to applications in the same way. You can test this by running a graphical program when Rio is not active, which draws to the entire screen, and by running Rio inside a Rio window.

Mouse chording

Mouse chording is common to Rio and Acme, the development environment.

The distributed Plan 9 environment

Plan 9 networks generally consist of three classes of machine:

Note: 9front adds a fourth class, the auth server. This is where security keys and user account information (not files) are stored.

The concept of network transparency was one of the most important factors in the design of Plan 9. You should be able to feel as if your terminal and the CPU server you have just logged into are the same machine and are accessing the exact same resources, instead of being completely abstract environments as happens in Unix-like operating systems with SSH. Usually however most single Plan 9 installations are a combination of file server and terminal.

If you wanted to use Plan 9 as a server (bearing in mind that performance will be a lot worse than Linux or BSD) the closest analogue would be a file server or CPU server backed by a file server.

Everything is a file

The grand abstraction of Plan 9 is that everything is shown as a file. Files are written to using the 9P protocol that is network-transparent, meaning also that all file I/O is network-transparent. 9P is also the protocol for remote connections.

Programs

It should be noted there are few choices of software for Plan 9, maybe owing to lack of users but also to how good the software actually is.

Web browser

Two feasible options for web browsing exist on Plan 9:

Text editor

Both sam and acme are available in plan9port. A port of Vim to Plan 9 and Rio may be found in the contrib tree.

E-mail

Use nedmail or acme mail to read your e-mails from upas.

The rc shell

Plan 9's default shell is the rc shell, designed by Tom Duff. It's constructs are similar to Unix's Bourne shell but are somewhat syntactically different. The most important thing to get around in your head is how programs in subdirectories of /bin (where many different directories are bound, making the use of a $PATH variable redundant) are executed. The programming environment Acme is placed directly in /bin, so a simple

% acme

will do. Now, this is a rather contrived example, but let's assume we have a new disk and we want to run fdisk(8) on it.

% fdisk

won't work, because fdisk is actually in /bin/disk/fdisk (it's probably really in /386/bin/disk/fdisk). So you would need to run

% disk/fdisk

A better example is if you cannot wrap your head around rc, and you really want your curmudgeonly Unix-like shell, you should run

% ape/sh

because sh is in the ape (ANSI POSIX Environment) folder.

rio

Rio is the Plan 9 windowing system. New users are often confused by Rio's spartan design, grey default background and sometimes the lack of window titles (although if they have used something like cwm or dwm before, they should be fine). Here is a quick list of things you should know so that you can survive in Rio:

Rio has been imitated by an X11 window manager of the same name, which is included in plan9port.

How to

Shut down

Shut down the file server, which in practice should be the machine Plan 9 is running on, using the fshalt(8) command. After you have issued fshalt, turn off your computer's power some other way (hit the switch or hold down the power button), unless you have ACPI enabled as shown below, in which case the machine should shut down. Restarting does work on presumably all machines.

% fshalt -r

Edit boot configuration

On x86-like processors, the Plan 9 bootloader reads instructions on how to boot up from the 9fat partition at the start of the disk. In the 9fat partition is a file called plan9.ini which contains these instructions. An example plan9.ini could look like this:

bootfile=/386/9pcf
bootargs=/dev/sdE0/fscache -C
monitor=vesa
vgasize=1024x768x32
mouseport=ps2

These should be mostly self-descriptive. For more information, see plan9.ini(8)

To mount 9fat and edit plan9.ini, mount it using the 9fs utility.

% 9fs 9fat

The 9fat partition will be mounted under /n/9fat/ in the namespace of the shell you ran 9fs in. Simply edit /n/9fat/plan9.ini with your preferred editor. Remember that it must end with a blank new line.

ACPI

ACPI is supported only by 9front and is not enabled by default. To enable it, add *acpi=1 to plan9.ini as shown above, and reboot. When fshalt is run, scram(8) should also be invoked and shut the machine down cleanly.

Further reading

A Narrated Short Demonstration of the Plan 9 system

This article is issued from Installgentoo. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.