Colinux and Ubuntu Linux

Table of Contents

  1. Intro

  2. Prereqs

  3. Install Colinux

  4. Configure Ubuntu for Colinux

  5. Install Software in Ubuntu

  6. Useful Colinux Information

Send comments and feedback at andrewroth - at - gmail dot com

screenshot of colinux running in windows with vnc connected

  1. Intro

    Colinux is a "Port of the Linux kernel that allows it to run cooperatively alongside another operating system on a single machine." (-colinux web site).

    I put a screencast of me following this guide here. I also have a short demo of the final product here.

    I already had linux installed on a partition and wanted to run linux in a window in windows. I was able to do this with both VMware and colinux, and settled on colinux because it used less resources. I decided to write this guide to help others get their linux running in windows. Personally I use colinux mainly for the ssh shell, and with samba I can load my windows file system and have the linux development tools.

    Advantages:

    Disadvantages:

    Disclaimer: Try this at your own risk! This guide will get you using some bleeding edge versions of colinux, because the latest stable ones didn't work. Just keep that in mind. If you are using a linux partition you absolutely need, it might be worthwhile to install a vanilla ubuntu on another one and use that. That said, I've been using this for a few weeks and haven't had any problems.

  2. Prereqs

  3. Install Colinux

    1. Download and install the latest self-installing binary from colinux wiki's development snapshots page. Uncheck the "Root Filesystem image Download".
    2. From the Henry Nestler daily builds, open the latest devel-YYYYMMDD folder and download the daemons executables (not debug versions) and vmlinuz kernel.

      Extract the daemons and vmlinuz to your colinux dir, replace all existing ones.

    3. In Network Connections control panel, rename "Local Area Network 2" adapter to "colinux"
    4. Figure out what Volume your linux and swap partitions are on using windows disk management. Volume 1 is the first volume. You can get disk management by going control panels (classic view) -> Adminstrative Tools -> Computer Management -> Disk Management.

      screenshot of determining a partition's windows volume number

    5. Download colinx.conf to your colinux directory, and update the File systems section and root device based on what partition linux and swap are, and what volume they are in windows.

      FYI, the contents of colinux.conf:

      # The default kernel
      kernel=vmlinux
      
      # File systems
      hda?=\Device\HarddiskVolume? # swap
      hda?=\Device\HarddiskVolume? # ubuntu
      
      # Tell kernel the name of root device
      root=/dev/hda?
      
      # 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) on second linux adapter.
      # Inside running coLinux configure eth0 with this static settings:
      eth0=slirp
      
      # Networking (tuntap as private network between gust and host)
      eth1=tuntap,"colinux"
      
    6. Run colinux. Opening a command prompt, go to your colinux dir, and type
      colinux-daemon.exe @colinux.conf
      
      You should have your linux partition booting into colinux! You might have to hit enter after the line "* Running local boot scripts (/etc/rc.local)" to get a login prompt.
    7. Install colinux as a service. You might want to skip this step for now, instead get everything else working then do this last. Shutdown ubuntu in colinux if it's running with
      sudo shutdown -h now
      

      And open a command prompt in windows. Go to your colinux directory and run

      colinux-daemon.exe --install-service -config @colinux.conf
      

      Set the service type to Automatic and start it. Use colinux-console-nt.exe to connect a virtual shell to a running colinux service.

  4. Configure Ubuntu for Colinux

    1. Run colinux-console-nt.exe so that you can paste in commands
    2. disable /etc/init.d/apt-index-watcher by adding an 'exit 0' at the beginning because it's buggy
    3. disable /etc/init.d/checkfs by adding
      if [ -n "`uname -r|grep -- '-co-'`" ]; then
        exit 0
      fi
      
      at the beginning because checkfs thinks there's a problem when there's really not, when in colinux.
    4. Configure colinux and ubuntu networking

      You have a few options here. I've found slirp to work well, if you only need outgoing connections. Other options include bridging (didn't work for me - I don't think it works for my wireless card) and using microsoft internet connection sharing (requires subnet 192.168.0.0). There's a whole lot more information at the Colinux Wiki Networking Page.

      This guide will set you up with outgoing internet and one local private network (192.168.2.2 for colinux, 192.168.2.1 for windows)

      My approach is to make two different /etc/network/interface files, one for your regular linux setup (interfaces.native), and one for colinux (interfaces.colinux). On bootup, the correct one will be copied to network/interfaces. I made a shell file switch-interfaces.sh to do that. This script will be prepended to /etc/init.d/interfaces

      I also made a simple shell script setup_interfaces.sh to setup these interface files. In linux, run

      wget http://roth.textdriven.com/other/colinux/setup_interfaces.sh
      chmod +x setup_interfaces.sh
      sudo ./setup_interfaces.sh
      rm setup_interfaces.sh
      

      FYI, the contents of setup_interfaces.sh:

      # start in home
      cd
      
      sudo cp /etc/network/interfaces /etc/network/interfaces.native
      wget http://roth.textdriven.com/other/colinux/interfaces.colinux
      sudo mv interfaces.colinux /etc/network/
      
      # prepend switch-interfaces to /etc/init.d/networking
      wget http://roth.textdriven.com/other/colinux/switch-interfaces.sh
      cat /etc/init.d/networking >> switch-interfaces.sh
      sudo mv switch-interfaces.sh /etc/init.d/networking
      sudo chmod +x /etc/init.d/networking
      
      # do a restart to get the right config in place
      sudo /etc/init.d/networking restart
      
      

      FYI, the contents of interfaces.colinux:

      auto lo
      iface lo inet loopback
      
      auto eth0
      iface eth0 inet dhcp
      
      auto eth1
      iface eth1 inet static
          address 192.168.2.2
          netmask 255.255.255.0
      
    5. Set windows to use 192.168.2.1 on the colinux adapter. Get properies to the colinux adapter, then click Internet Protocol (TCP/IP) then set ip to "192.168.2.1" and subnet to "255.255.255.0"
  5. Install Software in Ubuntu

    At this point you have a working linux install in windows through colinux. You can install any software you like. I will run through some packages you probably want.

    1. Edit /etc/apt/sources.list and enable universe and multiverse (just uncomment all the commented out deb/deb-src's.) Update your list by running:
      sudo apt-get update
      
    2. Install ssh server
      sudo apt-get install openssh-server
      
      In windows, download putty and connect to 192.168.2.2 with the ssh protocol.
    3. Install a windows manager with vnc server. A lightweight manager that works well is blackbox:

      sudo apt-get install blackbox bbappconf bbdate bbkeys bbmail bbpager bbppp bbrun bbsload bbtime
      sudo apt-get install tightvncserver
      sudo rm /etc/alternatives/x-window-manager
      sudo ln -s /usr/bin/blackbox /etc/alternatives/x-window-manager
      tightvncserver
      

      In windows, install ultravnc and connect to 192.168.2.2:1 in the viewer.

  6. Useful Colinux Information

    1. If you ever get a read-only file system, boot natively and run fsck. That should put it back to read-write.
    2. If you lose networking and hence your ssh connection, run the colinux-console-nt.exe program to get a virtual monitor.