Gentoo Wiki ArchivesGentoo Wiki

HOWTO_Lightning_fast_install_from_LiveCD

Contents

Introduction

Warning: This installation method is still ALPHA. Use at your own RISK!

Installing Gentoo by this method gives one the advantages and initial stability of binary install Linuxen, (like Ubuntu or Red Hat). With update cron jobs, the system will optimize itself in the background eventually yielding the outstanding Gentoo performance we all know and love!

Shortcomings of LiveCD Installer

The Gentoo LiveCD/LiveDVD installer cannot currently install on a managed volume (e.g. LVM), or when an unallocated or unknown partition (apparently an unimplemented feature in the parted libraries) even exists on the install drive. This install method allows one to overcome these issues.

Overview

The partitions are created, any RAID or LVM groundwork is laid, they are mounted, the LiveCD binaries that normally are linked from its ramdisk are copied to the hard disk, the directories initialized by the LiveCD boot are copied to the hard disk, the newly created system is chrooted into, a few housekeeping chores are done, the boot sector installed, and the system rebooted. This provides a stable Gentoo platform that can then be customized to the users content!

Booting the LiveCD

Install the LiveCD in your CDROM drive and reboot your machine. Enter the BIOS during your power on self test screen if necessary to insure that your system initially boots off of the CD if it's available.

When you see the grub boot prompt, hit F2-F6 to become familiar with your boot options and choose the appropriate ones for your situation.


Tip: It would be a very good idea to install on a managed volume (e.g. dolvm2 boot option) with snapshots so you can easily return to your initial install state should any subsequent updates or changes break your system! See HOWTO_Install_Gentoo_on_an_LVM2_root_partition up to (BUT NOT INCLUDING) the section titled: "Download your gentoo stage tarball to /gentoo and install it." then come back here and continue until the part about setting up /etc/fstab, then return to JUST THAT that part on the other page (you need that fstab file, not this one).

Bring up a Root Shell

If you booted into X

If you booted LiveCD into the X11 environment, wait until the system automatically logs in as user 'gentoo.'


Tip: If you booted into X, at this point you could bring up a web browser and point it to this page to help walk you through most stages of this install without a printout or second machine with which to view it.


Bring up a terminal by selecting 'Applications -> Accessories -> Terminal' from the menubar on the upper left of your Gnome Desktop. When the terminal comes up go into root with the command:

sudo su -

If you booted w/nox option

You should already be at a terminal with superuser privileges and should have a prompt ending in "#". You can access multiple consoles with ALT-F1 through ALT-F6.

Partition/Format/Mount Disks

Giving consideration to any RAID or Volume managers you want to use, prepare your disks according to the Gentoo Handbook.

Copy Running System to Hard Disks

There are two distinct collections of files of the LiveCD that need to be copied. One is the libraries and binaries that are considered to be too bulky to be loaded into the ramdisk. These directories are contained in the variable ROOT_LINKS when the /init script runs as LiveCD boots. The second collection are the actual 'live' and variable directories such as user homes, config files, and spools/caches. These are found in the variable ROOT_TREES during the /init script run.

Generally, the value of these variables can be found in initrd.defaults file in the location /usr/share/genkernel/generic/. Issue the command:

grep '^ROOT_' /usr/share/genkernel/generic/initrd.defaults


Code: ROOT_* variables in initrd.defults
 
ROOT_LINKS='bin sbin lib lib32 lib64 boot usr opt'
ROOT_TREES='etc root home var'
  

You can automatically set these variables in your own shell like this:

eval `grep '^ROOT_' /usr/share/genkernel/generic/initrd.defaults`

Copy the normally linked directories with:


Code: Copying ROOT_LINKS
 
# cd /mnt/livecd
# cp -avx $ROOT_LINKS /mnt/gentoo # skip the 'v' in the '-' options to reduce output
  

Now copy the live directories:

Code: Copying ROOT_TREES
 
# cd /
# cp -avx $ROOT_TREES /mnt/gentoo # skip the 'v' in the '-' options to reduce output
  

Take a couple of necessary files from liveCD's /etc directory:

Code: Copying /etc files
 
# cp /etc/passwd /etc/group /mnt/gentoo/etc
  

Get the portage snapshot:

Code: Copying /etc files
 
# cd /mnt/gentoo/usr
# tar xvjf /mnt/cdrom/snapshots/port[tab] # omit the v' for less verbose output
  

Mounting the /proc and /dev Filesystems

Create and mount the /proc filesystem on /mnt/gentoo/proc to allow the installation to use the kernel-provided information within the chrooted environment, and then create and mount-bind the /dev filesystem after creating a couple nodes essential for booting (console and null).


Code: Mounting /proc and /dev
 
 # mkdir /mnt/gentoo/proc /mnt/gentoo/dev
 # cd /mnt/gentoo/dev
 # mknod -m 660 console c 5 1
 # mknod -m 660 null c 1 3
 # mount -t proc none /mnt/gentoo/proc
 # mount -o bind /dev /mnt/gentoo/dev
  

Make the /sys directory

This is what it takes to jumpstart your udev device creation system.


Code: Jumpstarting udev
 
 # mkdir /mnt/gentoo/sys
  

Unmounting the Boot Partition

We have to unmount the boot partition and remount it later so grub can find it.


Code: Unmount boot
 
# umount /mnt/gentoo/boot
  

Entering the new Environment

Note: Following sections contain excerpts from Gentoo Handbook

Now that all partitions are initialized and the base environment installed, it is time to enter our new installation environment by chrooting into it. This means that we change from the current installation environment (Installation CD or other installation medium) to your installation system (namely the initialized partitions).

This chrooting is done in three steps. First we will change the root from / (on the installation medium) to /mnt/gentoo (on your partitions) using chroot. Then we will create a new environment using env-update, which essentially creates environment variables. Finally, we load those variables into memory using source.


Code: Chrooting into the new environment
 
# chroot /mnt/gentoo /bin/bash
# env-update # got error --- 'profiles/arch.list' is empty or not available. Empty portage tree?
 here
>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"
  


Congratulations! You are now inside your own Gentoo Linux environment. Of course it is far from finished, which is why the installation still has some sections left :-)

Configure /etc/fstab

Follow the instructions in this section. unless you set up the logical volume manager, then follow the instructions for setting it up in HOWTO_Install_Gentoo_on_an_LVM2_root_partition.

Remount /boot and Massage it.

If you've set up your /etc/fstab file you should be able to remount your /boot partition from within the chrooted environment like this:

mount /boot

It's usually a good idea to create some generic symlinks in /boot for important files whose names may change frequently. (Where the following code fragment says '[tab]' hit your TAB key, don't type the letters!)

Code: Convenience Symlinks
 
# cd /boot
# ln -s System.map-[tab] System.map
# ln -s kernel-gen[tab] genkernel
# ln -s initram[tab] initrd.img
  

Install and Configure Grub

Follow the instructions in this section but DO NOT use the framebuffer/splash features.

FIXME: Framebuffer causes X server to complain it cannot be configured.

Here's an example grub config file:

File: /boot/grub/grub.conf
 
#
# boot menu configuration file
#

# Boot automatically after 10 secs.
timeout 10

# By default, boot the first entry.
default 0

# Fallback to the second entry.
fallback 1

#for booting genkerneled sys
title Gentoo
root (hd0,0)
kernel /genkernel ramdisk=8192 udev dolvm2
initrd /initrd.img

  

One should be able to use this grub.conf file (edited for taste) then simply issue the command:

grub-install hd0

(making sure that hd0, or /dev/hda, is where you want the boot loader installed).

Note: If you are using a volume manager such as EVMS or LVM you may get an error here about your install disk not having a coresponding BIOS drive. If so, try:
# grub-install --recheck <your drive, e.g. /dev/sda>

If that still doesn't work, then consider editing the /boot/grub/device.map file and putting your volume managed device in there in the format <grub device name> <actual device name>, for example:

(hd0) /dev/evms/sda

Do not configure the network yet! Your new install will/should do some of that for you when it boots the first time.

Rebooting the System

Follow the instructions here.

After Reboot

A shell script called /sbin/livecd-functions.sh contains functions that automatically configures your video card and network connections into the config files on your hard disk (at least in theory :-) ). After your first boot, bring up a root terminal and change it's name, for example, like this:

# mv /sbin/livecd-functions.sh /sbin/livecd-functions.sh.orig

If one want's to use the net-setup command to configure a net connection, they should edit that file /usr/sbin to retreive the livecd-functions.sh file with it's new name (otherwise it will now error being unable to find it).

Also, now one could add regular users as per the Gentoo Handbook.

Finishing up

At this point, one can make current one's portage and set up cron jobs to do periodic updates (weekly?). One should see the Gentoo Handbook, plus x86 quick install guide and x86 tips and tricks generally for any missing pieces. Make sure as you go through these manuals to check and see which utilities/features LiveCD already has installed (use emerge -s <name>). Many are already there.

It is an excellent idea to enable portage logging BEFORE starting to update the system with emerge so one can see any errors or information messages, usually in /var/log/portage/ thusly:

Code: Enable Portage Logging
 
# echo PORT_LOGDIR=\"/var/log/portage\" >>/etc/make.conf
# cd /var/log
# mkdir portage
# chown portage:portage !$
  
Note: Under /usr/livecd there are files that are symlinked from other areas of the filesystem (these were areas that were redirected to the CD from the ROOT_TREES folders mentioned above). One might have to move them to the proper locations for future updates to go smoothly. If there is a problem look here first.

Errata

If the 'nox' flag is given to the boot, then gdm is started manually, it offers more and higher resolutions when X starts (at least on my machine). Anyone have any ideas why this is so and how it can be made to boot this way in the first instance?

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Lightning_fast_install_from_LiveCD"

Last modified: Mon, 22 Sep 2008 22:11:00 +1000 Hits: 24,344

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.