This document details how to install Gentoo Linux (http://www.gentoo.org) with coLinux.
This document was written using Gentoo 2006.1 and coLinux 0.6.4. I beleive this document is generic enough to be used with future versions of Gentoo and coLinux with only minor modifications.
Note: These instructions assume you know what you're doing with a Gentoo install, and that you have enough knowledge of how coLinux works that you won't need help modifying or creating the configuration file.
- Install coLinux with the Gentoo image download it provides. This may work with the Debian image, but I didn't try it.
- On your Windows file system, in the directory you want to store your coLinux image, create your root and swap files. I made a 10G root and 256M swap. There is a (mis-named) wiki on how to create files suitable for coLinux block devices. See HowtoCreateSwapFile.
- Be aware that fsutil (XP and later) makes spares files. This means the first time you write data to a block it takes longer than subsequent times. ie: your mkfs is going to take longer than you think ;) Ditto for the first time you start writing out files and using swap. To avoid this, don't use sparse files. Personally, I didn't mind as sparse files are instant-create and let me continue with setting up coLinux without waiting for large files to be initialize and written to and performance hit for 'first use' isn't terrible.
- Edit your coLinux config files to recognize your "new" root and swap as if they were /dev/cobd2 and and /dev/cobd3
- Boot coLinux using the Linux image you downloaded. We will use this as the Gentoo Install image.
- Start following the installation guide at http://www.gentoo.org/doc/en/handbook/handbook-x86.xml. There are only a small handfull of differences that need to be made:
- In section 4.c (Using fdisk to Partition your Disk), You don't partition your "virtual" disk. If you want separate "partitions" use multiple files on the Windows side.
- In section 4.d (Creating Filesystems), I use reiserfs on my virtual disk. I had to download and compile the reiserfstools (for v3) into my non-chroot environment as they were not part of the initial image. This is trivial. They are available from http://www.namesys.com/ and you don't even have to do the full install, just get to the point where you have mkreiserfs available.
- In sections 5.b/5.c (installing the initial stage tarball) Getting the stage tarball has multiple options:
- If your network is set up to access the internet, section 5.b (Using a Stage from the Internet) works perfectly.
- If you are instead using section 5.c (Using a Stage from the Installation CD), you can use scp to transfer the stage tarball to the coLinux installation if you have networking enabled, but not set up for Internet use.
- Another option if using 5.c is to mount your CD drive in coLinux itself for use. See CdDvdAccess.
- Section 7.b (Installing the Sources), it's still safe to install kernel sources (may even be required for some things you want to install later) but don't compile your own kernel! See the next point.
- Section 7.c/7.d (Detailing two different methods of kernel configuration), don't do this! Use the kernel and modules that came with the initial image you downloaded. The kernel itself is kept on the filesystem in your Windows boot. To "install" the kernel modules, do this from your non-chrooted installation image:
- Section 8.a (Filesystem Information), make sure to set up your fstab with the /dev/cobd devices that they will be in your final image (ie: root as /dev/cobd1, swap as /dev/cobd2) not what they are now.
- Chapter 10 (Configuring the Bootloader), you don't need a boot loader. I installed grub anyway just in case something in the future insisted on having a bootloader around, but I did not configure it.
# mkdir -p /mnt/gentoo/lib/modules # tar -cf - /lib/modules | (cd /mnt/gentoo/lib/modules && tar -xvpf -)
And that's really about it! The rest of the install is identical to the installation guide. Once you get done, shutdown your coLinux Gentoo install image, modify or create a new config file for coLinux to point the block devices to your new root/swap, and start it up again!
Enjoy your new coLinux setup! I've actually used this procedure through many iterations of Gentoo releases whenever I did a windows re-install for whatever reason, so these are not specific to 2006.1 (however chapter/section numbers may change between releases)
With versions prior to 0.7.0, you may want to comment-out or remove:
<initrd path="initrd.gz" />
from your config file. For some reason, some people report that using the initrd causes coLinux to only boot properly every second time (I was one of them, until I found this).
With versions after 0.7.0, you will want to edit /etc/inittab and change:
ca:12345:ctrlaltdel:/sbin/shutdown -r now
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now
This will let coLinux shut down properly, particularly as a service.