Please note that this is still a work in progress. I tried updating the original 2006 image and ran into nothing but grief. So here's a quick and dirty on the steps I took to build my own 2008 Portable Gentoo. Enjoy!

Create Directory Structure[]

Create the following directory structure:


Download and Unpack Installation Files[]

Download the following files[]

Unpack files as follows[]

  • Extract the following files from Portable_Ubuntu.exe to your Portable_Gentoo directory using 7zip:
The entire pulseaudio subdirectory
The entire Xming subdirectory tree
  • Extract the following files from the coLinux self-installing binary to your Portable_Gentoo directory using 7zip:
  • Copy these two files to your share subdirectory:
  • Also, copy the file example.conf to your gentoo subdirectory and rename it to gentoo.conf.
  • Extract the file gentoo-root from the Gentoo-colinux file to your gentoo subdirectory using 7zip.
  • Move the Gentoo stage3 and portage files to your gentoo subdirectory.

Run the initial version of coLinux[]

  • Create an empty container for your new root file system with the following command. The example creates a 10G (10,737,418,240) file, but you can run it with as small a file as 2G (2,147,483,648).
fsutil file createnew Portable_Gentoo\gentoo\2008_root_fs 10737418240
  • Edit the file gentoo.conf as follows:
    • Change cobd0="c:\coLinux\root_fs" to cobd0=gentoo\gentoo-root.
    • Add the line cobd3=gentoo\2008_root_fs.
    • Set a maximum memory, mem=256 is probably the lowest you'll want to set it to.
    • Enable eth0 by uncommenting eth0=slirp
    • Add the line exec0="Xming\Xming.exe :0 -notrayicon +bs -wm -auth Xauthority -clipboard -multiwindow -dpi 100 -xkblayout us" (change the xkblayout to your liking ;-)
    • Setup two shares with the lines cofs0=gentoo and cofs1=share.
  • Rename the file portable_ubuntu.bat to portable_gentoo.bat and edit it so that the line is colinux-daemon @gentoo\gentoo.conf cobd1=%temp%\swap.img cobd2=%temp%\temp.img -t nt.
  • Rename the file run_portable_ubuntu.bat to run_portable_gentoo.bat and edit the first line to be start trayrun.exe cmd /c portable_gentoo.bat.
  • Now go ahead and run the run_portable_gentoo.bat batch file to launch the initial version of Gentoo coLinux!

Prepare for chroot[]

Run the following commands. You could put it in a script, but it's probably better to run each command individually and confirm success.

cd /
mkdir config share
mount -t cofs -o user,dmask=0777,fmask=0666 cofs0 /config
mount -t cofs -o user,dmask=0777,fmask=0666 cofs1 /share

mke2fs /dev/cobd3
dd if=/dev/zero of=/dev/cobd3 bs=1M    # Fill the HDD with 0's. This speeds up future writes?
mke2fs -j /dev/cobd3
mount /dev/cobd3 /mnt/gentoo
mkdir /mnt/gentoo/dev
mount -o bind /dev /mnt/gentoo/dev

cd /mnt/gentoo
mkdir config share
tar xjpf /gentoo/stage3*.tar.bz2

cd /mnt/gentoo/usr
tar xjf /share/portage-latest.tar.bz2

cd /
cp -L /etc/resolv.conf /mnt/gentoo/etc/
cp /etc/conf.d/net /mnt/gentoo/etc/conf.d/net
cp -L /share/vmlinux /mnt/gentoo/boot/kernel
cp -L /etc/make.conf /mnt/gentoo/etc/make.conf
mount -t proc proc /mnt/gentoo/proc

Configure your new root image[]

chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
#Set this to your timezone
cp /usr/share/zoneinfo/America/New_York /etc/localtime
cd /etc
#Set these to your chosen hostname
echo " colinux localhost" > hosts
sed -i -e 's/HOSTNAME.*/HOSTNAME="colinux"/' conf.d/hostname
hostname colinux
rc-update add net.eth0 default

echo '/dev/cobd0              /               ext3            noatime         0 1' > /etc/fstab
echo '/dev/cobd1              none            swap            sw              0 0' >> /etc/fstab
echo 'proc                    /proc           proc            defaults        0 0' >> /etc/fstab
echo 'shm                     /dev/shm        tmpfs           nodev,nosuid,noexec        0 0' >> /etc/fstab
echo '#cofs0                   /config cofs    user,dmask=0777,fmask=0666      0 0' >> /etc/fstab
echo 'cofs1                   /share  cofs    user,dmask=0777,fmask=0666      0 0' >> /etc/fstab

#Set your root's password
passwd root
#Fix the console font error
mv /bin/setfont /bin/setfont.old
echo '#!/bin/bash' > /bin/setfont
echo 'if ! uname -r | grep -q -e "-co-"' >> /bin/setfont
echo 'then' >> /bin/setfont
echo '	/bin/setfont.old $@' >> /bin/setfont
echo 'fi' >> /bin/setfont
chmod +x /bin/setfont
ln -s /usr/bin/loadkeys /bin/loadkeys

Remaining Procedures[]

#Now, back in windows

edit config/Portable_Gentoo.conf
--- cobd0=images\gentoo-root
--- cobd3=images\2008_root_fs
+++ cobd0=images\2008_root_fs

#Run Portable_Gentoo
emerge mirrorselect
#Grab the fastest 5 servers
mirrorselect -s5
emerge --sync
emerge portage
emerge htop lynx sys-devel/libtool net-libs/gnutls
/etc/init.d/sshd start
rc-update add sshd default
#This'll take some time:
USE="consolekit" emerge sys-auth/pambase
#And this took near a day, though, in fairness, I had 4 devenv.exe's, an RDP, iTunes, and 5 other programs running
USE="X" emerge sys-apps/dbus gnome-panel
#Fix dependencies for gnome-panel
emerge gentoolkit

#This fixes a circular dependency when installing xorg-x11
emerge --nodeps virtual/glu
emerge xorg-x11
emerge x11-terms/xterm
#First time use requires a UUID
dbus-uuidgen --ensure
/etc/init.d/dbus start
rc-update add dbus default

#because white is so harsh on the eyes
echo 'XTerm*background:   black' >> ~/.Xdefaults
echo 'XTerm*foreground:   white' >> ~/.Xdefaults
echo 'XTerm*highlightColor:  red' >> ~/.Xdefaults

#FINALLY! Launch the panel!
export DISPLAY=
gnome-panel &

#Add a file browser
emerge nautilus

#udev version 145 requires 2.6.25 or more and coLinux kernel is 2.6.22 as of this writing, you might want to mask this version:
echo '>=sys-fs/udev-145' >> /etc/portage/package.mask

emerge --update world