Gentoo Logo

Installing Gentoo Using Packages on the liveDVD


1.  Overview


Warning: Installing Gentoo from the liveDVD is a bad thing to do.

  • takes more sysadmin time than a normal install and less CPU time.
  • misses out practicing the skills needed to maintain a living Gentoo install
  • the update to todays gentoo will carried out it will be on a live system full of user data
  • provides a gentoo install as it was at the end of September 2009

The preferred method of installing gentoo is to use a stage3 tarball and a liveCD following the Gentoo Handbook. Any liveCD will do, including the Gentoo liveDVDs.

Second choice is a stage3 install supported by Sneakernet. This differes only in that things are fetched from the internet using a remote system or another operating system (or both) and loaded into the growing install manually. Portage still builds everything. The use of sneakernet is described elsewhere.

Important: Unpicking the LiveDVD as described here is a very poor third choice


This document describes how to install Gentoo using the packages provided on the liveDVD.

You will need four more files from the internet, these are

  4. and for for 10.1 DVDs only,

Fetch those files the same way as you did the orignal ISO

Access to the Gentoo Handbook is required as this guide makes frequent references to it, there is no point in repeating the handbook here.

2.  Getting Started

Partitioning and Making Filesystems

Follow the Gentoo Handbook, Chapters 1 to 4. Do not carry out Chapter 5 Follow the rest of this chaper instead

As we will make our install from the DVD, which is read only, we need to move a few DVD things to temporary writable space.

To do that we will make filesystems in files. They will be deleted at the end of your install and it avoids adding things to the root filesystem the DVD creates in RAM. Also, if you do not do the install in one go the filesystem is on your hard drive, so the work is not lost

The process involves making a copy of the liveDVD provided /var. First make some space

For writable temporary var make a filesystem in a file in /mnt/gentoo we will call it var_w

Code Listing 2.1: Make a 2G empty file

dd if=/dev/zero of=/mnt/gentoo/var_w bs=512 count=4096000

Format the 2G or so, empty file in with ext2 filesystem. Its a file, not a block special device, so accept the message from mke2fs

Code Listing 2.2: Format the file as ext2

mke2fs /mnt/gentoo/var_w

Code Listing 2.3: Make a temporary mount point

mkdir /mnt/gentoo/var_t

Code Listing 2.4: Mount the filesystem

mount -o loop /mnt/gentoo/var_w /mnt/gentoo/var_t

Code Listing 2.5: Copy the /var from the liveDVD

cp -a /var/* /mnt/gentoo/var_t

Mount it over the top of the liveDVDs /var so the liveDVD doesn't know the difference

Code Listing 2.6: Mount writable /var

mount -o loop /mnt/gentoo/var_w /var

/var contains a symlink back to the read only DVD db -> /usr/livecd/db that must be replaced

Code Listing 2.7: Copying /var/db/

cd /var
rm db
cp -a /usr/livecd/db ./

3.  Installing The Portage Snapshot

As the install is being accomplised without using a stage3 tarball, the normal directory structure it provides is missing from /mnt/gentoo. This guide makes the directories as needed.

Code Listing 3.1: Making the installs /usr directory

mkdir /mnt/gentoo/usr
cd /mnt/gentoo/usr

Important: Install the portage snapshot that was used to make the DVD following the processs in the handbook 5.c

In the event that you don't have networking, fetch the files remotely using a USB drive, and copy them to /mnt/gentoo/usr

Code Listing 3.2: Getting The Portage Snapshot and Package Lists


Check that the snapshot matches the digest, if not fetch the first two files above again.

Code Listing 3.3: Checking the digest

md5sum -c 20090921.tar.bz2.DIGESTS

Untar the portage snapshot. It will create the portage directory under /usr. Add the v option if you want to see progess

Code Listing 3.4: Untaring the portage snapshot

tar -xpjf 20090921.tar.bz2

The portage snapshot contains two symlinks to the liveCD read only filesystem. This file system will be 'cut off' outside the chroot, so the symlinks must be replaced with their actual contents

Creating the Package List

A single package list is needed to work with. First remove the unwanted data from ten_package_list.txt

Code Listing 3.5: Extracting the Package List

cut -f 1 ten_package_list.txt > pkglst100.txt

That is only the package list fro the 10.0 liveDVD processed. Follow the additional steps below for the 10.1DVD

Using nanos ctrl-k command Delete the lines

Changes to 10.1 Media Software Additions:

from the start of the file 10.1_changes.txt and likewise, the Kernel changes: line and everything following it from the file, leaving only the packages added to the 10.1 liveDVD Press ctrl-x, then y, to quit nano and save the changes.

Combine the two files to make one file called pkglst.txt

Code Listing 3.6: Combining the two Package List files

cat pkglst100.txt 10.1_changes.txt > pkglst.txt

Important: Fix for Bug 290509

Using nano add net-dns/avahi dev-libs/libdaemon to pkglst.txt

4.  Preparing the Chroot

make.conf in the install

Before /etc/make.conf is changed, copy it to the install, along with a few other things that are normally provided by the stage3

Code Listing 4.1: Copying /etc/make.conf

mkdir /mnt/gentoo/etc
cp /etc/make.conf /mnt/gentoo/etc/make.conf 
cp /etc/group /mnt/gentoo/etc/group
cp /etc/passwd /mnt/gentoo/passwd
cp /etc/shadow/ mnt/gentoo/shadow
cp /etc/profile /mnt/gentoo/etc/profile
cp -a /etc/portage /mnt/gentoo/etc
cp /etc/fstab /mnt/gentoo/fstab

Make mountpoints for special filesystems and /home, again, normally provided by the stage3

Code Listing 4.2: Making mount points for special filesystems

mkdir /mnt/gentoo/dev
mkdir /mnt/gentoo/proc
mkdir /mnt/gentoo/home

To make the liveCD use the portage tree in the budding intall a few portage defaults must be changed in the liveCD make.conf

Warning: This change will drop out at any reboot as it is made in the liveDVDs root in RAM filesystem

Add the following three lines to /etc/make.conf, using

Code Listing 4.3: Edit /etc/make.conf

nano -w /etc/make.conf

Setting the chroot /var

Portage needs some workspace in the chroot

Code Listing 4.4: Making Portage Workspace

mkdir -p /mnt/gentoo/var/tmp

The chroot needs its own copy of /var/db

Code Listing 4.5

cp -a /var/db/* /mnt/gentoo/var/db

Time for a few tests. If the following tests fail, fix things before proceeding

Code Listing 4.6: Testing the new settings

quickpkg --include-config=y gcc

This makes a portage binary package of gcc complete with all the config files - even ones that contain security information. There must be no error messages from quickpkg and the output package file will be shown by

Code Listing 4.7: Testing quickpkg

ls /mnt/gentoo/usr/portage/packages/sys-devel

as gcc-4.3.2-r3.tbz2, which is the version used to build the liveDVD 10.1

Provided that the above tests passed, the system is set up to quickpkg the whole DVD ... it will take a while. Several hours in a VMWare virual machine on my AMD 720 Phenom II X3 at 2.8GHz

Code Listing 4.8: quickpkg the whole DVD

while read ebuild; do quickpkg --include-config=y $ebuild; done < pkglst.txt

Hmm dev-java/j* is in package list but not in the DVD

Recap - Whats in the install so far

The portage tree exists with the replaced symlinks, make.conf exists, the security files exit, the /etc/portage that the liveDVD was built with exists and so do all the packages from the liveDVD in a binary form that emerge can use. Various odds and ends required to be able to chroot are still missing but all the bits are in /mnt/gentoo/portage/packages somewhere

Looking forward, lets cheat a little - unpack suffcient to chroot and use emerge -k but no more. Thats almost like stage1 install but there are some important differences. emerge cannot be used until we are in the chroot and the chroot does not exist until we unpack some things there. Its a little chicken and egg. However, the binary packages are tarballs with extra data appended. They can be unpacked with tar, provided we ignore the warning about extra garbage at end ignored.

About 5G of our install hard drive has been used so far but 2G will be recovered later when we delete the temporary wirteable /var for the liveDVD. Also, the package tarballs can be deleted when the install is complete.

5.  Chrooting

Making the chroot

Code Listing 5.1: Setting make.profile

cd /mnt/gentoo/etc
ln -s ../usr/portage/profiles/defulat/linux/x86/10.0/desktop

Having made the packages we need, making the chroot is only a question of untaring them there. We will need glibc (everything uses that) bash, portage and python at the very least.

Make friends with tab completion before you attempt the following. Type a few letters of a path name and press tab. If the fragment is ambiguious, the alternatives will be shown. Type a few more letters and press tab again.

Important: Version numbers will vary with different liveDVDs and are not a cause for concern - tab completion will find the only version provided

Code Listing 5.2: Unpacking some key tarballs

cd /mnt/gentoo/usr/portage/packages
tar -xjpf sys-apps/portage- -C /mnt/gentoo
tar -xjpf app-shells/bash-4.0_p28.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/glibc-2.9_p20081201-r2.tbz2 -C /mnt/gentoo
tar -xjpf dev-lang/python-2.6.2-r1.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/ncurses-5.6-r2.tbz2 -C /mnt/gentoo
tar -xjpf sys-libs/zlib-1.2.3-r1.tbz2 -C /mnt/gentoo
tar -xjpf sys-apps/coreutils-7.4.tbz2 -C /mnt/gentoo
tar -xjpf app-arch/bzip2-1.05-r1.tbz2 -C /mnt/gentoo
tar -xjpf app-arch/tar-1.20.tbz2  -C /mnt/gentoo
tar -xjpf sys-apps/acl-2.2.47.tbz2  -C /mnt/gentoo
tar -xjpf sys-apps/sed-4.2.tbz2  -C /mnt/gentoo
tar -xjpf sys-apps/attr-2.4.43.tbz2  -C /mnt/gentoo

Mount /proc and /dev inside the chroot

Entering the chroot

Code Listing 5.3: Entering the chroot

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

Set the profile from inside the chroot - then its as per the handbook - can't we don't have ln - so do this from outside

Symlink /usr/bin/python2.6 to python because python is slotted and we don't have eselect yet, likewise - do this before chroot

Important: -1 == --oneshot so the package is not added to the world set

Important: -K == --usepkgonly use binary packages only, do not attempt to build any packages

Code Listing 5.4: emerging system

emerge -K1eav system

Ignore sandbox errors and Environment errors. When emerge fails, its because gcc and baselayout are not installed

Code Listing 5.5: adding gcc and baselayout then emerge system again

emerge -K1av gcc baselayout
emerge -K1eav system

6.  Installing World

Choices - A subset of World from the LiveDVD

The world file in the install is presently empty as only system and its dependencies are installed. Now there is a choice.

Contine with emerge -K <package>

Installing the Complete World Set from the LiveDVD

Copy the world file from outside the chroot to inside the chroot and feed it to a script like the one used for quickpkg above

Warning: The dependaces of these packages are not optional on this install as the USE flags are all preset

7.  Getting ready to reboot

Making the Kernel

The liveDVD provides gentoo-sources-2.6.30-r5. Install the sources, configure and install the binary as described in the Gentoo Handbook Chapter 7

Important: Add the -K option to the emerge command given in the handbook

The liveDVD provides genkernel which can optionally be use to build your kernel. Its use is describled in the Gentoo Handbook Chapter 7.

Important: Add the -K option to the emerge command given in the handbook

Configuring your System

Follow Gentoo Handbook Chapter 8.

Important: Add the -K option to the emerge command given in the handbook

Installing Necessary System Tools

Follow Gentoo Handbook Chapter 9.

Important: Add the -K option to the emerge command given in the handbook

syslog-ng is provided on the liveDVD. This logger must be selected.

vixie-cron is provided on the liveDVD. This cron daemon must be used

All the other options offered in Chaper 9 of the handbook are provided on the liveDVD

Important: Add the -K option to the emerge command given in the handbook

Making the Boot Loader

The liveDVD provides both grub-0.97-r9 and lilo-22.8-r2 Install the bootloader of your choice as described in the Gentoo Handbook Chapter 10.

Important: Add the -K option to the emerge command given in the handbook

8.  Tiding Up

After you are happy with the install, you can remove the following files

  • /var_w
  • /usr/ten_package_list.txt
  • /usr/pkglst100.txt
  • /usr/10.1_changes.txt
  • /usr/pkglst.txt
  • /usr/portage/packages


Page updated October 25, 2009

Summary: This document describes how to manipulate the contents of the liveDVD to extract packages and subsequently install to a hard drive using those binary packages

Roy Bamford
Roy Bamford

Donate to support our development efforts.

Copyright 2001-2015 Gentoo Foundation, Inc. Questions, Comments? Contact us.