Installation alternatives

This guide is meant to be a repository of alternative Gentoo installation methods, for those with special installation needs such as lack of a CDROM or a computer that can't boot CDs.

About this document
If the standard boot-from-CD install method doesn't work (or it is not possible to use, or is just disliked), some help can be found here. This document serves to provide a repository of alternative Gentoo Linux installation techniques to those who need them. Or, if preferred, it serves as a place to put wacky installation methods. If there is an installation method that has been found useful, or the reader has devised an amusing way of installing Gentoo, please don't hesitate to write something up and post it on Bugzilla.

Booting the Install CD with Smart BootManager
Download Smart BootManager available from http://btmgr.sourceforge.net/download.html. Linux source or binary format and windows versions are available as well as many language packs. However, at this time, the preferred method would be to use the binary format, as the source will not compile with newer versions of NASM.

Either compile the package from source or just grab the binary. There are several options that can be utilized while creating a boot floppy, as seen below.

Use to build the boot floppy:

Now simply place the floppy in the floppy drive of the computer, as well as placing the Install CD in the CD-ROM and boot the computer.

The Smart BootManager dialog will appear. Select the CDROM and press the (Return) key to boot the Install CD. Once booted proceed with the standard installation instructions.

Further information on Smart BootManager may be found at http://btmgr.sourceforge.net/.

Introduction
It is possible to boot some other LiveCD besides the Gentoo-provided CDs. This will provide a functional environment to use while compiling and installing Gentoo. The instructions provided here should work in principle with just about any other LiveCD.

There are too many LiveCDs out there to list, but one option might be trying Knoppix. It provides a full graphical desktop, with office applications, web browsers, and games to keep busy. Knoppix is only available for x86 users, so depending on requirements another LiveCD or method may have to be chosen.

Installation instructions
Boot from the LiveCD. Open a terminal and run so the password can be changed. This allows to set the root password for the CD. The sshd daemon can now be configured for remote login if it's required to install Gentoo remotely. Next, creating the mount point is necessary.

At this point, the standard install documentation can be picked up at Preparing the Disks. However, when asked to mount the proc system, issue the following command instead:

When it's time to unpack the stage tarball in Unpacking the stage tarball, it will be required to use different command options to ensure that proper group IDs are enforced on the unpacked stage:

If Ubuntu is being used, note that is a symbolic link to. It must be bind mounted or a tmpfs created at this location (within the chroot path). On the system before chroot'ing:

This is to avoid where Python sees   as broken (due to lack of ) and Portage seeing that as an error (technically Python configuration would continue and build assuming the POSIX_SEMAPHORES_NOT_ENABLED variable has been enabled but this would lead to a very undesired Python build).

Once ready to chroot into the unpacked stage in Installing Base System, a different chroot command sequence will need to be used. This ensures that the environment variables are properly setup.

Finally, know that some Portage FEATURES may not work in the LiveCD. Especially watch out for  and. If there are errors, it might be wise to disable some or all of the optional FEATURES.

Diskless install using PXE and kernel/initrd/squashfs from the LiveCD
This method is easier to configure than PXE boot based on iSCSI or NFS. Multiple machines can boot from the same set of images distributed via TFTP and can be easily extended to also work over HTTP or other protocol.

Some other distributions including Fedora already distribute images needed to bootstrap a live or installation CD but with Gentoo it's necessary to (1) extract kernel, initrd and squashfs from the live CD, (2) patch initrd contents and (3) merge squashfs into initrd. Only then it is possible to configure a PXE based boot loader that will load the images and boot into a live system.

Save the following script and make sure it is executable and in $PATH or follow its steps manually.

Download (or try with the current version if it differs). Install, make sure it serves and start it.

Run the script with the appropriate parameters.

Now the tftp boot service is ready and a DHCP service needs to be configured. It is possible to set up a DHCP server on the same machine and make sure booted machines are connected to it, or just tweak the configuration of an existing router.

Example configuration for OpenWRT dhcp service follows:

Requirements
PXE (Preboot eXecution Environment) is a method for booting computers over a PXE-capable network interface (and using a PXE-supporting BIOS). It is also supported as a boot method from block devices (like CDs or USBs) in case the system does not support PXE boot from the network interface or BIOS. In such cases, a minimal boot environment mimics the PXE supporting network card (see also Etherboot/gPXE).

Server base setup
Create directories: The first thing to do is to create the directories where the diskless system will be stored. Create a directory called which houses a directory for each diskless client. For the rest of this howto as an example the client that is being worked on will be called 'eta'.

DHCP and TFTP setup: The client will get boot informations using DHCP and download all the required files using TFTP.

For dhcpd, just run (or any other DHCP server of choice). Make sure that the correct interface is selected in, and configure it to suit. Then, add the following on.

Next configure the interface in so that it doesn't get cleared at bootup. See for more information.

For TFTP, emerge. In, put the following:

Setup GRUB: Older versions of GRUB used the  USE flag to create a PXE image.

Install GRUB.

Once GRUB is compiled, create the diskless client's boot directory.

Original way was to copy the PXE image to the diskless client but the path doesn't seem to exit any more.

Then edit its config file.

Setup NFS: NFS is quite easy to configure. The only thing that has to be done is to add a line on the config file:

Update the hosts: One important thing to do now is to modify the file to fit requirements.

Creating the system on the server
There may be a desire to reboot the server with a Gentoo Install CD, although it's possible to very well continue immediately if it's known how to proceed with the Gentoo Installation Instructions from an existing installation. Follow the standard install procedure as explained in the Gentoo Handbook BUT with the following differences: When mounting the file system, do the following (where is the partition where the  directory was created). It is not required to mount any other partitions as all of the files will reside in the directory.

Stage tarballs and chroot: This example uses a stage3 tarball. Mount to the diskless directory and chroot into it to continue with the install. Then follow the installation manual until kernel configuration.

Kernel configuration: When doing the of the kernel configuration, don't forget to enable the following options with the others recommended into the install guide.

Save the kernel in the chrooted (not in ) according to the pxegrub setting defined earlier. Next configure the diskless client's.

Now to prevent the client from running a filesystem check:

Install since the client will heavily depend on it:

Bootloader. Don't install another bootloader because there is already one - pxegrub. Simply finish the install and restart the server. Start the services that are needed to boot the new client: DHCP, TFTPD, and NFS.

Booting the new client
For the new client to boot properly, the BIOS and the network card need to be configured to use PXE as the first boot method - before CD-ROM or floppy. For help with this consult the hardware manuals or manufacturers website. The network card should get an IP address using DHCP and download the GRUB PXE image using TFTP. Then, a nice black and white GRUB bootmenu should be displayed where it's possible to select the kernel to boot and press the (Return) key. If everything is ok the kernel should boot, mount the root filesystem using NFS and provide a login prompt. Enjoy.

Requirements
In order to install Gentoo from an existing Linux distribution it needs to have the chroot command installed, and have a copy of the Gentoo installation tarball or ISO that's desired to install. A network connection would be preferable if there is a requirement for more than what's supplied in the tarball. (by the way, a tarball is just a file ending in or ). Let's get started!

Overview
First allocate a partition to Gentoo by resizing an existing Linux partition, mount the partition, untar the tarball to the partition that is mounted, chroot inside the pseudo-system and start building. Once the bootstrap process is done, then do some final configuration on the system so as to make sure it boots, then it's time to reboot and use Gentoo.

How should space be made for Gentoo?
The root partition is the filesystem mounted under. A quick run of on a system shows an example. Also an example uses (disk free) to see how much space there is left and how it will be resized. Note that it is not mandatory to resize the root partition! Anything else supported by the resizer can be resized, but let's talk about that later.

As it can be seen, the partition mounted as named  has 2.4 GB free. In this case, it was decided to be resized as to leave 400 MB of free space, therefore allocating 2 GB for Gentoo. Not bad, it could have quite some stuff installed. However, it is thought that even 1 GB is enough for most users. So now partition this thing!

Building parted to resize partition
is an utility supplied by the GNU foundation, an old and respectable huge project whose software you are using in this very moment. There is one tool, however, that is extremely useful at the moment. It is called, partition editor it can be found at http://www.gnu.org/software/parted/.

Look up on that page the type of file system to resize and see if parted can do it. If not, it may be tough luck, it may be required to destroy some partition to make space for Gentoo, and reinstall back. Go ahead by downloading the software, install it. Here there is a problem. The Linux root partition needs to be resized, therefore a floppy disk with a minimal Linux system must be booted and to use a previously-compiled parted copied to a diskette in order to resize. However, if the partition can be unmounted the while still in Linux be considered lucky, because then it is not needed to do what follows. Just compile parted and run it on a chosen unmounted partition to resize. Here's how it was done on this system.

Get the mininux boot/root disk (a 2.4-powered mini Linux distribution on a floppy - free of charge) from http://mininux.free.fr/uk/, create a floppy as suggested in the Documentation that accompanies the software package and insert a new floppy in the drive for the next step.

Now it's time to proceed with the build of parted. If it's not already downloaded and untarred, do so now and into the corresponding directory. Now run the following set of commands to build the utility and copy it to the floppy disk.

Congratulations, now it's time to reboot and resize the partition. Do this only after taking a quick look at the parted documentation on the GNU website. The resize should take under 30 minutes for the largest hard-drives, be patient. Reboot the system with the mininux boot disk (just pop it inside), and once logged in, switch the disk in the drive with the utility disk that was created above and type to have parted under. Now it's go. Run parted to be able to resize the partition. Once this lengthy process done, it's time to have the real fun, by installing Gentoo. Reboot back into the old Linux system for now. The drive to operate on is the drive containing the partition that is going to be resized. For example, if the partition to be resized is, the drive is.

Once the resize has finished, boot back into the old Linux as described. Then go to The Gentoo Handbook: Preparing the Disks and follow the instructions. When chrooting, use the following command to flush the environment:

Enjoy!