<<

KNOW-HOW Plan 9

The Plan 9 network THE OTHER OS original photo: www.sxc.hu

In the eery, distant days before the birth of , a strange alien sys- tem set out to fulfill the promise of . Descendents of that system are still living. We caught one and dissected it.

BY OLIVER FROMMEL

inux has its roots in the famous and develop Plan 9. The license was lib- install is spartan, but well-organized and AT&T , home of the orig- eralized over the years, and in 2003, more or less foolproof (Figure 1). The in- Linal Unix system. The Bell Labs Plan 9 was finally released under a rec- staller checks the current status after programmers have been busy ever since, ognized open source license. A commer- each step. An image for graphics adapt- and one of the fruits of their labors is the cial offshoot, known as Inferno, is also ers with Vesa mode support is also avail- distributed operating system Plan 9 [1]. available under a free license [2]. able. Plan 9 began in the late 1980s as a We had a look at the current “4th Edi- If you prefer not to experiment with a new system designed to address some tion” release of Plan 9 to see if this leg- full installation right now, you might like problems with Unix that the Bell engi- endary alternative is still alluring. to try your luck with a virtual machine. neers considered “too deep to fix.” This See the “Virtual Plan 9” box for details. new operating system did indeed come Getting Started If you are interested, you can also try out with some innovations that had an influ- The distribution takes the form of a a userspace-only install including Plan ence on later systems. But until recently, 65Mbyte packed ISO image, which is 9’s most important tools [3]. Plan 9 was under a proprietary license also suitable for use as a live CD. If you that never really caught on with users. have difficulty booting from the CD, you More Consistent than Unix Bell Labs and a small community of can check the website for a boot floppy The underlying concept for Plan 9 is that programmers have continued to perfect generator to match your hardware. The it is a distributed operating system, not

56 ISSUE 62 JANUARY 2006 WWW.LINUX - MAGAZINE.COM Plan 9 KNOW-HOW

kernel mainstream vastly simplifies programming models. in version 2.6.14, The underlying model is based on thus removing any Niklaus Wirth’s Oberon [5], which in obstacles to Linux turn draws on the Xerox Cedar system. and Plan 9 interac- Plan 9’s desktop provides a simple pro- tion. gramming model with a file interface and elementary operations. For example, Namespaces a simple cat /dev/screen > output cre- Plan 9 takes this ates a screenshot of an application. In file-based design a contrast to this, the implementation step further with is quite sophisticated: it comprises con- the concept of current processes and threads that call namespaces. Tra- each other reciprocally. ditionally, Unix Rio can be seen as a departure from manages all its re- the legacy, line-oriented terminal model sources in a single that harks back to the days when print- Figure 1: The so-called graphical installation displays the system load namespace, in ers really did echo user input. Linux still and a log window below the text-based menu. The tool suggests the which /dev/tty1 has residual traces of this line-oriented four required partitions. always represents heritage in the form of the many termi- the same terminal. nal window applications, from Xterm to like Unix, where network functionality is In contrast to this, Plan 9 applications the KDE console. This makes it possible added by mechanisms such as remote have their own namespaces, so that to enter input at any position in a win- login and networking filesystems. In /dev/window will always point to an ap- dow: users simply select a command Plan 9, networking is built into the foun- plication’s own window. and use the mouse to execute. As an ad- dations of the operating system. For ex- Union mount is another important fea- vanced , Rio makes ample, all resources can theoretically be ture. The union mount feature helps heavy use of any mouse buttons you distributed transparently across a Plan 9 simplify the management of resources have available. network. The system hides the fact that such as files and directories by mounting The program is an unusual mix resources are non-local from the user. multiple directories in a single directory. of shell, editor, and windowing system. Plan 9 not only supports file servers, but This makes it possible to mount directo- Acme follows the principle we just out- also authentication servers and CPU ries with executables on the file server in lined but adds elementary menus to ter- servers. You can use Plan 9 to implement the local /bin directory, which removes minal windows and redirects output to grid systems such as 9grid. the need for typical PATH variable tricks. new subwindows (Figure 2). An X11 im- Plan 9 is based on the Unix paradigm Linux just recently adopted this design plementation of Acme, dubbed Wily, is that “Everything is a file.” Due to the with the overlay , Union-FS. based on the 9lib library [6]. huge collection of add-ons, Unix was in- Despite its advanced age, Rio can also creasingly forced to accept ad-hoc Graphics with Rio handle multi-language programs, as it changes that contravene this original In contrast to X11 on Unix, Plan 9 di- relies on Unicode character sets. Plan 9 principle. One example of this is the rectly integrates a GUI desktop, and this uses UTF-8 encoding, which was actu- ghastly socket interface, which uses read and write functions that are different The Name from normal files. Plan 9 puts an end to Plan 9 derives its name from the title of a It is interesting to consider whether Bell this, providing file-based system inter- cult trash film “Plan 9 from Outer engineers chose the name because they faces, for example, /net/tcp and /net/ Space,” by the genial Hollywood felt they were resurrecting the mortal re- udp, as network interfaces. dilettante, Ed Wood. According to the mains of Unix to attack the world. The Most system services follow the server FAQ [8], the name upholds the Bell Labs’ tantalizing similarity of "Solaranite" with principle and interact via file-based in- tradition of “selecting names that make "Solaris," another enemy weapon that terfaces. Plan 9 does not have the usual marketeers wince.” derives its power from a different Sun, FTP program. Instead, the ftps server In the film, which is often considered is perhaps stretching the metaphor, al- mounts the directory in /n/ftp on the Wood's greatest contribution to cinema, though the first versions of Solaris ap- server. The 9660fs server is responsible a pair of aliens launch a plan to resurrect peared when Plan 9 was in early devel- for mounting CD ROMs. Plan 9 was one dead people and create an army of opment. of the first operating systems to imple- zombies that will attack the capitals of Other Plan 9 names also contain refer- ment the Proc filesystem to support file- the Earth. The purpose of this gruesome ences to pop culture, such as the Acme based process control. Basic network mission is to stop humans from com- editor, named for the company in the functionality is provided by the Plan 9 pleting their work on the Solaranite, an Warner Brothers Roadrunner cartoon. file protocol, , which comprises about exotic weapon that will "explode the par- The old windowing system was known ticles of sunlight" and destroy the uni- as 8 1/ 2, based on the name of a Fellini 30 protocol messages. A Linux imple- verse. movie. mentation [4] of 9P was added to the

WWW.LINUX - MAGAZINE.COM ISSUE 62 JANUARY 2006 57 KNOW-HOW Plan 9

ally invented by the Plan 9 programming team led by . Security Plan 9 does not have a root superuser, and thus it does not have the kind of SUID programs that have caused no end of security problems on Unix. Following a similar approach to Kerberos, a distrib- uted Plan 9 system does not transmit passwords over the wire but uses en- crypted tickets instead. One way to cre- ate a user account, is to enable the Fossil fileserver by entering con /srv/fscons, and then give the uname user user com- mand. New users can initialize their en- vironments the first time they log in by entering /sys/lib/newuser. Of course, Plan 9 has developer tools for the programming language. The compiler for the x86 architecture is titled 8c, the linker is 8l, and the build pro- gram is mk. To compile a new kernel Figure 2: A Plan 9 system in action. A multiply-tiled Acme editor window is hiding behind the with these tools, the sysop changes the mascot, Glenda, as is evidenced by the menu items: New, Cut, Paste, and so on. directory to /sys/src/9/pc and edits the corresponding configuration file, which able online and in the Plan 9 Wiki. Un- which continues to work hard on devel- can be named differently depending on fortunately, a lot of changes were intro- oping Plan 9, fights a constant battle the environment: in the simplest of duced with the 4th Edition, and this against the lack of resources. cases, this is pc; pcauth is an authentica- makes some of the information obsolete; The fact that Plan 9 has not achieved tion server, pcf a Fossil file server, and so so make sure you check the version widespread distribution thus far can cer- on. After configuring the kernel, the number. tainly be attributed to the previous li- admin can compile and install by giving Despite the fantastic design, Plan 9 is censing policy, which prevented unhin- the mk CONF=pcf install command. not perfect. For example, Rio 9term win- dered distribution. Today, Plan 9 is far The kernel has to reside in the 9fat boot dows often fail to scroll properly and less interesting for developers of free partition to boot; the partition is enabled will not show you the text passages you software, as Linux gives them an operat- by entering the 9fat: command. This is need. Acme is less buggy. The whole ing system that works well, despite drag- also where the boot configuration file, system is based on a GUI desktop, and ging a lot of legacy Unix ballast around plan9.ini, resides. many functions are simply not available with it [7]. ■ at the text-based console: one example is Not All that Glitters the ability to quit processes by pressing INFO The manpages provide documentation the [Del] key. Another issue is the fairly [1] Plan 9: for tools and approaches; they are avail- small user community, Comp.os.Plan9, http:// www. cs. bell-labs. com/ plan9dist [2] Inferno by Vita Nuova: Virtual Plan 9 http:// www. vitanuova. com If you don’t want to sacrifice a primary Kqemu. Qemu can boot directly using [3] Plan 9 from Userspace: partition to Plan 9 at this stage, you can the Plan 9 ISO image download. First http:// swtch. com/ plan9port use various emulators for your experi- create a disk image with the qemu-img [4] V9FS for Linux: ments. The easiest way is to use VM- command, then boot from the ISO: http:// v9fs. sourceforge. net ware; the Plan 9 site even has a ready- qemu-img create plan9.img 2G to-run image for you. This removes the [5] Oberon: http:// www. oberon. ethz. ch need to install; just download the image, qemu -cdrom plan9.iso -boot d U [6] Acme clone Wily: plug it into the virtual machine, and -hda plan9.img http:// sf. net/ projects/ wily boot. However, the image will only run After you complete the install, which [7] Eric Raymond on Plan 9: on VMware 4. Plan 9 will not run at all on could take a few hours, qemu -boot c http:// www. faqs. org/ docs/ artu/ plan9. VMware 5, according to the developers. plan9.img will boot the new system. html Instead, the developers recommend the Alternatively, there is a DVD image at [9] [8] Plan 9 FAQ: http:// www. cs. bell-labs. free PC emulator Qemu, which is almost by Xenoppix, a variant which com/ wiki/ plan9/ FAQ (but not quite) as fast as VMware with integrates the Xen Virtual Machine Mon- [9] Xenoppix: http:// unit. aist. go. jp/ itri/ the non-free kernel accelerator module, itor and can boot NetBSD and Plan 9. knoppix/ xen/ index-en. html

58 ISSUE 62 JANUARY 2006 WWW.LINUX - MAGAZINE.COM