coLinux
Advertisement

This is a long guide on how to get coLinux up and running in a graphical UI (KDE). The goal is to get an X-Server running in coLinux, and connect to it using VNCViewer from Windows. What you normally need:

  • coLinux
  • Debian distribution (only 18 MB)
  • extra packages from the Debian website
  • VNC client, VNCViewer from realvnc.com

This installation assumes that you have a dial-up connection to the internet, Windows 2000, and a standalone PC (without a network). It might be simple to get it working with other connections to the internet, by changing the properties of an ethernet card (if you're using a cablemodem or ADSL) instead of the Dial-up adapter.

coLinux 0.6.1 and XP SP2 with PAE

Version 0.6.1 has an issue with PAE, which is enabled by XP SP2 (it implements DEP/NX, which activates PAE as well). If you want to use 0.6.1 with XP SP2 disable DEP/NX, by changing the switches into
/noexecute=AlwaysOff to your boot.ini BEFORE you install coLinux 0.6.1.
/PAE can leave on.

This might apply to coLinux 0.6.2 too (FIXME: verify that claim) (Windows XP SP2 machines yielded very different results for me. The main machine I had been working on would reboot if I attempted to run coLinux without the bootflags. The other machine operated perfectly fine without them and would start coLinux without a hitch. The hardware was very similar but apparently different enough - the troublesome machine's behavior continued after a fresh install of XP. -- asmclean)

"AlwaysOff" needs also for all current coLinux version with very new Intel-CPU and hardware support for noexecute, see more: NoExecuteDEP.

Execute coLinux installation

To start, download two packages from the coLinux site. One must be the latest coLinux system (coLinux-0.6.1.exe) and the other one your actual file system, a pre-installed GNU/Linux system. We'll use the Debian system for the purpose of this guide.

With version 0.6.1, installation is easier than ever. Download and run coLinux-0.6.1.exe. The tap device and everything else will be taken care of. During the installation, download the Winpcap_3_0.exe file from http://www.winpcap.org/install/default.htm. Version 3.1 beta doesn't work for me (no network connection with my Windows box). Version 3.1 of winpcap should work for colinux 0.6.2 and above (but not with colinux 0.6.1). Also, for simplicity's sake, change the installation directory to c:\coLinux. Don't download the Debian image during the installation.

After the installation, if you go to "C:\coLinux" with explorer, you'll see the following files ("[ ]" means directory, list of files for colinux 0.6.2):

  • colinux-bridged-net-daemon.exe
  • colinux-console-fltk.exe
  • colinux-console-nt.exe
  • colinux-daemon.exe
  • colinux-net-daemon.exe
  • colinux-slirp-net-daemon.exe
  • default.colinux.xml
  • initrd.gz
  • linux.sys
  • cofs.txt
  • colinux-daemon.txt
  • news.txt
  • README.txt
  • Uninstall.exe
  • vmlinux
  • vmlinux-modules.tar.gz
  • [netdriver]

Get a Linux distribution
For this example we use the Debian root image that's provided on the coLinux downloads page from the Sourcefourge site.

Under "Root Filesystem Images" you'll see the Debian-3.0r0.ext3.1gb.bz2 file. Download it. The file system (18MB) will decompress to 1Gb. Do not worry about that yet, just be sure now that you will have enough free space.

Decompressing .bz2 files
The Debian Root filesystem image has been zipped as a .bz2 file. This is a kind of compression format. To unzip it, use a tool that can unpack .bz2 files. A good one is TUGZip: http://www.tugzip.com. It's pretty intuitive, so I won't go into that here.

Unzip the the Debian-3.0r0.ext3.1gb.bz2 file to C:\coLinux with TUGZip. This will take a while (unpacked it will be > 1G). Unzipped, the file will have the name Debian-3.0r0.ext3.1gb. This is also the name we'll later use in the configuration file.

The images that coLinux provides may not be big enough for your needs, especially if you plan to install Gnome or KDE. Here's a nifty little program you can use to increase the size of the image file: toporesize.zip (contains currently a .txt file with a dead link, program not found with Google) (toporesize can now be found at [1]).

Create a swapfile
We need a file of a fixed size which will be used as our swap partition. The size chosen for this file will determine how large your swap partition is. Download one of these zipped dummy swapfiles in various sizes provided by <Gniarf>: http://gniarf.nerim.net/colinux/swap/ (the filenames indicate the size of the provided file in MB). Take a file with as much MB as your physical RAM. For example: Physical RAM: 512 MB --> Swapfile "swap_512Mb.bz2".

(To get the amount of Physical ram, see My computer --> Properties)

Unzip the swapXXXMb.bz2 file to "C:\coLinux". Unzipped, the file will have a name like swapXXXMb. This is also the name we'll later use in the configuration file.

Configuration file

CoLinux needs a configuration file, default.colinux.xml in the directory you've installed coLinux into (in this case C:\coLinux).

There's already a default file in C:\coLinux. Edit it with Wordpad. Not in Notepad, because it's in a Unix format, and Notepad doesn't display it very nicely.

This is how mine looks:

<?xml version="1.0" encoding="UTF-8"?>
<colinux>
    <block_device index="0" path="\DosDevices\C:\coLinux\Debian-3.0r0.ext3.1gb" enabled="true"/>
    <block_device index="1" path="\DosDevices\c:\coLinux\swap_512Mb" enabled="true"/>
    <bootparams>root=/dev/cobd0</bootparams>
    <image path="vmlinux"/>
    <memory size="128"/>
    <network index="0" type="tap" name="TAP"/>
</colinux>

In previous versions it was necessary that you'd keep the textfile in Unix format, but in coLinux version 0.6.0 that's not necessary anymore.

If you want network sharing to work don't forget to change "TAP" into "Local Area Connection 2" or how it is called on your system...

Save the document.

When Wordpad asks something about converting the text and discard formatting, click [Yes]. Now you'll also be able to edit it in Notepad.

Enable Connection sharing

To be able to establish an internet connection from coLinux, we will need to make a connection between the Dial-up adapter and coLinux. This will be done by NAT (Network Address Translation). Make sure that you're not connected to the internet with your dial-up connection.

(Be advised: The following procedure would not work on winXP Home Edition; not in any way shape or form.)

Windows 2000:

  • Control Panel -> Network and Dial-up Connections:
    • Select the dial-up connection --> Properties --> Tab Sharing -->

In my case in the list, it says:

  • Local Area Connection 2

Select the Local Area Connection 2. It might show a different number on your pc. This is the TAP-Win32 Adapter that was installed by the coLinux installation. The TAP-Win32 adapter will connect coLinux and my dialup-connection with the internet. Click the checkbox "Enable Internet Connection Sharing for this connection", so that it is selected.
[OK]

Windows will show a window with a message that it assumes that the LAN adapter (TAP-Win32 Adapter) should be set to IP address 192.168.0.1.
[Yes]
[OK]

This means that we'll have to activate the TAP-Win32 adapter. But, this is not yet possible, the TAP-Win32 adapter will only be activated when we start coLinux.

Batchfile to start coLinux

Make a colinux.bat file with the following contents (or just use a shortcut and put these option in the Target field):

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

Place it in "C:\coLinux". This batchfile will later be used to start coLinux in a console.

Note: If you use coLinux-0.7.1-20070101.exe then replace the above 
with this: colinux-daemon.exe -t nt @coLinux.conf

Edit example.conf with wordpad. Shell by clicking START button, 
click on "Run" and type "cmd". Now "cd c:\colinux" (or wherever 
you installed it), now type "colinux-daemon" to view any new 
parameters not in this old wiki. 

Version 0.7.1 installs without worrying about a lot of what is 
mentioned here but you would want to either allow it to install 
a Linux distribution for you (when running the coLinux-0.7.1-20070319.exe 
installer) OR do NOT let it download and go to SourceForge 
yourself (to pick the smallest download and then when Linux is 
running use apt to update it the "Linux way"). 

Note: You might want to be certain you know the password before 
you run the "coLinux.bat file that you must create yourself. Each 
version of Linux has a slightly different password. Some are Login: 
Root Password: [none] and some are "root" for both name and password 
- you will only get so many tries. Now back to our regular programming ...

If you specify the -t nt when starting coLinux, it creates only 1 window, and you'll see a prompt (very handy when you're editing a textfile, so that you know where you are). It also overwrites the linux kernel startup information, so you should leave it at the default -t fltk setting if you need this information.

If you want to capture linux startup information, you may also want to change the screen buffer size in the properties window reachable by right-clicking on the dos prompt icon in the upper left.

Starting coLinux

Start the batchfile colinux.bat.

You'll notice, that the "Local Area Connection 2" in the system tray (that was "unplugged" according to Windows and showed a red cross) suddenly disappears. That means the virtual adapter is connected.

If everything goes well, it will say:

Debian GNU/Linux 3.0 colinux tty1 colinux login:

Log in as root with no password (remember you are still on Windows ;). (Note: 2.6.x password is root) You'll be in the root file system, still just a single file on your Windows drive.

Working in coLinux

This is just a very brief description of what you can do now on the command line to get you going.

If you use df -kh to see used space, you'll see the following lines:

	Filesystem	Size	~[[Used Avail]]	Use%	Mounted on
	/dev/cobd0	1008M	91M  865M	%10	/

This is a very basic system with just enough installed to use networking.

Here's a couple of commands to get you started in the Linux shell:

  • cat - just like the "type" command under Dos.
  • ls - just like the "dir" command under Dos.
  • ls -l - just like the "dir/p" command under Dos.
  • cd .. - change to directory level above, same as Dos, but note the extra space between "cd" and "..". In Linux this is necessary.
  • cd / - change to root directory, same as in cd \ in Dos.
  • cd /etc - change to directory "etc", same as cd \etc in Dos.
  • clear - "Clear screen", same as cls in Dos.
  • df -kh - show the current disk usage
  • shutdown -h now - shutdown coLinux

To practice this a little, type:

clear
cd /
ls

Now you'll see the contents of your root filesystem.

Stopping coLinux

If you want to close coLinux again, it's not a good idea to simply close the coLinux console window. You should use:

shutdown -h now

This will start a shutdown sequence immediately "now" (taking a few seconds) and will power down the linux when it's finished. This "power down" will tell coLinux to quit it's windows part too.

Setting up networking


The process of setting up your network depends on how you are connected to the internet. As wouter_cx says below, the following manual assumes you are not connected via a home LAN or permanently to a DHCP server.

As a rule of thumb, if coLinux is on a computer ...

  • ... that dials directly to the internet and doesn't serve anything else, try the following manual.
  • ... that dials directly to the internet and also serves the internet connection to a home LAN, you might try this manual.
  • ... which connects to the internet through another computer on a home LAN, try this manual.
  • ... that is permanently connected to a DHCP server (e.g. in a college dorm), you might try the native XP bridged connection outlined in this manual, which also describes NAT networking. -- bbeck

The focus of this manual is on a dialup connection, and I don't have a home lan/cable modem/router... -- wouter_cx.

If 192.168.0.1 is already in use, try 192.168.0.2. That means you would have to modify all the occurrences of 192.168.0.1 in this manual to 192.168.0.2.

Firewall software

If you go tweaking the network settings to get it working, make sure that your firewall software is not running, it could save you a lot of trouble. For permanent solution, firewall software needs allow traffic between coLinux and Windows host. Add TAP-Win32 Adapter or 192.168.0.1 to trusted network sources.


Note: When using firewall products such as ZoneAlarms playing around a bit with the security levels helps coLinux go on internet. For eg: in zonealarm with internet security level (in Firewall tab) High no traffic from colinux to Outside is allowed; if this is brought down to Medium level the traffic flow is allowed


                                  +------------------------+
                                  | TAP-Win32 Adapter      |
  +-----------------------+       | (gateway)              |
  | coLinux            <--|-------|-->                     |
  |                       |       | IP:192.168.0.1         |
  |                       |       | netmask: 255.255.255.0 |
  | IP:                   |   +---|-->                     |
  | 192.168.0.40          |   |   +------------------------+
  | netmask:255.255.255.0 |   |   +------------------------+
  | gateway: 192.168.0.1  |   |   | Dial-up connection     |
  +-----------------------+   |   |                        |
                              +---|-->                     |
                                  |                        |
                              +---|-->                     |
                              |   | Dynamic IP (DHCP):     |
                              |   | 195.121.170.107        |
                              |   | netmask: 255.255.255.0 |
                              |   +------------------------+
  +------------------------+  |
  | Provider             <-|--+
  |                        |
  | DNS: 195.121.1.45      |
  |      195.121.1.57      |
  |                        |
  +------------------------+

Your coLinux session needs an IP address on the same network as the network interface that serves as your gateway. Change the values in the file /etc/network/interfaces. You can use nano as your editor. Start nano with the interfaces file:
cd /etc/network
nano interfaces

Basically, all you should know about Nano at this moment, is the following commands:
Exit (Ctrl-X)
Save (Ctrl-O)

Use the arrow keys to move in the file. This is how it should look like:

1. Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
1. /usr/share/doc/ifupdown/examples for more information.

auto lo eth0

iface eth0 inet static
address 192.168.0.40
gateway 192.168.0.1
netmask 255.255.255.0
iface lo inet loopback

They're also compatible with the default Windows Connection sharing settings which make the IP of your TAP-Win32 Adapter 192.168.0.1. The lines starting with 1. are comments, you won't have to change them. When you're done, press Ctrl-O.

Nano will ask "File Name to write: interfaces". Press [Enter].

Now the file is saved to disk, it says "Wrote 10 lines". Press [Ctrl-X] to exit Nano.

When you're back at the prompt, type "clear" to clear the screen of the remains that Nano left on the screen.

In Windows, go to Control Panel -> Network and Dial-up Connections:

Select the dial-up connection --> Properties --> Tab Sharing

Select the Local Area Connection 2. This is the TAP-Win32 Adapter that was installed by the coLinux installation. The TAP-Win32 adapter will connect coLinux and my dial-up-connection with the internet. Click the checkbox "Enable Internet Connection Sharing for this connection". [OK]

ncryptor: This didn't work for me. After more than an hour of trying i made it work by activating Internet Connection Sharing on the dial-up instead on the TAP.

Windows will ask you if you the LAN adapter (TAP-Win32 Adapter) should be set to IP address 192.168.0.1. [Yes]

To show your IP configuration in Windows, start a Command shell, and type:
Ipconfig /all

This is how my configuration looks like now:

Windows 2000 IP Configuration

Host Name . . . . . . . . . . . . : wouter_cx
Primary DNS Suffix  . . . . . . . :
Node Type . . . . . . . . . . . . : Broadcast
IP Routing Enabled. . . . . . . . : Yes
WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection 2:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : TAP-Win32 Adapter
Physical Address. . . . . . . . . : 00-FF-1F-4B-2F-3B
DHCP Enabled. . . . . . . . . . . : No

Autoconfiguration IP Address. . . : 192.168.0.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . :

PPP adapter hetnet:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface
Physical Address. . . . . . . . . : 00-53-45-00-00-00
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 195.121.170.107
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 195.121.170.107
DNS Servers . . . . . . . . . . . : 195.121.1.45
                                    195.121.1.57
NetBIOS over Tcpip. . . . . . . . : Disabled

In Linux, the command ifconfig shows the network configuration in the same manner with the "ifconfig" command. Type ifconfig in the coLinux console:
ifconfig

eth0      Link encap:Ethernet  HWaddr 00:4A:41:52:45:4B
          inet addr:192.168.0.40  Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8750 (8.5 Kb)  TX bytes:5008 (4.8 Kb)
          Interrupt:2

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

In Windows, type
ping 192.168.0.40

and you should get a reply from the coLinux session.

Do a ping 4 192.168.0.1 in coLinux to see if we have a network connection to the Windows host:
ping -c 4 192.168.0.1

Ping -c 4 means: ping 4 times. In Windows, ping will stop after 4 pings by default, but in Linux it will ping forever if you don't stop it... Anyway, you can stop it by pressing Ctrl-C.

DNS (Nameserver) To get internet access we will need to set up the DNS first by editing etc/resolv.conf with Nano.

cd /
cd etc
nano resolv.conf

You can find what DNS server your ISP uses by running ipconfig /all in a Windows command shell. Under the heading "PPP adapter ..." you'll see something like:

	DNS Servers .  . . . . . : 195.121.1.45
	                           195.121.1.57


Adapt your resolv.conf file to match these two DNS Servers.

nameserver 195.121.1.45
nameserver 195.121.1.57

Now make a connection to the internet with your dial-up adapter. When you're online, do a ping to Google in coLinux to see if we have a network connection to the internet:
ping -c 4 www.google.nl

If the answer is:

PING www.google.akadns.net (66.102.9.104): 56 data bytes
64 bytes from 66.102.9.104: icmp_seq=0 ttl=243 time=207.8 ms
64 bytes from 66.102.9.104: icmp_seq=1 ttl=243 time=224.6 ms
64 bytes from 66.102.9.104: icmp_seq=2 ttl=243 time=209.0 ms
64 bytes from 66.102.9.104: icmp_seq=3 ttl=243 time=209.0 ms

Then your ping succeeded! Congratulations! This means you have a connection to the internet.


Edited by Bracx on 20040706: I also had to create a /etc/hosts file with the following line:

   127.0.0.1 colinux.colinuxdomain colinux

Taken from the coLinux ASAP page. Otherwise I would just get a grey Xserver screen with a x cursor when using VNCViewer instead of the KDE desktop.


Edited by Sweet123 on 20051208: There is a easier way to connect Internet from CoLinux,please see:Linux#v09


Update Debian

First we need to get an updated package list, to get that run:

apt-get update

Well, that is something different from Windows Update, right? No fancy stuff, no ActiveX components, plain text...


Remark by Alex: If this action fails due to "Data Socket timed out" you might want to try and reduce your MTU.

        ifconfig eth0 mtu 576

worked for me (via WLAN).

If you get Dynamic MMap failed... use the solution from this site: Dynamic MMap failed solution

Setting up a display server


There are basically two ways of getting a graphical display of coLinux on Windows, namely using a VNC server and a client (such as RealVNC or TightVNC) or an X server and a client (such as Cygwin/X or XWin32). A VNC server uses the X graphical system but uses a different network protocol for transferring the display. If you already have Cygwin or XWin32 installed under Windows, you may want to use this manual instead of or in addition to the following instructions. -- bbeck


We need VNC to send the desktop of Linux to the Windows machine. As stated at the top of the page, you can find a VNC client at Real VNC: http://www.realvnc.com/. To install VNC server we need to install a few packages. Run:

apt-get update

This will ensure apt-get has the latest package list.

apt-get install xserver-xfree86

This will install Xserver, the X Window System display server.

On the questions in the screen, answer:

[y] [Enter]

Linux is now downloading the package from the Debian website. When it's ready, it will startup the Xserver configuration wizard. With the [Tab] key you can switch between Yes and No.

On the question answer <No>. We'll do that later. We only want to update now.

Also do the following updates:

apt-get install xfonts-base xfonts-75dpi

apt-get install kdebase

apt-get install konsole

apt-get install vncserver

These install necessary fonts, a basic KDE environment, konsole (X terminal emulator with support for several sessions) and vncserver.

Running vnc server

Now we want to run the graphical Linux desktop. Running vncserver from the commandline is done like this (use man vncserver in the command shell to find out more about what commands are available):

vncserver -geometry 1024x768 -depth 16

Type a password. "vncserver" is a good password at the moment. To change your password, use vncpasswd.

Run VNC Viewer in Windows. It will say something like "192.168.0.40:1". 192.168.0.40 stands for the IP-number of your coLinux box for windows. That means that for your Windows machine, 192.168.0.40 will be an internal IP-number. For outsiders it will not be visible. [OK]

Now you have to provide the password that you typed in earlier.

Isn't that beautiful!

Now you're inside the graphical environment. From here, find other sources of information to increase the possibilities you have with Linux.


If you have the debian root system and install OpenOffice.org the fonts will look really bad. To change that: apt-get install msttcorefonts Once the installation is complete the fonts in OOo will automatically look great. (Associated web sites http://corefonts.sourceforge.net/ (notice that there are a lot of instructions that do NOT apply for the deb package. For debian all you have to do is "apt-get" :-). http://packages.debian.org/unstable/graphics/msttcorefonts.html)


If you use coLinux a lot, you may wish to have coLinux run a hidden instance when Windows boots up and then access coLinux using a VNC client or a SSH client. To access coLinux via VNC, first make vncserver start on bootup and then access coLinux using a VNC client (such as RealVNC or TightVNC). To access coLinux via SSH, first set up SSH on coLinux and then use a SSH client (such as PuTTY or SSH Secure Shell) to connect to a running instance of coLinux. Once you can do access coLinux reliably, you can use one of the managers on the Administration Tools page to set the service up automatically, or you can set it up manually. Notably, the Colinux Manager administration tool allows you to spawn a console and access a running coLinux service, if you prefer the console over VNC or SSH. -- bbeck

Advertisement