Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Warning - This page and project is a work in progress... See the Todo/Requests for Help section, and feel free to answer my requests (in fact, I encourage you to do so! Every little helps). Comments and criticisms on the Talk page, please - I want to make this a useful tool for everyone, and for that I need input and knowledge from other people.

Update (2008-04-25): People still occasionally download the scripts, and I've heard that sometimes the official installer can be a bit buggy. Also, I don't know how well the official one would do multiple installations. Once I finish my final exams in a month or two, I might start working on this again...

Update (24/10/2005): The scripts have been updated, and they should now work with universal LiveCDs and LiveCDs of any version (from 2005.0). They will also attempt to download a stage tarball from a random server from a list of 11. If this fails, the install will drop the user into a shell, and they can fix the problem. The scripts now also deal with the 2005.1 initrd (although not as well as they could).

Update (20/10/2005): I've created some scripts that will generate an AutoLiveCD from the minimal 2005.0 ISO, but they should also work on other ISOs. Needs more testing, but if anyone would like to volunteer to test the AutoLiveCD, I'd be very grateful! The scripts can be obtained from I'd like people to enter some details, but if they would prefer not to, then let me know, and I'll see. I would like to know how many people are interested in the AutoLiveCD, and get some feedback from the testers.

To install the scripts, extract the tarball, and edit the livecdgen script. It's fairly self-explanatory, and you only need to modify the variables at the top. You'll need a minimal or universal LiveCD to build it from. Then run it, and it should build you an AutoLiveCD.

Update (13/10/2005): The AutoLiveCD has worked for a machine from a Stage1 install, almost completely automated. It's still far from finished, as I know nothing about LILO, and it could use a few tweaks here and there. I will shortly be putting up a link to a page where you can download details about how to create your very own AutoLiveCD.



I'm in the middle of creating an automated installation LiveCD for Gentoo. It was originally based heavily on the Advanced Install HOWTO article, but has become its own creation after much reference to the Gentoo Handbook and much trial and error. The AutoLiveCD does try to automate things as much as possible, and the end plan is to have a completely automatic install. By that, I mean that you provide the LiveCD with a set of configuration files and it will then go off and install Gentoo to your exact specifications - without you having to sit there and watch! I suppose this is mainly intended for system administrators or for other people who have to install a large number of similar machines, but this should silence complaints about the length of time that Gentoo takes to install!

I have personally tested the AutoLiveCD on a machine of my own (Athlon 1200, 256MB RAM, 1x20GB HDD, 1x60GB HDD), and it took just under 8 hours to do a Stage1 installation. All I had to do was watch all of the pretty, geeky text scroll by. (Yes, the comma was intended.)

It's based on the 2005.0 Minimal LiveCD, but the scripts should integrate just as well with any other version.

This page will contain some documentation about the project, made up as I go along, when I have time to do so. Hopefully (eventually) it will become a reference guide, possibly with links to the new ISO or a script to modify an existing LiveCD image.

The Beginning

The project essentially relies on a set of scripts added to the normal LiveCD. To achieve this aim, I 'unpacked' the ISO by mounting it and copying the files from it to my hard drive. I then extracted the files from the the livecd.squashfs loopback filesystem that was in the ISO. This makes up the bulk of the LiveCD root. The initrd is stored in isolinux/gentoo.igz, which is a gzipped ext2 loopback filesystem. I made a few small modifications to that, but I won't document them until they're finished, as they're not very big, but may change.

My filesystem (in relation to the AutoLiveCD) looks like this (courtesy of tree):

|-- e2fs
|-- iso
|   |-- docs
|   |-- stages
|   `-- isolinux
`-- squashfs
    |-- bin
    |-- boot
    |-- dev
    |-- etc
    |-- home
    |-- install_helper
    |-- lib
    |-- mnt
    |-- opt
    |-- proc
    |-- root
    |-- sbin
    |-- sys
    |-- tmp
    |-- usr
    `-- var

A quick overview of some of the items in the tree:

Changes to a normal LiveCD

Todo/Requests for Help

Pending tasks for HOWTO AutoLiveCD

edit -history - watch - purge
  • Config files [complete]
  • Update scripts to use config files [complete]

Please answer these requests - I'd like to be able to include these features, or fix these problems, or know what I'm missing or doing wrong...

soundig autogen # dmesg | tail APIC error on CPU0: 40(40) APIC error on CPU0: 40(40) APIC error on CPU0: 40(40) APIC error on CPU0: 40(40) APIC error on CPU0: 40(40) ISO 9660 Extensions: Microsoft Joliet Level 3 ISO 9660 Extensions: RRIP_1991A APIC error on CPU0: 40(40) VFS: Can't find an ext2 filesystem on dev loop0. APIC error on CPU0: 40(40)


NOTE: This section is a very brief overview of the scripts. It is (and will be) possible to add custom scripts, based on the same system. So, for example, if you wanted to add a script between the filesystem script and the chroot script, then you would name it "23_customscript". The autoinstall script simply executes all of the scripts in numerical order, as long as they match the regular expression "[0-9][0-9]_.+", essentially two digits, an underscore, and then any text.


This is the main script - it calls all the other installation scripts in order.


Applies generic hdparm settings to each IDE drive (separate settings for hard drives and CD drives), based on settings from configuration file.


Checks that network interfaces are up. Should also check for connectivity, but I need a good way to do this. Any suggestions?

File: Current 10_checknet script
# Gentoo installation helper scripts, written by David Ingram
# They should help with a more automated installation of Gentoo Linux,
# and eventually with a fully automated install (with config file)
# Some parts of the installation based upon the Advanced Install guide on
# the Gentoo wiki at: [[HOWTO_Advanced_Install]]

HELPERDIR=`dirname $0`

ebegin "Checking interface status"

IF_UP=`ifconfig | grep Link | cut -f1 -d' '`
IF_ALL=`ifconfig -a | grep Link | cut -f1 -d' '`

if [[ "$IF_UP" == "$IF_ALL" ]]; then
	einfo "All interfaces (`echo "$IF_UP" | tr '\n' ' ' | sed -e 's/ /, /g;' | sed -e 's/, $//'`) are up"
	eend 0
	for i in $IF_ALL; do
		[[ `echo "$IF_UP" | grep $i` ]] || ewarn "Interface $i is down"
	ewend 1 "Some interfaces are down - networking may not function"


exit 0


ebegin "Checking internet connection (might take a while, please wait)"
ping -c4 -w1 #>/dev/null 2>&1
if [[ "$?" == "0" ]]; then
	einfo "Internet seems to be working"
	eend 0
	ping -c4 -w1 #>/dev/null 2>&1
	if [[ "$?" == "0" ]]; then
		einfo "Internet seems to be working"
		eend 0
		eend 1 "Cannot ping some sites - is the Internet working?"


Sets up the partitions on each drive, as specified in the configuration file. If the configuration file does not exist or is empty, then it will ask the user to partition each drive manually.

Warning: The script will erase the current partition table on the drive if it is set to automatically install! Make sure the configuration file is empty if you don't want this to happen!


Automatically detects swap partitions, and asks user if they want it to be formatted as swap. Also does swapon for them too. Can handle multiple swap partitions, but I don't know how likely this is to happen. This script then proceeds to create and mount the filesystems that have been listed in the configuration file.


This is by far the largest script, and probably needs a great deal of explanation (which I unfortunately don't have the time to write at the moment). I'll try to explain what the script does, but I haven't got it to hand at the moment, and so can't give any exact details.

The next things that happen depend on what stage the user decided to start from. Start at the appropriate stage, and keep reading until the end.





Cleans up after the chroot, unmounts everything and reboots. You should now have a fully-working Gentoo system! Don't forget to remove the LiveCD first...


BASH script to identify filesystems. Ripped most of the detection code from the source of mount (except for NTFS and FAT32 - found those out myself). Might have been useful with the original direction of the script (i.e. full automation, no configuration file), but I now doubt it. Just for anyone who's interested and might find it useful though:

File: detectfs
# Gentoo installation helper scripts, written by David Ingram
# They should help with a more automated installation of Gentoo Linux,
# and eventually with a fully automated install (with config file)
# Some parts of the installation based upon the Advanced Install guide on
# the Gentoo wiki at: [[HOWTO_Advanced_Install]]
# Attempts to detect filesystem type by checking the superblocks.
# Requires root privileges
# TODO: Add detection of XFS, JFS and others that people might use

LINUXONLY="yes"         # Only think about Linux partition types

[[ `id -ur` -ne 0 ]] && echo "You must be root to check filesystems" && exit 1

for dev in $*; do

    [[ $# -gt 1 ]] && out="${dev}: "

    if [[ "$LINUXONLY" == "yes" ]]; then
        sb=`head -c16 ${dev} | hex | sed -e's/ //g' | cut -d. -f3`
        [[ "${sb}" == "NTFS" ]] && id=1 && echo "${out}NTFS"

        sb=`head -c96 ${dev} | hex | egrep "^0050 " | sed -e's/ //g' | cut -d. -f3`
        [[ "${sb}" == "FAT32" ]] && id=1 && echo "${out}FAT32"

    sb=`head -c1088 ${dev} | hex | egrep "^0430 " | cut -c32,33,35,36`
    [[ "${sb}" == "53ef" || "${sb}" == "51ef" ]] && id=1 && echo "${out}ext2/3"

    sb=`head -c4096 ${dev} | hex | egrep "^0ff0 " | sed -e 's/ //g' | cut -d. -f7`
    [[ "${sb}" == "SWAPSPACE2" || "${sb}" == "SWAP-SPACE" ]] && id=1 && echo "${out}swap space"

    sb=`head -c65600 ${dev} | hex | egrep "^10030 " | sed -e's/ //g' | cut -d. -f5`
    [[ "${sb}" == "ReIsEr2Fs" || "${sb}" == "ReIsErFs" ]] && id=1 && echo "${out}reiserfs"

    [[ $id -eq 0 ]] && echo "${out}Unknown"


Modified (heavily cut-down) version of the Gentoo /sbin/ file. I liked the pretty output, so I borrowed it.

Configuration files

This is preliminary documentation and subject to change.

Main configuration

This file contains the options for the overall installation, as well as the locations of the other config files.

File: ./cfg_main
# Location of partitioning info

# Location of filesystem info
# Automatically detect and format swap partitions?

# Automatically search for best mirrors?

# make.conf location

# Replace existing make.conf? (Done BEFORE mirrorselect otherwise appended afterwards)

# Location of list of packages to emerge after main installation complete

# hdparm settings

# Initial stage tarball

# Silent portage sync?

# DistCC hosts

# Various system package choices
# filesystem programs are done automatically from reading fsfile above. If you want others,
# then add them to the pkglist.
# editor can be a space-separated list, first item is preferred editor

# Set up runlevels
rl_default="${logger} net.eth0 ${crond} sshd hotplug coldplug acpid ntpd"

# I18n
# Timezone to link to
# Keyboard map

# Kernel sources and .config

# Hostname/domainname

# /etc/hosts, autoload modules and multiple Ethernet devices
hoststype=append              # or replace
#autoload=                    # space-separated list of modules, or filename containing module on each line
#autoloadtype=list            # or file
ethcards=1                    # number of ethernet cards. creates links net.eth{n} to net.eth0, does nothing more

# GRUB config (note: I use GRUB, so I don't know about LILO config)
# Initial config file
# Root drive, used in root and setup commands

# Add users/groups after install (not implemented)

Partition configuration

File: ./cfg_parts
# Number of drives

# First drive device
# Number of partitions on this drive
# Commands to send to fdisk for each partition. Note that comma will be replaced by newline

Filesystem configuration

The autoswap option in the main configuration file will cause the scripts to automatically detect and format any swap-format (type 82) partitions.

File: ./cfg_fs (without autoswap)
# Number of partitions to format

# Partition device
# Partition filesystem
# Partition mountpoint

# Partition 2

# Partition 3

File: ./cfg_fs (with autoswap)
# Number of partitions to format

# Partition 1

# Partition 2

Package configuration

Note: Not implemented yet

The package configuration is just a list of the full names of packages to emerge after installation. Just for a short example:

File: ./cfg_pkg

Users configuration

No format defined yet

Groups configuration

No format defined yet

Password configuration

No format defined yet

... work in progress [24 Oct 2005]

Concerns or Compliments? Please use the Discussion section.

Retrieved from ""

Last modified: Fri, 25 Apr 2008 06:39:00 +0000 Hits: 19,932