Wikia

coLinux

Getting Started with coLinux - Long manual

Talk1
234pages on
this wiki

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 need is (read: what I've used):

  • coLinux
  • debian distribution (only 18mb)
  • extra packages from the debian website
  • VNC client, VNCViewer from http://www.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.4 and before with XML configuration Edit

Old coLinux versions up 0.6.4 used XML file as configuration. We sticked this old Long manual here.

The current manual should only have the new plain text formats for version 0.7.1 and later.

Execute coLinux installation Edit

To start, download the installer two packages from the coLinux site. One must be the latest coLinux system (coLinux-0.7.3.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.

Download coLinux-0.7.3.exe from package coLinux-stable and run the installer. The tap device and everything else will be taken care of. Please let all components enabled.

Also, for simplicity's sake, change the installation directory to c:\coLinux. Don't download the Debian image during the installation.

During the installation, download the WinPcap_4_0_2.exe file from http://www.winpcap.org/install/.

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.7.3):

  • 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
  • example.conf
  • initrd.gz
  • linux.sys
  • cofs.txt
  • colinux-daemon.txt
  • debugging.txt
  • NEWS.txt
  • README.txt
  • Uninstall.exe
  • vmlinux
  • vmlinux-modules.tar.gz
  • [netdriver]

Get a Linux distribution Edit

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

Under "Root FS Images - 2.6.x-based" 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 Edit

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. Toporesize can be found on Colinux Image Tools.

Create a swapfile Edit

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 Edit

CoLinux needs a configuration file in the directory you've installed coLinux into ("C:\coLinux" or "C:\Program Files\coLinux"). The new Configuration file format is plain text. You should create a colinux.conf from the example.conf provided.

Fix your installation directory, and set up your Windows-coLinux connection. Slirp should use as first way to internet, additional enable TAP-Win32. Remove the comments (#) from beginning of line at eth0 and eth1.

#
# This is an example for a configuration file that can
# be passed to colinux-daemon in this manner:
#
#    colinux-daemon @example.conf
#
# Note that you can still prepend or append configuration and 
# boot parameters before and after '@', or you can use more 
# that one '@ to load several settings one after another.
# 
#    colinux-daemon @example.conf @overrider.conf mem=32
#
# Full list of config params is listed in colinux-daemon.txt.

# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
cobd0="c:\coLinux\Debian-3.0r0.ext3.1gb"

# Swap device, should be an empty file with 128..512MB.
cobd1="c:\coLinux\swap_512Mb"

# Tell kernel the name of root device (mostly /dev/cobd0,
# /dev/cobd/0 on Gentoo)
# This parameter will be forward to Linux kernel.
root=/dev/cobd0

# Additional kernel parameters (ro = rootfs mount read only)
ro

# Initrd installs modules into the root file system.
# Need only on first boot.
initrd=initrd.gz

# Maximal memory for linux guest
#mem=64

# Slirp for internet connection (outgoing)
# Inside running coLinux configure eth0 with this static settings:
# ipaddress 10.0.2.15   broadcast  10.0.2.255   netmask 255.255.255.0
# gateway   10.0.2.2    nameserver 10.0.2.3
eth0=slirp

# Tuntap as private network between guest and host on second linux device
eth1=tuntap

# Setup for serial device
#ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on"

# Run an application on colinux start (Sample Xming, a Xserver)
#exec0=C:\Programs\Xming\Xming.exe,":0 -clipboard -multiwindow -ac"

I also check the Tap adapter settings in Windows networks, and edit /etc/network/interfaces, as documented in the network setup procedures on this Wiki.

The name for TAP device not need because coLinux has a specific internaly id to find it, and we have no problem with the openVPN TAP driver.

Save the document.

Enable Connection sharing Edit

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 Edit

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

"c:\coLinux\colinux-daemon.exe" "@colinux.conf"

or whatever your configuration file name is. The quotes needs for Vista and for directory names with spaces.

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

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 Edit

(hax- was heere, make more awesome stuff with coLinux! You guys rock :-))

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 Edit

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 Edit

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 Edit


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 Edit

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.


                                  +------------------------+
                                  | 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]

NB: 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 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 Edit

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).

Setting up a display server Edit


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 install xserver-xfree86

or more recently

       apt-get install xserver-xorg

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 vnc4server

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

Running vnc server Edit

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

Around Wikia's network

Random Wiki