Friday, June 8, 2007

Mobile Ubuntu Colinux Setup

My Vista Home Premium finally arrived. Since I have a Ati 9250 at work, which is a smartly rebranded DirectX 8 card, I was craving for the full "vista experience". After doing some backup I installed Vista on my laptop and spent some time setting up the basic programs I need. Since installing colinux is one of the great challenges of the Game Of Windows I'll try to present you a step-by-step guide to a working mobile colinux setup in Vista.


My goal is to set up a colinux configuration for truely mobile computing. That means that I use wireless networking in Windows and Kubuntu natively as my primary networking interface. I want colinux networking to work whenever my Windows has network access and I want a single configuration on linux and Windows. The configuration you find here is based on the two years I use colinux now and constant fidling with the configuration parameters.

As a prerequisite you need a running GNU/Linux on your computer. I installed an Kubuntu Feisty onto a spare partition. Kubuntu is my favorite distribution at the moment, because you get up-to-date basic packages like in debian/sid, and up-to-date KDE packages like SuSE. After installing GNU/Linux I rebooted into Vista. Let's rumble.

First I installed colinux 0.8.0 pre from Henry Nestler. My experience with colinux is that the latest unstable you can get at Henry's site is the most stable version available.

Once you installed it (you can safely skip downloading the linux image, we'll boot from a real partition instead) head to C:\Programme\coLinux and copy example.conf to colinux.conf. Now edit colinux.conf with WordPad. Since I have activated UAC I can't simply edit the system file but use an administrator notepad. Start - Type "Notepad" - Right Click the appearing notepad and select "Run as administrator...".

Now my colinux configuration looks like this:

kernel=vmlinux

# my swap partition
sda3=\\Device\\Harddisk0\\Partition3

# my root partition
# I usually have to play around with the partition numbers before
# I get the final digit right.
sda4=\\Device\\Harddisk0\\Partition4

# this should point to the root partition...
root=/dev/sda4
ro
initrd=initrd.gz
mem=768

# a slirp device for internet access; when I boot
# kubuntu natively, this is my wired ethernet device
eth0=slirp

# when I boot kubuntu natively this is my wireless
# connection; since I don't want any configuration
# changes from native to colinux I inserted a
# unusable eth1 device in the colinux configuration
eth1=pcap-bridge,"Unknown"

# internal high-speed connection between colinux
# and vista only
eth2=tuntap

# I want to see my Vista files and cdrom in colinux...
cofs0=c:
cofs1=d:
cofs2=e:


Now I can start colinux. Configuring the network devices takes some time, since the stuff is not yet configured on the linux side.

Edit /etc/network/interfaces. Remove the default entry for eth1 (it will be handled by knetworkmanager later, we don't want to use it in colinux) and change eth2 to a private network:

auto eth2
iface eth2 inet static
address 192.168.42.2
netmask 255.255.255.0

Now configure the tuntap device on Windows to ip 192.168.42.1. Start colinux and you should be able to ping colinux at 192.168.42.2 from Windows. You can't ping back since the Windows Vista Firewall is active on the tuntap device.

Install Xming and cygwin. Make sure you select openssh when installing cygwin, you'll need it later to log into your colinux.

Run XLaunch (from Xming) and configure an X Server without access control and save the configuration to your local documents directory. To start the X server without access control at login time link the config.xlaunch file into your Autostart menu. Make sure that you allow your X through the firewall. Don't do this if you don't have an extra firewall to the internet, since otherwise people from outside would be able to contact your X server!

Now you have to make sure you can log into your colinux from cygwin without a password. Luckily ssh features public-key based authentication, and it's not that hard to set up.

Start a cygwin shell.


ssh-keygen -t dsa


Copy the file to the .ssh directory on the colinux server. Make sure you have a .ssh directory in your $HOME before doing this:


scp .ssh/id_dsa.pub manuel@192.168.42.2:~/.ssh/authorized_keys


Now we're able to ssh manuel@192.168.42.2 without using a password. Edit a file konsole.bat on your desktop.

c:
cd \\cygwin\\bin
run bash --login -c 'ssh manuel@192.168.42.2 "export DISPLAY=192.168.42.1:0; konsole > /dev/null 2>&1"'


Now all that is left to do is to run colinux as a service. At an adminstrator command prompt (Start->Run "cmd", Right-Click->Run As Administrator) c:\Programme\coLinux write:


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


Open "Services" as administrator and edit the properties of the colinux service. Set the start mode to automatic. Voila.

To access your windows partitions from colinux you can simply add them to your /etc/fstab:

0 /media/c cofs user,defaults,rw 0 0
1 /media/d cofs user,defaults,rw 0 0
2 /media/e cofs user,defaults,rw 0 0

Now your init-scripts will mount your cofs devices (a.k.a. Windows Drives) when colinux boots.

I use this configuration on a Dell XPS M170 laptop. Of course you can use it for workstations, too. I myself prefer a winpcap'ed configuration for workstations, though. It's easier to get access to the colinux that way. Unfortunately winpcapping the device doesn't work on most wireless networks in the wild.

See also:

Information Overflow & Colinux WLAN Networking

Colinux On Windows Vista

14 comments:

  1. [...] An updated article on a Mobile Ubuntu Colinux Setup for my laptop is available. Share and Enjoy: These icons link to social bookmarking sites where [...]

    ReplyDelete
  2. Things went just swell until I tried to scp my key over to the linux side.

    from cygwin:

    Admin@Thinkpad ~
    $ scp ./key.pub gap@192.168.42.2:~/.ssh/authorized_keys
    ssh: connect to host 192.168.42.2 port 22: Connection refused
    lost connection

    I can ping just fine.

    I think I've turned off every firewall I can find. Do you know what might be going on?

    -gary

    ReplyDelete
  3. forgot to mention: the linux is Kubuntu 7.04

    ReplyDelete
  4. What happens if you do
    $ ssh gap@localhost
    inside colinux (colinux-console)?

    If this works, please post
    $ ipconfig
    from your windows box and
    $ ifconfig
    from within colinux...

    Cheers,
    Manuel

    ReplyDelete
  5. Cant mount Cdrom in Colinux. I am using CoLinux 0.8.0 with Debian 4.0r0. I have tried everything from the wikis and forums, but no luck. Looking to upgrade from Debian DVDs to get a GUI with X. Any help would be appreciated.

    ReplyDelete
  6. Hi Tony,

    have you tried using cofs to get your cdrom running? Specify the cdrom drive letter as cofs in your colinux configuration (for example: cofs1=d:\, see above. Then mount cofs1 in your colinux. You have to use a new colinux for this to work (I always use the latest 0.8.0 pre-release).

    Cheers,
    Manuel

    ReplyDelete
  7. Hi Klimek;
    Still not working. my cdrom drive in windoze is E:\
    My colinux example.conf file reflects the cdrom as so: cofs1=E:\
    my etc/fstab reflects:
    /dev/cofs1 /media/e cofs user,defaults,rw 0 0

    When I try to mount it says "cant find cofs1 in /etc/fstab or /etc/mtab"

    At boot I get a failed message for Mounting /media/e does not exist.

    I have tried several different lines in my fstab to get linux to mount the cd at boot time but still get the error

    ReplyDelete
  8. Hi Klimek;
    I set the cdrom line in fstab back to the default and commented it out.
    My colinux example.conf file for cdrom is now: cofs0=E:\
    I got the cd to mount finally by typing:
    mount -t cofs cofs0: /media/cdrom
    Its mounted and I can ls -all and see the contents for the Debian 4.0 DVD

    Now I ran apt-cdrom add to add the DVD as a repository for my sources.list file

    that didnt work since there is another file saying the cdrom is a different name.

    Error: E: Unable to stat the mount point /cdrom/ - stat (2 No such file or directory)
    E: Failed to mount the cdrom

    I can mount it but apt can not.

    apt-cdrom is a tool to add CDROM's to APT's source list.
    The CDROM mount point is taken from apt.conf and /etc/fstab

    My main question is how do I reflect the correct syntax in the fstab for the cdrom so there is no conflict or errors, and do I need to create an apt.conf file?

    ReplyDelete
  9. Hi Klimek;
    I forgot to mention. I used the fstab line mentioned in your article:

    0 /media/e cofs user,defaults,rw 0 0

    and it did not work.

    I have tried other lines and was not successful getting apt to mount the cdrom drive

    ReplyDelete
  10. Hi Tony,

    I have not used this technique to be able to apt-get from a cdrom, since I always have a broadband network connection :-)

    Sorry, but I can't help you with apt. I'd try to figure out whether you can tell apt-cdrom to use an arbitrary directory.

    Cheers,
    /Manuel

    ReplyDelete
  11. fwyzluc ugqdrcw dmunj epsnujhc mwbocyxuh sgqw tycunxgvb

    ReplyDelete
  12. Hello,

    I am trying to get this to work, but so far I haven't had luck due to problems with coLinux reading my file system. I've posted the output of the errors here:
    http://colinux.pastebin.com/m1b03dbfa

    It seems the problem occurs with the mounting of the root file system (sda5).

    I have installed Kubuntu 8.10. It is running fine. I am using Vista and coLinux 0.8.0 from Henry's /colinux/testing/devel-0.8.0/20081130-Snapshot

    Any thoughts on what I might be doing wrong?

    ReplyDelete
  13. This was an amazing guide to get me going. The only issues I ran into was the double backslashes that you used. In WinXP Corp single backslashes work, but not double.

    This is the config that ended up working for me:
    kernel=vmlinux
    cobd1=\Device\Harddisk1\Partition2
    cobd0=\Device\Harddisk1\Partition1
    root=/dev/cobd0
    eth0=tuntap

    ReplyDelete
  14. In the seventh heaven Additional Year, everyone! :)

    ReplyDelete