coLinux
Advertisement

<Gniarf> coLinux For Dummies is a not-so-technical guide on how to get started with coLinux. Beginners only.


So, what is coLinux?

coLinux is a piece of software that allows you to run the Linux kernel in Windows 2000 or posterior versions.

So, why would I want it ?

Since the Linux kernel runs the rest of a Linux system, you will end with the ability to run most software you would find on a GNU/Linux system, including X applications. Yes, with the exception of a few applications (multimedia and 3D games), you will be able to run almost everything from Apache to Zope, including perl, php, mysql, postgresql, Gnome, KDE, XFCE, Mozilla, Firefox and OpenOffice. Yes, really.

Why coLinux and not Xming or Cywgwin ?

Some one please edit and explain this.

So, do I need to know Linux first ? do I need Cygwin ?

No, you don't. But it will help you a lot in :

  • not being disappointend in the end result : a DOS-ugly console for a little while
  • understanding most of the technical instructions you will find in this quick guide and others
  • not being discouraged by the slightiest problem you would encounter.

Call it Zen if you want, but you need to be in the right spirit or you will waste your time.

So, what do I do now ?

You need to install coLinux in a directory without space in its path : so c:\colinux or d:\prog2\colinux is ok, but c:\Program Files\coLinux is NOT ok. (ok, actually in later versions, it seems ok. never mind.)

If you uninstall then reinstall it in a proper place, you may have to type the following, due to a entry in the registry :

colinux-daemon.exe --remove-driver
colinux-daemon.exe --install-driver

If you don't have downloaded one of the proposed images, do it now.

The extension of the images is .bz2, for bunzip2, so you need a decompressor that understand this format. one comes with Cygwin.

Next you have to edit the coLinux configuration file : make a copy of default.colinux.xml, edit the entry to :

<block_device index="0" path="\DosDevices\c:\coLinux\image_fs" enabled="true" />

where c:\coLinux\image_fs is the image you just downloaded and uncompressed and the path to it. for instance, gentoo-i686-ext3-1gb.bz2 becomes c:\coLinux\gentoo once uncompressed and renamed to a more sane name.

Forget about everything else now, including the network : later, later.

open a command prompt (cmd.exe), and go to the directory where you installed coLinux then enter :

colinux-daemon.exe -c your.colinux.xml -t nt

or edit a batch file (.bat) in this directory with the same command. yes, clicking blindly on the .exe will not work.

coLinux should start now, in a console. after a few seconds, text will fill the console, hopefully ending with a 'login' prompt. enter 'root' then nothing (no password). on some images, you may have to use 'root' or 'colinux' as the root password, but I know of only one where you need to do that. (ok, actually both recent official images for coLinux (Debian & Gentoo) do need 'root' as the password for root. some stupid security measure prevented the images to be packaged and shipped with blank password).


now you can type Unix commands and enjoy the promised Linux-on-Windows miracle. To end the session, shutdown the virtual machine by entering one of the following :

  • halt
  • poweroff
  • shutdown -h 0

So, if it doesn't ?

then take a look at the following.

  • check the path to the uncompressed filesystem image
  • in the line with
<bootparams>root=/dev/cobd0</bootparams>

add ro before root :

<bootparams>ro root=/dev/cobd0</bootparams>

and be ready to remove it if it doesn't help. you can keep it, it is harmless in most cases (some distributions need it)

  • finally, take a close look at your text editor. there are some chances that it silently converted the text to UTF-8 and add a invisible marker at the beginning of your configuration file : switch to hexadecimal mode or to another editor and check the top of the file. if so, erase this marker.
  • in case of a error similar to
daemon: exit code 84a08401
daemon: error - CO_RC_ERROR_ERROR, line 33, file colinux/os/current/user/file.o

redo the following dance :

colinux-daemon.exe --remove-driver
colinux-daemon.exe --install-driver

I did, but it didn't help (same error as before). Whats the reason? --> Check your parameters in config-file. Any filename for image, path to vmlinux or swapfile was wrong or don't exist. Comment out all not needed parameters to find the wrong entry in XML file.

So, now what ?

You can take a quick look at the

<memory size="64" />

line and adjust it to fit your system. This is the physical amount of RAM you are going to allocate to coLinux, and you need to keep some to Windows.

  • if you have 128 Mb of RAM or less, don't bother with coLinux. ok, use 32 Mb...
  • 160 to 256 Mb of RAM : put the value 64 Mb
  • 256 to 512 Mb of RAM : you can increase to 96 Mb
  • 512 Mb and more : you can use 128 Mb or more if you want.

those values are based on personnal experience, your mileage will vary.

Oh, if you want, you can also tell coLinux your keyboard is not US with a command line like loadkeys fr-latin1.

Then you have to configure the network. This is not strictly necessary to enjoy coLinux but you need it to :

  • download new software : the image you downloaded contains only a basic system, much like a bare Windows installation.
  • use ssh and PuTTY, a nice terminal since you will feel the console too unconfortable.
  • launch X applications and run VNC and see the results on your Windows screen.

So, how do I configure the network ?

Uh, sorry. This is the hardest part, or actually, it will be here that you encounter the most variety of combinations, and it can be very simple and work at once, or be very confusing. but mostly, this is a Windows configuration issue. not our fault if their configuration tools are so messy and if Windows can't do some quite simple things.

Since it can fill several pages of text, go look for hints on another Wiki page.

Once this is done, you can update your coLinux system and install new software. but first you may have to configure either /etc/sources.list or run mirrorselect, depending on the image you are using.

So, I got apt-get or emerge running, what is next ?

Installing the ssh server is often obvious but you must add another user to you system, and give it a password :

adduser mynewusername
passwd mynewusername

no space, no capital or accentued letters, and actually shorter than that. 'colinux' as a user name is ok.

Q: I get the following error when logging in with PuTTY:
"server unexpectedly closed network connection"
The error occurs when I press <enter> after typing in my password.
Anyone have an idea why?

This is a problem of the Debian rootfs that we use. I could solve this with:

"apt-get -u -o APT::Force-[[LoopBreak]]=true install libgcc1"

sshd was missing libgcc_s.so.1 that is inside libgcc1. You can see this when you run sshd in debug-mode ("sshd -d") There where some dependency problems. I could solve them with:

cd /var/cache/apt/archives
dpkg -i --force-all sysv-rc_2.86.ds1-14_all.deb 
dpkg -i --force-all sysvinit_2.86.ds1-14_i386.deb 
dpkg -i --force-all initscripts_2.86.ds1-14_i386.deb 
dpkg -i gcc-4.0-base_4.0.3-1_i386.deb 
dpkg -i libgcc1_1%3a4.0.3-1_i386.deb 

after that:

/etc/init.d/ssh restart

works! (or use different rootfs)

So, ssh is running too, where is my GUI ?

Installing X is a bit more complex. Don't fear, you don't have to actually configure it, because coLinux will make it run without accessing the video card. (and remember, Windows is already using it.)

The lazy way I recommend to new users is to tell the package manager (apt-get, emerge, yum, urpmi) to install xterm : all dependancies will be taken care of.

Next you can ask to install Gnome or KDE by asking for kdedesktop for instance.

HINT : now I will stress out that on a pratical side, Debian will provide you with precompiled, ready-to-run software, while Gentoo will need to recompile the new software you will want to run : it can take a few hours to build KDE and its dependancies. so, hint hint, stick to Debian woody for today.

now, to test xterm :

export DISPLAY=192.168.0.1:1
xterm &

assuming Windows is using 192.168.0.1 and the X Window server is listening to display 1.

oh, you need a X server. you can use Cygwin X Server, Xming from http://sourceforge.net/projects/xming, or X-Deep/32 from http://www.pexus.com (freeware).

So, you told me about VNC, I already know about VNC ?

With VNC, you don't have to run the X server on the Windows side, and you get a view to the full Linux desktop. Also, some applications will feel more responsive due to some arcane reasons (menu refresh, the pango library...)

You need to install a VNC server. Its name is often obvious. You don't need a client on the coLinux side (but one on the Windows side, of course) or most other tools named 'vnc'. Just the VNC server.

now go to the home director of the user that will be exporting its display via VNC and edit the file called xstartup in the .vnc directory (create it if needed). adjust its priority to executable via chmod a+x

Now edit it with the following content :

#!/bin/sh
startkde &

(startkde or startxfce or gnome-session or something else, depending on your window manager)

then run

vncserver :1 -depth 16

to start the VNC server, then

vncserver -kill :1

to stop it.

Use coLinux ip and this :1 (display number) when asked in your VNC client running in Windows. example : 192.168.0.40:1

So, what are the next steps ?

hey, you already did a lot. or actually, you did read the whole page before doing any actual manipulation. good, very good. what you can do next :

  • do backup of your coLinux images once coLinux is stopped.
    • just copy the relevant file, yes, it is big
    • but you can compress it
  • increase the size of your filesystem image, up to 4 Gb and more on NTFS
    • by using a dedicated tool
    • or moving to a bigger, empty one
  • configure coLinux to use swap (another plain file in Windows)
  • use native partitions where a native Linux system is already installed
  • do your own images of other Linux distribution from various sources
  • rebuild coLinux from within coLinux

the three last items are what would be considered as elite levels of expertise in coLinux usage. contributing to coLinux source code gives you god level.

one important bemol : since you just installed a GNU/Linux operating system, you now need to learn about Linux in general and your distribution of choice in particular. coLinux works so great that it is already out of the picture.

Appendix

Hey, shut up and gimme your .xml file !

ok, so I installed colinux in c:\coLinux_0.6.2 (because I got 5 other versions), and I store all my .xml files in c:\colinux_0.6.2 and my image files in c:\colinux : you can store everything in one directory, though.

here is a typical .xml file, woody.colinux.xml stored in c:\coLinux_0.6.2 :

<?xml version="1.0" encoding="UTF-8"?>
<colinux>
    <block_device index="0" path="\DosDevices\c:\colinux\woody_fs" enabled="true" />
    <block_device index="1" path="\DosDevices\c:\colinux\swap_device" enabled="true" />
    <block_device index="2" path="\Device\Harddisk2\Partition2" enabled="true" />
    <bootparams>ro root=/dev/cobd0</bootparams>
    <image path="vmlinux"></image>
    <memory size="128"></memory>
    <network index="0" type="tap"></network>
</colinux>

and I run it from woody.bat file containing the following line :

colinux-daemon -c woody.colinux.xml -t nt

here woody_fs is Debian-3.0r0.ext3.1gb.bz2, uncompressed and renamed. swap_device is a file from http://gniarf.nerim.net/colinux/swap/ and \Device\Harddisk2\Partition2 is a native Linux partition on another disk. (/dev/hdc2, but don't trust the numbers). the network line may look different, too, if you are not using TAP.


MassTranslated on Sun Apr 23 17:35:45 UTC 2006

Advertisement