CoLinux - Setting it up on Windows XP

About this article

I wanted to write an article thats quick and simple get colinux working on a Windows Host. I have skipped details that can be referred elsewhere in the spirit of keeping this article simple.

The infrastructure used:

Laptop: Toshiba Portege A 200
Host OS: Windows XP
Guest OS: Ubuntu 8.04 (alpha 6)

What is Colinux

Colinux or Cooperative linux is an easy way to run Windows and Linux simultaneously on the same machine without the hassle of partitioning.

More at ...

http://colinux.org/

Preparing Setup

Space Requirements

Ensure you have ample space on your drive depending on how full you want to enjoy linux. Below numbers may help you decide if you have enough space to set up colinux:

Bare minimum non-gui colinux: 2G

Gnome/Kde based colinux: 5G

For use as full time OS: 10G+

Software needed

  • Qemu
  • QEMU Accelerator Module
  • Colinux
  • Wincap
  • Ubuntu or any linux distribution of your choice. I used ubuntu for this article. And you should download the .iso file from this website.
  • UnxUtils - this contains unix utilities like dd, ls etc.
  • Xming Optional software if you want to access Linux the graphical way

Installation & Configuration Instructions

Qemu Based Installation

  • Download the latest Ubuntu installation .iso file. In my case, this is hardy-desktop-i386.iso
  • Download and install qemu
  • Download and install qemu accelerator module. Basically, download the zipped file and extract in qemu directory
  • Right click kqemu.inf file and click "Install" to install this software in windows
  • Create an empty file to install Linux using fsutil. I allocated 5 GB of space for this.
fsutil file createnew d:\colinux\Ubuntu\Ubuntu_5gb 5368680448
  • Create a small swap device for qemu
fsutil file createnew d:\colinux\swap_512mb 536903168
  • Start the qemu accelerator module before starting the install procedure. This is important to use -kernel-kqemu option in qemu. Else graphical interface may not come up.
net start kqemu
  • Create a small batch file to start Ubuntu installation in qemu.
@ECHO OFF
REM I installed qemu in colinux folder. You may need to change this.
set qemu_dir=d:\colinux
set hd=%qemu_dir%\Ubuntu\ubuntu_5gb
set swap=%qemu_dir%\swap_512mb
set cdrom=%qemu_dir%\Ubuntu\hardy-desktop-i386.iso
set mem=512
qemu -kernel-kqemu -hda %hd% -hdb %swap% -cdrom %cdrom% -m %mem% -boot d -L .
pause
  • Boot from the CD and then click the install icon on the desktop to install Ubuntu.
  • Configure to your liking if you wish. You can do that later too.
  • Shutdown

Qemu part is now over.

Convert Qemu image to Colinx

  • Convert Qemu image to Colinux image
dd if=ubuntu_5gb of=ubuntu_5gb.img bs=512 skip=63
  • Qemu can now be deinstalled and the qemu image can also be deleted. However, its best to retain unless you have colinux up and running

Colinux configuration (Windows)

  • Install colinux
  • Install WinPcap
  • Rename the WinPcap based network connection as "Tap". This is for easily identifying and referring the network connections. The network connections can be renamed in the network connections panel
  • Configure the "Tap" network with the below configurations. (you can choose any network that does not conflict with the IPs within your network):
IP: 192.168.37.10
Netmask: 255.255.255.0
  • Tap is the interface used to communicate between Guest OS and Host OS
  • Create a small file in the colinux directory as below (Ubuntu.conf). This is modified example.conf file of colinux. This file is colinux start up file and is loaded whenever colinux is restarted.
kernel=vmlinux
cobd0="d:\colinux\Ubuntu\Ubuntu_5gb.img"
root=/dev/cobd0
ro
initrd=initrd.gz
mem=512
eth0=slirp,,tcp:22:22/tcp:80:80
eth1=tuntap,"Tap"
  • "tcp:22:22/tcp:80:80" allows routing requests to port 22 and 80 on the windows host to the linux OS. These arguments are not necessarily needed but I keep these to test out the configurations
  • Create a batch file to boot colinux as below..
@echo off
colinux-daemon.exe @"Ubuntu.conf" -d -v 3
  • This should start colinux.
  • Double click "colinux-console-fltk.exe" view the linux console booting up.
  • If you see any error, make sure there are no syntax or path errors in the Ubuntu.conf file in the colinux directory.

Guest OS configurations (Ubuntu)

Network configurations

  • Set up the /etc/network/interfaces file as below
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
auto eth1_rename
iface eth1_rename inet static
address 192.168.37.20
network 192.168.37.0
netmask 255.255.255.0
broadcast 192.168.37.255
  • Somehow eth1 is recognized as eth1_rename in colinux. I have not bothered to find out how i can rename it to eth1. (FIX ME)
  • Add the below line to /etc/resolv.conf
nameserver 10.0.2.3
  • The ip addresses 192.168.37.20 & 192.168.37.10 are just a matter of choice. Please use what ever works for you.
  • Restart networking
/etc/init.d/networking
  • ifconfig should show the interfaces lo, eth0 and eth1_rename properly configured

Testing

  • Ping from windows OS to host 192.168.37.20. The ping request should be responded
  • Internet should work from the Linux host if you have a working internet connection (Lan or wireless) on your windows host
  • wget, nslookup, dig to google.com or somewhere else should work too

Accessing the Graphical Linux

XDMCP & Xming Way

Below is how it should work. However, it has worked for me yet. I believe thats just a matter of what depth of colors my display can support on two monitors. (FIX ME)

  • edit in /etc/gdm/gdm.conf to disable opening local display and enabling xdmcp
[xdmcp]
Enable=true
[servers]
#0=Standard
  • Restart gdm
sudo /etc/init.d/gdm restart
  • Launch using xlaunch
Display Settings One window
Display number 0
Start Xming Open Session via XDMCP
Connect to host the IP adress from eth1 (192.168.37.20)
Clipboard enabled
Using VNC

Easiest way to get the graphical linux working is to set up vnc on the colinux OS and then access it using vnc client from the Host OS. Below is how i configured it:

On the Guest OS (Ubuntu)

  • Install vnc
sudo apt-get install vnc4server #vncserver for previous versions, i suppose
  • as a regular user, set a password for vnc
vncpasswd
Password:
Verify:
  • Add the below lines to your xstartup file (/home/user/.vnc/xstartup)
#!/bin/sh
exec gnome-session & # or startkde if you are kde fan
  • Start the vnc service (there are other ways to start vncserver which may be more efficient eg. through xinetd or init.d scripts)
vncserver :1 -depth 24

NOTE:I could not get a proper gui unless i ran it with -depth 24 or -depth 16 options. Apparently, thats a video card limitation. So, your experience may vary depending on your graphics card.

Host OS (Windows)

  • If you have n't figured it out already. Connect using vncviewer or any vnc client using the "Tap" network.
vncviewer 192.168.37.20:1
:1 specifies the display to connect to. If you have xdmcp up and running, you would be connecting to display :0

Adding Colinux as service

  • Adding colinux as a service helps to have colinux running in the background. So, you can ssh to it anytime. However, you may not want to run it all the time as it will take some system resources especially, if you are running graphical mode.
d:\colinux\colinux-daemon.exe @Ubuntu.conf --install-service "Colinux Ubuntu"

References

Setting Up Ubuntu 6 in colinux

Networking In Colinux

Graphical Colinux



2 comments

Popular posts from this blog

VirtualBox to KVM Migration

Conky inspires

Connecting Ubuntu to Belkin N+ router USB drive