June 24, 2008

coLinux gets its second wind

Author: Bruce Byfield

Cooperative Linux (coLinux for short) occupies a unique niche in the field of virtualization -- that of running GNU/Linux natively in Windows. Although begun in 2000, the project has only recently released version 0.72, but it has given the underlying technology to several other higher profile projects such as andLinux and Ulteo Virtual Desktop. Now, with the current interest in attracting Windows users to GNU/Linux, as evidenced by such tools as Ubuntu's Wubi and Fedora's Live USB-Creator, the technology behind coLinux seems overdue for a closer look.

coLinux was begun by Dan Aloni in 2000. A first-year computer science student with a background in Windows and a newfound enthusiasm for free software, Aloni became interested in porting User Mode Linux, a project for running GNU/Linux within a virtual machine for testing purposes, to Cygwin, the well-known Unix-like environment for Windows. Called Umlwin32, this project still exists, although Aloni is no longer actively involved with it.

Gradually, Aloni became convinced that "Windows' user space API is not flexible enough for running a native port of the Linux kernel on it." He began researching alternatives, including one that involved compiling the Linux kernel sources under Cygwin to produce a linux.sys file, but abandoned it as having too many problems. In 2003, armed with more knowledge of the Linux kernel, Aloni began coLinux from scratch.

Aloni oversaw the project until September 2005, when he started work for a small startup that was purchased by IBM in 2007. Now working in the storage systems field, Aloni says that, "Being too busy, I currently don't actively maintain Cooperative Linux, but I keep an eye on it." The project is now being maintained by Henry Nestler, although the project's developer page has not been updated to reflect the change.

Although still in beta stage, coLinux is viewed by its developers as having two main audience. First, as suggested by long-time project member Jun Okajima, who describes his interests as "promoting desktop Linux to average people," it "gives an easy step to dive into the Linux world from Windows." Second, it gives experienced free software users access to the GNU/Linux tools they are familiar with from within Windows, in much the same way that Cygwin does.

How coLinux works

Unlike most forms of virtualization, coLinux -- as its name suggests -- shares the system resources of the host operating system via a virtual network. Although coLinux uses three different ways to communicate with the host operating system, the result is much the same in all of them, and, in each case, the process is made simpler by the fact that, being software rather than hardware, changes to the virtual network are much easier to make. The advantage of this cooperative approach is that, unlike with an independent virtual machine or an operating system emulator, a system needs no additional memory for coLinux, and applications run under coLinux with next to no loss of performance.

coLinux works by converting system calls in Linux code to native 32-bit Windows ones. As you might expect, preparing a kernel for this purpose is extremely slow and labor-intensive, and the task must be done again for any new version of the Linux kernel used. Although Nestler estimates that an average of 70% of the conversion of a new kernel can be based on earlier versions, the rest of the version must be done by hand, and "mostly the automated patch utilities do not work." Instead, the work requires reading the comments from the kernel source repository to learn what new features have been added and what changes have been made in the code, such as the addition of new variables.

Running a new kernel for the first time, Nestler says, can be "a very hard step." Because coLinux skips all the boot levels as it starts, finding changes at these levels can be a time-consuming process, and errors that crash the host system are common. Such difficulties explain why coLinux does not have a kernel later than 2.6.17, which was released two years ago. While Nestler's fastest time for converting a new kernel for coLinux was about 10 hours, 2.6.17 required more than a work-month to port -- which, translated into the reality of limited project resources means that it occupied two developers each working five to 10 hours a week for more than two months.

Using coLinux and its derivatives

The coLinux wiki includes some slightly dated instructions on how to convert a standard distribution to run under Windows, with special attention to the difficulties you might face. These instructions produce an operating system with a console but no X server for a graphical interface.

This result may be acceptable for advanced users, but, because of the difficulties of installation and the lack of a desktop, those who are simply curious may prefer another alternative. According to Nestler, a commercial developer tried briefly to market a coLinux installer on a pay-per-download basis, but this option failed to attract much interest. Instead, the curious may prefer andLinux, which is based on Ubuntu and integrates into the existing Windows desktop. Originally developed to run on a Linux-based handheld game console, andLinux has been by far the most familiar coLinux derivative until recently.

However, andLinux's popularity is now being challenged by Ulteo Virtual Desktop. Now in its second beta, the Ulteo Virtual Desktop has received considerable attention, partly because it reduces cooperative virtualization to a task that can be run in a wizard by even a fairly inexperienced user, and partly because the team leader of the project is Gaƫl Duval, the co-founder of the popular Mandrake distribution (now called Mandriva). Even in beta form, it is reasonably stable, although users may experience some lags in response time if they leave a GNU/Linux program unattended for more than a few minutes then return to it.

Future plans

CoLinux is well-established in 32-bit operating systems. However, Nestler explains that Vista 64-bit and Windows Server 2008 x64 have one big problem: These systems accept only digitally signed drivers whose signatures are assigned by Microsoft, and those are next to impossible for a free software project to obtain.

Nestler, though, is philosophical about the problem. "Mostly," he says, "coLinux users are private persons [rather than businesses], and they would not have Windows Server 2008. And, typically, Vista users don't go looking for Linux."

Instead of focusing on the problems of such ports, Nestler is more interested in using the paravirtualization abilities of recent Linux kernels with coLinux, which should make the porting of new kernels easier. Then, Nestler hopes that that coLinux could evolve into "a normal Linux distribution that can be run directly from a CD-ROM installation."

Whatever direction coLinux takes in the future, it is a project that (speaking technically and ignoring the free software objections to running Windows) continues to intrigue. Using coLinux or its derivatives, regular users can have the convenience and faintly illicit thrill of running their favorite GNU/Linux applications from a Windows desktop. Similarly, as Nestler comments, "coLinux is interesting for software developers, because they can look into both sides of very different operating systems."

For a program that, according to Aloni, Linus Torvalds once called "a dirty hack," coLinux seems to be thriving in the niche that it created.


  • News
  • Virtualization
Click Here!