Gentoo Logo
Gentoo Logo Side

Gentoo 1.4_rc2 in RedHat 8.0 using UML



This document describes one case to install Gentoo Linux 1.4_rc2 into RedHat 8.0 using User Mode Linux.

Warning: This document is still under revising. Besides, the link to the original document doesn't work. Sorry for the inconvenience.

Gentoo in RedHat? Yes, actually. If you want to try Gentoo and you have free partition in your disk, you can install Gentoo just by following the standard installation procedure (e.g. one for x86). But some of you cannot do it due to lack of free partition or disk, just because you have already assigned entire disk space to your former installation. You would have some other reason to leave the current OS. In those cases, UML (User Mode Linux) will be a choice. UML is a linux kernel runs as a non-root user process. Necessary filesystems are given as files. You can install any distribution using UML if its installer works well on UML. But it seems that always some hacks are necessary for it because an installer has to check devices automatically but UML doesn't have it.

If you are using Gentoo and want to run UML with Gentoo, see Gentoo Linux Developer's guide to system testing with User-Mode Linux . If you are using rpm-based distro and plan to run UML with rpm-based distro, UML Builder will help you a lot. But I wanted to install Gentoo but leave RedHat as I used before. I found no document targetting such specific case, so I thought it would be nice to write a document for it.

I didn't research so deeply why these steps are required. I just followed the boot sequence and added some steps required on UML. In case you find faster/simpler procedure than I wrote, please give me a feedback.

Important: Reference: Gentoo Linux 1.4_rc2 Installation Instructions and Gentoo Linux Developer's guide to system testing with User-Mode Linux.


  1. Install Gentoo 1.4_rc2 into UML on RedHat 8.0 in an x86 machine.
  2. Without compiling UML kernel. Use the standard UML kernel 2.4.19-5um provided in the RPM file available from UML Project.


Summary in short 

This chapter describes what to be prepared to boot up the installer in UML.
file deescription
gentoo-basic-x86-1.4_rc2.iso LiveCD ISO image
initrd RAM disk image to boot at first
livecd filesystem for installation: converted from /livecd.cloop in the ISO image filesystem
rootfs_gt1.4 root filesystem for UML you install Gentoo
swapfs swap filesystem for UML

Warning: Additionally you need to install UML using RPM file. It will require root privilege on the host system and the use of the command rpm.

If you know how to prepare them, or you already made it and going through the procedure described in this page, go boot.

Extract initrd from ISO image 

Code listing 3.1

% isoinfo -i /path/to/gentoo-basic-x86-1.4_rc2.iso -x '/ISOLINUX/INITRD.;1' > initrd

Kernel starts with initial ramdisk image (aka initrd). It is usually on a bootable intstall CD with a kernel and starts at the CD booting procedure. You will have to do it with the UML kernel. So you have to extract initrd in advance.

Retrieve cloop extractor and extract livecd 

livecd.cloop is another filesystem which contains the installation environment used after the first boot. It is mounted via the compressed loopback (aka cloop) filesystem in a normal installation procedure using LiveCD. But the standard UML kernel available at the UML project page cannot use cloop module in the LiveCD. So I decompressed it in my preparation stage so that I can easily mount it in a normal way. This section consists of two steps.

The first step is to make the decompress command. It is provided in a cloop package available at Knopper's website.

Code listing 3.2

% wget
% tar xzf cloop_0.66-1.tar.gz
% cd cloop-0.66
% vi Makefile // Insert APPSONLY=1 at the top section
% make zcode
% make extract_compressed_fs
% cd ..

The second step is to extract livecd.cloop and decompress it.

Code listing 3.3

% isoinfo -i /path/to/gentoo-basic-x86-1.4_rc2.iso -x '/LIVECD.CLOOP;1' > livecd.cloop
% cloop-0.66/extract_compressed_fs livecd.cloop > livecd

Note: livecd is an ext2 filesystem.

Install UML and extract modules for 2.4.19-5um 

Here you need to run UML with a pre-built UML kernel and a pre-built filesystem. It will not take time if you install UML using RPM file. After that, boot the UML kernel and log in as root. Please refer other documents for details to run a UML kernel with a pre-built non-Gentoo filesystem.

After starting you UML with non-Gentoo distro, you need to extract module files to avoid errors during UML network configuration for your Gentoo installation later. Just make a tarball of modules from UML.

Code listing 3.4

// Get user_mode_linux- and root_fs.rh-7.2-full.pristine.20020312 here.
% /bin/su // to become root
# rpm -ivh user_mode_linux-
# ^D // to return to your shell
% linux ubd0=root_fs.rh-7.2-full.pristine.20020312
// Here, log in the UML system as root.
# mkdir /mnt/loop
# mount none /mnt/loop -t hostfs -o /path/to/gentoo-working-dir
# cd /
# tar cf /mnt/loop/modules-2.4.19-5um.tar lib/modules/2.4.19-um
// Shutdown the UML system.
# shutdown -h now

Important: /path/to/gentoo-working-dir is the path of the working directory in your host filesystem.

Create root and swap filesystem 

You will need root filesystem and swap filesystem as a normal file to install Gentoo Linux into. This example configures the size to 500MB for / and 200MB for swap.

Code listing 3.5

% dd if=/dev/zero of=rootfs_gt1.4 seek=500 count=1 bs=1M
% mke2fs -F rootfs_gt1.4
% dd if=/dev/zero of=swapfs seek=200 count=1 bs=1M
% mkswap -f swapfs

Check your preparation 

Check if you get these files in your working directory.

Code listing 3.6



Boot the installer with the UML kernel 

Code listing 4.1

% linux \
	devfs=nomount \
	mem=96m \
	load_ramdisk=1 \
	prompt_ramdisk=0 \
	ramdisk_size=60000 \
	initrd=initrd \
	root=/dev/ram0 \
	ubd0=rootfs_gt1.4 \
	ubd1=swapfs \
	eth0=ethertap,tap0,,192.168.x.x \

Warning: IP address in the command line has to be modified to assign your host's IP to the tap device.

Important: Some of the kernel command line options could be unnecessary or need to be modified to fit your case.

In this "booting" there is an IP address specified in the kernel options. This is an address for tap0, which is a virtual device to route packets between the host and UML. It is okay to specify the same IP address which is assigned to the host's real device. The IP address for the UML virutla machine will be configured later.

Initial RC command 

Code listing 4.2

# /linuxrc
After invoking /linuxrc, you will be requested to select the keymap. Then, you will get an error that CD drive is not detected. That's okay because your UML kernel doesn't have any CD drive, though your host system should have.

Important: You may want to start the kernel with init=/linuxrc argument. In that case, you don't get the virtual consoles and important error output during installation will go away with the normal output.

Mount ISO image in your host 

Now you are running UML kernel with (virtually) no CD drive, but the CD image file is on your host's current directory. You can use it within UML by mounting the host's filesystem.

Code listing 4.3

# mkdir -p /mnt/host
# mount none /mnt/host -t hostfs -o /path/to/gentoo-working-dir
# mount /mnt/host/gentoo-basic-x86-1.4_rc2.iso /newroot/mnt/cdrom -o loop
# mount -o ro,loop -t ext2 /mnt/host/livecd /newroot/mnt/cloop

Continue the boot process by hand 

Code listing 4.4

# cd /newroot
# ln -s mnt/cloop/bin
# ln -s mnt/cloop/sbin
# ln -s mnt/cloop/boot
# ln -s mnt/cloop/usr
# ln -s mnt/cloop/opt
# mkdir initrd proc tmp
# chmod 1777 tmp 
# (cd /newroot/mnt/cloop; cp -a etc root home var lib /newroot)
# tar xf /mnt/host/modules-2.4.19-5um.tar
# echo "6" > /proc/sys/kernel/printk
# umount /proc
# pivot_root . initrd
# chroot .

5.After chroot

Configure UML network 

Code listing 5.1

# mount /proc
# net-setup eth0

Important: You have to assign different IP from the UML tap's.

Warning: The author couldn't configure well on the host which has two network connections and host's eth0 was not connected. If you are trying that case, please check the routing command lines shown on the virtual console. The author recommends to use a host with only one network device.

Optional: Proxy configuration 

If you use a proxy to access outside, set these variables.

Code listing 5.2

# export http_proxy=""
# export ftp_proxy="$http_proxy"
# export RSYNC_PROXY="$http_proxy"

Mount filesystems for installation 

Code listing 5.3

# swapon /dev/ubd/1
# mkdir /mnt/gentoo
# mount /dev/ubd/0 /mnt/gentoo
# mkdir /mnt/gentoo/proc
# mkdir /mnt/gentoo/dev
# umount /proc
# cd /mnt/gentoo
# tar xjpf /mnt/cdrom/gentoo/stage1-x86-1.4_rc2.tbz2
# mount -o bind /proc /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# nano -w /etc/resolv.conf
# cp /etc/resolv.conf /mnt/gentoo/etc
# chroot /mnt/gentoo /bin/bash

Warning: If you forget to swapon, installation would fail due to lack of memory space.

6.After chroot again

Try to emerge! 

Code listing 6.1

# env-update // You will get an error that /etc/make.profile not found.  Just ignore it.
# source /etc/profile
# emerge sync
// Again just for sure
# env-update 
# source /etc/profile
# emerge sync // This won't take long this time.

7.Installation continues...

Here you reached just at the start line of the the normal installation from stage1 tarball.

Starting Stage1 

Code listing 7.1

# cd /usr/portage
# scripts/bootstrap

Note: It will take quite a while for this stage because UML is rather slow especially for disk access. In the author's case, it doesn't finish in half a day using a notebook (PCG-C1VSX/K) with a TM5600@667MHz and 256MB memory and running a UML kernel with mem=128m.

Warning: In arthor's case, the UML kernel finally stopped with a message of out of memory followed by kernel panic.

Stage2 and more 

You will need to go on to the next stage. Just follow the instruction shown in Gentoo Linux 1.4_rc2 Installation Instructions.

Warning: At least you will need to emerge some times and umount two filesystems for Gentoo and swap for UML after the installation of Gentoo 1.4_rc2.

Note: This document describes only the case using Stage 1 tar ball. You can use Stage 2 or 3 tar ball to accelerate your installation.

Important: This document doesn't cover whole installation procedure after Stage 1. You are encouraged to refer to the installation-related documents: Gentoo Linux 1.4_rc2 Installation Instructions and Gentoo Linux Developer's guide to system testing with User-Mode Linux.

8.Starting your UML with Gentoo 1.4_rc2

Once you install Gentoo 1.4_rc2, you can start it simply with no network configuration:

Code listing 8.1: Starting Gentoo 1.4_rc2

% linux ubd0=root_gt1.4 ubd1=swapfs

or with some more arguments:

Code listing 8.2: Starting Gentoo 1.4_rc2 #2

% linux umid=Gentoo1.4_rc2 ubd0=root_gt1.4 ubd1=swapfs mem=128m eth0=ethertap,tap0,,192.168.x.x

Warning: Again, IP address in the command line has to be modified to assign your host's IP to the tap device.

Updated 10 February 2003
Masanori Omote

Summary: This document describes a procedure to install Gentoo Linux 1.4_rc2 in RedHat 8.0 using User Mode Linux, to smash a barrier for non-Gentoo distro users to dive into Gentoo Linux. It will also help Gentoo system developer to test Gentoo system.

Donate to support our development efforts.

DDR Memory at

Purchase RAM from and a percentage of your sale will go towards further Gentoo Linux development.


Looking for the right Web designer? is the world's largest directory of Web developers and other marketing-oriented firms. Use's free "Editor's Pick" service to find the Web design team that meets your exact needs.

Are you a Web designer? Then place a featured listing on to get noticed world-wide!

When you use "Editor's Pick" or place a featured listing, will donate a portion of revenue to the Gentoo Linux free software project.

Copyright 2001-2003 Gentoo Technologies, Inc. Questions, Comments, Corrections? Email