June 17, 2008, 7:58 a.m.
posted by void
Run Ubuntu Inside Windows
If you want to avoid the confines of the emulator sandbox, give coLinux a whirl and run Ubuntu as a cooperative process alongside Windows. coLinux (Cooperative Linux), available from http://www.colinux.org/, takes a unique approach to solving the same problems that emulators do. Instead of providing a completely enclosed sandbox like Virtual PC or VMware, it's a port of the Linux kernel that lets you run Linux alongside Windows. This means that you don't get a fully emulated and/or virtualized PC environment. But you do get enough to launch a Linux distribution in console mode with networking support, and from there you can use ssh to tunnel into the coLinux system and run applications on your Windows X11 server. You can get a great, free X11 setup with Cygwin (http://www.cygwin.com), a Windows port of many Linux tools and applications. With the combination of coLinux and Cygwin, you can get Ubuntu running alongside Windows, and without the overhead and complexity of other offerings, it runs quite fast. To get Ubuntu up and running with coLinux, you'll first need to install coLinux itself and choose the minimal Debian disk image that comes along with it. With some apt-get trickery, you'll be able to turn that Debian installation into an Ubuntu system. Install coLinuxDownload the latest installer from the coLinux web site, and run it under Windows. If you don't have WinPcap (http://winpcap.mirror.ethereal.com/install/default.htm) installed, you should download and install it (don't worry, the coLinux installer will remind you about this, too). When you run the installer, it will try to install coLinux into C:\\Program Files\\coLinux. You should change this to C:\\coLinux, because the default configuration files expect to find it there. Plus, paths without spaces make everyone happier. When you're prompted to choose a Linux distribution, select the Debian installer. This will download a small compressed file that you'll later expand to about 1 GB. Sometime during the install, you'll get a Windows Logo compatibility-testing error message about the TAP-Win32 adapter, which is necessary if you want to use networking, so you'll need to click Continue Anyway and let Windows install it. When installation is finished, you'll be offered the opportunity to look at the README file. I know you would normally never do this, but with software that's this complicated, I think you should. Set Up the Debian ImageNow that coLinux is installed, there are a few more steps to get it configured. By now, I hope you've installed Cygwin, since you'll need to use some of the utilities from it to get things set up nicely. If not, go install it now and, when you're ready, open a Windows command prompt, then cd to the C:\\coLinux directory. You'll need to expand the filesystem image you downloaded. It's probably compressed with bzip, so you should use the bunzip2 utility from Cygwin to decompress it: C:\\coLinux>\\cygwin\\bin\\bunzip2 Debian-3.0r2.ext3-mit-backports.1gb.bz2
Next, you'll need to create a swapfile. Cygwin's dd is fine for this purpose. Windows has a utility called fsutil that can also create it, so either of these commands will create a 512 MB swapfile: > fsutil file createnew swap_device 536870912
> c:\\cygwin\\bin\\dd if=/dev/zero of=swap_device bs=1M count=512
Now you need to work on the configuration file. Copy default.colinux.xml to colinux.xml and open colinux.xml in your favorite text editor. Edit this file and make sure the paths to your filesystem image (default is root_fs) and swap device (default is swap_device) are correct. Bump up your memory size to whatever you feel comfortable setting aside (256 MB is good, assuming you have more than 512 MB of memory and don't plan to do something memory-intensive while your coLinux system is running). Now it's time to get the network connection set up. Go to Control Panel Finding the TAP adapter in Windows
Now you need to share your Internet connection. Locate your Internet connection in the Network Connections window, right-click on it, and select Properties. Go to the Advanced tab, click "Allow other network users to connect through this computer's Internet connection," and select the TAP adapter in the "Home networking connection" drop-down menu, as shown in Figure.
Sharing your Internet connection
Next, return to the Command Prompt and start colinux as a standalone process. You can run it as a daemon, but it's easier to debug this way. The -t NT option uses the Windows command prompt as the console, for easier cutting and pasting, and the -c option specifies the configuration filename: C:\\coLinux>colinux-daemon.exe -t NT -c colinux.xml Cooperative Linux Daemon, 0.6.3 Compiled on Sun Feb 5 20:25:03 2006 Linux version 2.6.11-co-0.6.3 (george@CoDebianDevel) (gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)) #1 Sun 384MB LOWMEM available. initrd enabled: start: 0xd7e10000 size: 0x001ef78a) On node 0 totalpages: 98304 You'll see the usual messages scroll by until you get a login prompt. Log in as root, with the password root. At this point, networking won't be working, since there are some hardcoded (and incorrect) values in /etc/network/interfaces. Run the command pump -i eth0 and check the output of ifconfig to see if you got an IP address from Windows connection sharing. If so, you can edit (you may want to do an apt-get update and then apt-get install vim or apt-get install emacs) /etc/network/interfaces and replace: iface eth0 inet static address 192.168.254.205 netmask 255.255.255.0 gateway 192.168.254.1 with: iface eth0 inet dhcp
At this point, you can issue the command halt inside of the coLinux distribution to shut down, start up coLinux again, and verify that networking is configured correctly on boot. Now you're ready to install Ubuntu.
Install UbuntuIt's pretty easy to turn Debian into Ubuntu, but for the smoothest transition, you should make sure you've got the latest and greatest Debian system, so do an apt-get update; apt-get upgrade. You also need to update a few things to make sure your system has the necessary versions to install Ubuntu. This should do the trick: $ sudo apt-get install sed locales
Next, edit /etc/apt/sources.list, delete everything in there, and insert the following lines: deb http://archive.ubuntu.com/ubuntu dapper main restricted deb-src http://archive.ubuntu.com/ubuntu dapper main restricted deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted deb http://security.ubuntu.com/ubuntu dapper-security main restricted deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted Now, it should theoretically be smooth sailing from here, but it probably won't be. To kick off the update, run apt-get update and then apt-get dist-upgrade.
During the upgrade, you will almost certainly get this error: E: This installation run will require temporarily removing the essential package e2fsprogs due to a Conflicts/Pre-Depends loop. This is often bad, but if you re ally want to do it, activate the APT::Force-LoopBreak option. E: Internal Error, Could not early remove e2fsprogs If so, add -o "APT::Force-Loopbreak=true" to the apt-get dist-upgrade command line, as in: $ sudo apt-get -o "APT::Force-Loopbreak=true" dist-upgrade
If you continue to get errors, run this command to clear things up: $ sudo apt-get -o "APT::Force-Loopbreak=true" -f install
Then, run the apt-get dist-upgrade command again, and it should run to completion. When it's done, you must apt-get install ubuntu-keyring so that apt-get can verify package signatures. Now you can start apt-getting what you need. Pick out some high-level applications, since this will pull in a lot of other dependencies. I'd suggest something like: $ sudo apt-get install firefox openoffice.org2 gnome-games
Do what you can to prevent Ubuntu from installing an X server, since that can only complicate things. Enabling SSHIf you'd rather not work in the coLinux console, you can SSH in to your coLinux system. First, run apt-get install ssh, then use ifconfig eth0 to determine your IP address, which will be on the private network that Windows assigned for Internet connection sharing, such as 192.168.0.143. Fire up PuTTY or openssh (available in Cygwin) to connect to that IP address. If you're using Cygwin, you may need to set your TERM to something other than cygwin, such as ansi: bjepson@thlon ~ $ ssh root@192.168.0.16 Password: Last login: Fri Mar 3 23:00:31 2006 from thlon.mshome.net Linux colinux 2.6.10-co-0.6.2 #5 Sat Feb 5 10:19:16 IST 2005 i686 GNU/Linux The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. colinux:~# Running X11 ApplicationsTo run any X11 applications, you'll need to ssh -X into your coLinux system from within the Cygwin X11 environment and launch applications from there. (You will probably need to enable X11Forwarding in Ubuntu's /etc/ssh/sshd_config and restart sshd with /etc/init.d/sshd restart to get this working. You'll need to apt-get xauth as well.) Now you're ready to start playing. Run the adduser username command to add a mortal user, and then you can log out as root. Next, start up a Cygwin shell on the Windows system, and run the Cygwin X server with the command startxwin.sh. When the xterm appears, use ssh -X IP_ADDRESS to log in to your coLinux system. Replace IP_ADDRESS with either the fixed private network address you assigned it or the latest one it got from DHCP (use ifconfig in the Ubuntu system to find this out). Once you're logged in, you can start running your favorite programs (see Figure)! Windows and Linux in perfect harmony
|
- Comment

TAP-Win32 adapter, highlighted in
