Friday, September 23, 2005

Gentoo 2005.1 Software RAID (part 3)

Picking up with part 7c after compiling the kernel. Now you need to install your kernel into the boot partition. Change the "2.6.12-Sep2005" portion of the filenames to whatever you want.

# cp arch/i386/boot/bzImage /boot/kernel-2.6.12-Sep2005
# cp System.map /boot/System.map-2.6.12-Sep2005
# cp .config /boot/config-2.6.12-Sep2005


If you are using LVM2, you will need to add a line at the end of the autoload file to automatically load the LMV2 module. Note that you may also need to add a line for DHCP support (not 100% sure about that). Since I'm using these boxes for servers with static IPs I don't concern myself with it.

# echo 'dm-mod' >> /etc/modules.autoload.d/kernel-2.6
# cat /etc/modules.autoload.d/kernel-2.6


Time to configure the "/etc/fstab" file. There are pages full of documentation on what goes in this file and the handbook covers some of it. For my VIA EPIA box with only 3 partitions, my fstab file is going to be rather simple.

# nano -w /etc/fstab

/dev/md0 /boot ext2 noauto,noatime 1 2
/dev/md2 / ext3 noatime 0 1
/dev/md1 none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/cdrom auto noauto,ro,user 0 0

#/dev/fd0 /mnt/floppy auto noauto 0 0

proc /proc proc defaults 0 0

shm /dev/shm tmpfs nodev,nosuid,noexec 0 0


For my Celeron box which is using LVM2 partitions, it's more complex.

# nano -w /etc/fstab

/dev/md0 /boot ext2 noauto,noatime 1 2
/dev/md2 / ext3 noatime 0 1
/dev/md1 none swap sw 0 0
/dev/cdroms/cdrom0 /mnt/cdrom auto noauto,ro,user 0 0

#/dev/fd0 /mnt/floppy auto noauto 0 0

/dev/vgmirror/opt /opt ext3 noatime 0 3
/dev/vgmirror/usr /usr ext3 noatime 0 3
/dev/vgmirror/var /var ext3 noatime 0 3
/dev/vgmirror/home /home ext3 noatime 0 3
/dev/vgmirror/tmp /tmp ext2 noatime 0 3
/dev/vgmirror/vartmp /var/tmp ext2 noatime 0 3

proc /proc proc defaults 0 0

shm /dev/shm tmpfs nodev,nosuid,noexec 0 0


Now, some misc stuff (see networking configuration for information on setting up DHCP or static IPs):

# nano -w /etc/conf.d/hostname
# nano -w /etc/conf.d/domainname
# rc-update add domainname default
# nano -w /etc/conf.d/net
(either leave empty for DHCP or configure your IP and gateway)
# rc-update add net.eth0 default
# cat /etc/resolv.conf
(verify your DNS servers if you specified a static IP)
# nano -w /etc/conf.d/clock
(change CLOCK="UTC" to CLOCK="local")
# passwd
(set your root password to something you will remember)

# useradd -m -G users,wheel,audio -s /bin/bash john
# passwd john
(add a user called 'john' and set a password)


And a few other misc options (system logger, job scheduling):

# emerge syslog-ng
# rc-update add syslog-ng default
# emerge dcron
# rc-update add dcron default
# crontab /etc/crontab


I also like to install the "sshd" service at this point so that I can ssh into the box after the initial reboot. (These notes are based on a very old posting that I made about installing sshd on Gentoo Linux.) Alternately, you can do these commands after booting the box for the first time by logging in as root at the console.

# /usr/bin/ssh-keygen -t dsa -b 2048 -f /etc/ssh/ssh_host_dsa_key -N ""
(the key may take a few minutes to generate)
# chmod 600 /etc/ssh/ssh_host_dsa_key
# chmod 644 /etc/ssh/ssh_host_dsa_key.pub
# rc-update add sshd default


Now it's time to install and configure "grub" (the boot loader). Note that where we are saying "/dev/hdc", you will need to change to match the name of your secondary mirror drive.

# emerge grub

(Now, at this point, I got an error at the end of the emerge because I had failed to mount my /proc file system before entering the chroot environment. The fix was easy, requiring me to exit the chroot environment, mount the /proc filesystem and then re-enter the chroot environment.)

# ls -l /boot
# nano -w /boot/grub/grub.conf


Contents of my grub.conf file:

# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
timeout 30

# Sep 2005 installation (software RAID, no LVM2)
title=Gentoo Linux 2.6.12 (Sep 22 2005)
root (hd0,0)
kernel /kernel-2.6.12-Sep2005 root=/dev/md2


Now I fire up grub and install it onto the MBR of both disks.

# grub --no-floppy
grub> find /grub/stage1
(hd0,0)
(hd1,0)
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/hdc
grub> root (hd0,0)
grub> setup (hd0)
grub> quit


Time for the first reboot. Now you need to unmount everything that you can (including LVM) prior to reboot. Since I'm not using LVM2, this is rather simple.

livecd gentoo # exit
livecd / # cd /
livecd / # cat /proc/mounts
(gives you a list of what is mounted)
livecd / # umount /mnt/gentoo/boot
livecd / # umount /mnt/gentoo/proc
livecd / # umount /mnt/gentoo
livecd / # reboot


Pull the CD-ROM at this point, otherwise the LiveCD will probably boot. Then cross your fingers and watch the console for errors.

Thursday, September 22, 2005

Gentoo 2005.1 Software RAID (part 2) Celeron CPU

Time to configure the Gentoo kernel. I'm configuring this for my Celeron motherboard.

Note the use of "emerge lvm2" since I'm using LVM2 on this system during the initial installation.

# emerge mdadm
# emerge lvm2
# cd /usr/src/linux
# make menuconfig


Linux Kernel v2.6.11 Configuration
(C)ode maturity level options
(G)eneral setup
--> (C)onfigure standard kernel features for small systems (turn ON)
--> --> (O)ptimize for size (turn ON)
(L)oadable module support
(P)rocessor type and features
--> (P)rocessor family (changed to "Pentium-III...")
--> (S)ymetric multi-processing support (turned this one OFF)
--> M(a)chine Check Exception (turned this OFF)
(P)ower management options (ACPI, APM)
(B)us options (PCI, PCMCIA, EISA< MCA, ISA)
(E)xecutable file formats
(D)evice drivers
--> (A)TA/ATAPI/MFM/RLL support
--> --> (P)ROMISE PDC202{46|62|65|67} support (turn ON)
--> N(e)tworking support
--> --> N(e)twork device support (should already be BUILT-IN)
--> --> --> (E)thernet (10 or 100Mbit)
--> --> --> --> (T)ulip family network device support
--> --> --> --> --> "(T)ulip" family network device support (turn ON as BUILT-IN)
--> --> --> --> --> --> (D)ECchip Tulip (dc2114x) PCI support (turn ON as BUILT-IN)
--> --> --> --> --> --> --> (I left the sub-options alone)
--> --> --> --> (E)ISA, VLB, PCI and on board controllers (turn OFF)
--> (P)arallel port support (turned OFF)
--> M(u)lti-device support (turn it ON)
--> --> (R)AID support (turn it ON as BUILT-IN)
--> --> --> (R)AID-1 mirroring mode (turn it ON as BUILT-IN)
--> --> (D)evice mapper support (set to MODULE, per section 13 of LVM2 guide)
--> (C)haracter Devices
--> --> (I)ntel/AMD/VIA HW Random Number Generator (turn ON as BUILT-IN)
--> (S)ound
--> --> (S)ound card support (turn OFF)
(F)ile systems
--> N(e)twork File Systems
--> --> (S)MB file system support (turn ON as BUILT-IN)
--> --> (C)IFS support (turn ON as BUILT-IN)
(P)rofiling support
(K)ernel hacking
(S)ecurity options
(C)ryptographic options
--> (C)ryptographic API (turn ON)
--> --> HM(A)C support (NEW) (turn ON as BUILT-IN)
--> --> (turn ON all other options as MODULE)
(L)ibrary routines

Exit and save your configuration. Then build the kernel (the following command is for 2.6 kernels). Expect the compile to take about an hour.

# make && make modules_install

Gentoo: emerge grub error - cat: /proc/mounts: No such file or directory

During my initial Gentoo installation, I ran into the following issue after trying to "emerge grub".

...
>>> Completed installing grub-0.96-r2 into /var/tmp/portage/grub-0.96-r2/image/

>>> Merging sys-boot/grub-0.96-r2 to /
cat: /proc/mounts: No such file or directory
cat: /proc/mounts: No such file or directory
*
* Cannot automatically mount your /boot partition.
* Your boot partition has to be mounted rw before the installation
* can continue. grub needs to install important files there.
*

!!! ERROR: sys-boot/grub-0.96-r2 failed.
!!! Function mount-boot_mount_boot_partition, Line 51, Exitcode 0
!!! Please mount your /boot partition manually!
!!! If you need support, post the topmost build error, NOT this status message.

!!! FAILED preinst: 1
livecd linux # grub
bash: grub: command not found


This thread over at Short-Media has exactly this error listed. However, that thread went nowhere and the user was redirected to search over at the Gentoo.org forums.

emerge grub fails (Jun 2004)
'emerge grub' fails (Jun 2004)
Grub wont compile. (Apr 2004)

Most posters indicate that you must run the following command prior to entering the chroot environment.

mount -t proc /proc /mnt/gentoo/proc

However, I can look back at my session logs and see that I already ran that particular command before entering the chroot. Oh, wait... no I did not run that particular command. (This is where using a terminal program like SecureCRT comes in handy.) This command should have been run just prior to entering the chroot environment. (See chapter 6 of the installation handbook.)

The fix should be as simple as:

livecd linux # cat /proc/mounts
cat: /proc/mounts: No such file or directory
livecd linux # exit
exit
livecd gentoo # mount -t proc none /mnt/gentoo/proc
livecd gentoo # chroot /mnt/gentoo /bin/bash
livecd / # env-update
>>> Regenerating /etc/ld.so.cache...
livecd / # source /etc/profile
livecd / # emerge grub

Wednesday, September 21, 2005

Gentoo 2005.1 Software RAID (part 2) VIA EPIA ME6000

Time to configure the Gentoo kernel. I'm configuring this for my VIA EPIA ME6000 motherboard. (Notice that I'm now including the LVM2 components as part of my base installation.)

# emerge mdadm
# emerge lvm2
# cd /usr/src/linux
# make menuconfig


Linux Kernel v2.6.11 Configuration
(C)ode maturity level options
(G)eneral setup
--> (C)onfigure standard kernel features for small systems (turn ON)
--> --> (O)ptimize for size (turn ON)
(L)oadable module support
(P)rocessor type and features
--> (P)rocessor family (changed to "CyrixIII/VIA-C3")
--> (S)ymetric multi-processing support (turned this one OFF)
--> M(a)chine Check Exception (turned this OFF)
(P)ower management options (ACPI, APM)
(B)us options (PCI, PCMCIA, EISA< MCA, ISA)
(E)xecutable file formats
(D)evice drivers
--> (P)arallel port support (turned OFF)
--> (A)TA/ATAPI/MFM/RLL support
--> --> (V)IA82CXXX chipset support (turned ON)
--> M(u)lti-device support (turn it ON)
--> --> (R)AID support (turn it ON as BUILT-IN)
--> --> --> (R)AID-1 mirroring mode (turn it ON as BUILT-IN)
--> --> (D)evice mapper support (set to MODULE, per section 13 of LVM2 guide)
--> N(e)tworking support
--> --> (E)thernet (10 or 100Mbit)
--> --> --> (R)ealTek RTL-8139 PCI Fast Ethernet (turn it OFF)
--> --> --> (V)IA Rhine support (turn it ON)
--> --> --> --> (U)se MMIO instead of PIO (turn it ON)

--> (C)haracter Devices
--> --> (I)ntel/AMD/VIA HW Random Number Generator (turn ON as BUILT-IN)
--> --> (I)ntel 440LX/BX/GX, I8xx and E7x05 chipset support (turn it OFF)
--> --> (V)IA chipset support (turn ON)
--> (S)ound
--> --> (S)ound card support (turn OFF)
(F)ile systems
--> N(e)twork File Systems
--> --> (S)MB file system support (turn ON as BUILT-IN)
--> --> (C)IFS support (turn ON as BUILT-IN)
(P)rofiling support
(K)ernel hacking
(S)ecurity options
(C)ryptographic options
--> (C)ryptographic API (turn ON)
--> --> HM(A)C support (NEW) (turn ON as BUILT-IN)
--> --> (turn ON all other options as MODULE)
(L)ibrary routines

Exit and save your configuration. Then build the kernel (the following command is for 2.6 kernels). Expect the compile to take about an hour.

# make && make modules_install

Sunday, September 18, 2005

Gentoo emerge sync errors during installation

So, I'm trying to install Gentoo 2005.1 on Software RAID and LVM2. Everything seems to work up until I do my initial "emerge --sync".

livecd / # emerge --sync
...
app-benchmarks/bashmark/
app-benchmarks/bashmark/files/
app-benchmarks/httperf/
app-benchmarks/httperf/files/
app-benchmarks/iozone/
app-benchmarks/iozone/files/
app-benchmarks/jmeter/
app-benchmarks/ltp/
app-benchmarks/nbench/
986 100% 0.00kB/s 0:00:00
app-accessibility/java-access-bridge/ChangeLog
2947 100% 0.00kB/s 0:00:00
app-accessibility/java-access-bridge/Manifest
568 100% 0.00kB/s 0:00:00
app-accessibility/java-access-bridge/files/digest-java-access-bridge-1.4.5-r1
77 100% 0.00kB/s 0:00:00
app-accessibility/java-access-bridge/java-access-bridge-1.4.5-r1.ebuild
1250 100% 0.00kB/s 0:00:00
app-accessibility/java-access-bridge/java-access-bridge-1.4.5.ebuild
1902 100% 0.00kB/s 0:00:00
app-accessibility/mbrola/ChangeLog
3274 100% 0.00kB/s 0:00:00
app-accessibility/mbrola/Manifest
616 100% 0.00kB/s 0:00:00
mkstemp "/usr/portage/app-accessibility/mbrola/files/.digest-mbrola-3.0.1h-r1.S11U8n" failed: Input/output error
236 100% 0.00kB/s 0:00:00
mkstemp "/usr/portage/app-accessibility/mbrola/files/.digest-mbrola-3.0.1h-r3.C8lndQ" failed: Read-only file system
...


Plan A:

Exit out of the chroot'd environment, umount the filesystem in question (/dev/vgmirror/usr). I ran fsck against it and found numerous errors, so I just went and re-formatted. Then re-mounted everything and started over with Chapter 5 (extraction of stages and onward).

Same issues

Plan B:

Don't use LVM2 during the initial installation. My guess is that there's something not quite right on the 2005.1 boot CD for Gentoo. So far it seems to be working, at least I'm hoping that I can get a system up and running before trying to get LVM2 up and running.

Plan C:

Use smaller disks. I did some more digging and the Gigabyte motherboard almost certainly does not support 48bit LBA drives (larger then 136GB). In fact, the Promise FastTrak66 card certainly does not but I was misled by the fact that DBaN (drive wipe software) showed me the full 160GB of the disks. I'm running some tests now to see whether DBaN will pickup this sort of issue if you run it in verify mode.

I have (3) 120GB disks on order and will be dropping them into this system when they arrive. That will take care of the issue and still allow me to put this older hardware into use.

Update #1: DBaN is reporting errors on the (2) 160GB disks attached to the Promise FastTrak66 card, but not for the drive connected directly to the motherboard. (Method: PRNG Stream, Verify: All Passes)

Wednesday, September 07, 2005

Gentoo 2005.1 Software RAID (part 1)

Note: These directions are works-in-progress... in fact, they might not even work at all. The big change that I'm trying this time around is using the 2005.1 release. I'm also going to skip LVM2 on the initial installation. I'm now in the process of updating this to include instructions for both with and without LVM2.

Now that the 2005.1 release is out, I'm going to take yet another swing at getting a software RAID configuration up and running on a pair of ATA disks. I'm working on two different systems.

System A: This is an older motherboard (AT power, 2 ISA slots, 3 PCI slots) running on a Celeron processor (system details). But in the meantime, I've upgraded the disks to (3) 120GB 5400rpm drives (these run cooler then the old 7200rpm drives and will have less issues with heat).

System B: The second system is VIA EPIA ME6000 (EPIA M series), 600Mhz fanless CPU with a pair of 300GB PATA drives and a DVD-ROM.

Derik's Boot and Nuke (DBaN) seems like a good first step to make sure that any old data is wiped off of the 3 drives. Data rates on the wipe process (running all 3 drives at the same time) is around 7.5MB/s per drive. After having issues with an older configuration, I now always run DBaN for 2-3 passes with verification on all passes. It drastically increases the amount of time required for the initial wipe but allows me to discover errors before I get into installing Gentoo.

Once that finishes running, I will have:

System A:
/dev/hda - 120GB primary IDE drive (Primary IDE channel, Master)
/dev/hdc - CD-ROM (Secondary IDE channel, Master)
/dev/hde - 120GB attached to Promise controller (PDC20262)
/dev/hdg - 120GB attached to Promise controller (PDC20262)

/dev/hda and /dev/hde will be mirrored together. The /dev/hdeg disk will be used as a backup/scratch disk.

System B:
/dev/hda - 300GB IDE drive (Primary IDE channel, Master)
/dev/hdc - 300GB IDE drive (Secondary IDE channel, Master)
/dev/hdd - CD-ROM (Secondary IDE channel, Slave)

/dev/hda and /dev/hdc will be mirrored together.

Starting with the usual tricks:

1) Boot the system using the Universal CD
2) ifconfig - find out the IP address of the box
3) passwd - change the root password to something you know
4) Start the SSH daemon - /etc/init.d/sshd start

Since these drives were nuked since my last attempt, I have to re-configure the partitions.

# fdisk /dev/hda

Command: n
Command action: p
Partition number: 1
First cylinder: 1
Last cylinder: +128M
Command: a
Partition number: 1
Command: t
Hex code: fd

Command: n
Command action: p
Partition number: 2
First cylinder: [enter]
Last cylinder: +2048M
Command: t
Partition number: 2
Hex code: fd

(note that partition #3 can be different sizes based on needs)

Command: n
Command action: p
Partition number: 3
First cylinder: [enter]
Last cylinder: +16384M or +2048M
Command: t
Partition number: 3
Hex code: fd

Command: n
Command action: p
First cylinder: [enter]
Last cylinder: (use 99% of what's available)
Command: t
Partition number: 4
Hex code: fd

Command: p

Command: w


This gives me a 128MB boot area, a 2GB swap area, a root area, with the rest of the disk set aside for my LVM2 partitions. Repeat the above commands to configure the 2nd disk in the same fashion (/dev/hdc or /dev/hde for my 2 systems).

If you are not using LVM2 on the initial installation, I tend to use a 16GB root partition. Otherwise if you are going to use LVM2 you can get away with a smaller 2GB root partition.

I always use a slightly smaller size for the 4th partition then the maximum available on the disk. That will hopefully protect me if I would have to replace one of the drives with another one that is slightly smaller then expected. (Not all 250GB drives are identical in the number of cylinders.) A fudge-factor of around 1% of the total # of cylinders should be adequate.

Key resource: HOWTO Gentoo Install on Software RAID

Now I need to configure software RAID. This is a bit easier then last year since I don't need to muck with the /etc/raidtab file (instead, I'm going to use mdadm). This is based on research that I did while using the 2004.3 CDs

The following loads the 'md' module and creates the nodes (/dev/md*).

# modprobe md
# ls /dev/md*
ls: /dev/md*: No such file or directory
# for i in 0 1 2 3; do mknod /dev/md$i b 9 $i; done
# ls /dev/md*
/dev/md0 /dev/md1 /dev/md2 /dev/md3


Now, we create our RAID1 sets.

System A:
# modprobe raid1
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hda1 /dev/hde1
# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/hda2 /dev/hde2
# mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/hda3 /dev/hde3
# mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/hda4 /dev/hde4
# cat /proc/mdstat


System B:
# modprobe raid1
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hda1 /dev/hdc1
# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/hda2 /dev/hdc2
# mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/hda3 /dev/hdc3
# mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/hda4 /dev/hdc4
# cat /proc/mdstat


Seems to be working fine. You can choose to wait until all of the RAID arrays finish processing (recommended) or press onward.

LinuxDevCenter article on mdadm explains mdadm in a bit more detail, and shows how to create the config file semi-automatically. Be sure to change '/dev/hda' and 'dev/hde' to match the 2 disks that you are attempting to RAID.

# mdadm --detail --scan >> /etc/mdadm.conf
# nano -w /etc/mdadm.conf


Picking up again with Chapter 4 of the installation handbook. (This also matches what I did back in June 2004 with Software RAID and LVM2 and Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 1).)

# mke2fs /dev/md0
# mkswap /dev/md1 ; swapon /dev/md1
# mke2fs -j /dev/md2
# mount /dev/md2 /mnt/gentoo
# mkdir /mnt/gentoo/boot ; mount /dev/md0 /mnt/gentoo/boot


If we're setting up LVM2, we need to now prep the 4th partition and setup the logical volumes inside of LVM2.

# modprobe dm-mod
# pvcreate /dev/md3
# echo 'devices { filter=["r/cdrom/"] }' > /etc/lvm/lvm.conf
# vgcreate vgmirror /dev/md3
# vgscan
# lvcreate -L2G -ntmp vgmirror
# lvcreate -L2G -nvartmp vgmirror
# lvcreate -L2G -nopt vgmirror
# lvcreate -L4G -nusr vgmirror
# lvcreate -L2G -nvar vgmirror
# lvcreate -L2G -nhome vgmirror
# ls -l /dev/vgmirror
# lvscan
# mke2fs /dev/vgmirror/tmp
# mke2fs /dev/vgmirror/vartmp
# mke2fs -j /dev/vgmirror/opt
# mke2fs -j /dev/vgmirror/usr
# mke2fs -j /dev/vgmirror/var
# mke2fs -j /dev/vgmirror/home
# mkdir /mnt/gentoo/opt ; mount /dev/vgmirror/opt /mnt/gentoo/opt
# mkdir /mnt/gentoo/usr ; mount /dev/vgmirror/usr /mnt/gentoo/usr
# mkdir /mnt/gentoo/var ; mount /dev/vgmirror/var /mnt/gentoo/var
# mkdir /mnt/gentoo/home ; mount /dev/vgmirror/home /mnt/gentoo/home
# mkdir /mnt/gentoo/tmp ; mount /dev/vgmirror/tmp /mnt/gentoo/tmp
# chmod 1777 /mnt/gentoo/tmp
# mkdir /mnt/gentoo/var/tmp ; mount /dev/vgmirror/vartmp /mnt/gentoo/var/tmp
# chmod 1777 /mnt/gentoo/var/tmp


Now we move into Installation (chapter 5) in the handbook. Verify your system date and then start extracting the tarballs. Notice that the only stage available on the Universal CD is now stage3.

# date
# ls -l /mnt/cdrom/stages
total 450586
-rw-r--r-- 1 root root 92520704 Aug 7 04:45 stage3-athlon-xp-2005.1.tar.bz2
-rw-r--r-- 1 root root 92413359 Aug 7 04:47 stage3-i686-2005.1.tar.bz2
-rw-r--r-- 1 root root 92122771 Aug 7 04:46 stage3-pentium3-2005.1.tar.bz2
-rw-r--r-- 1 root root 92475718 Aug 7 04:46 stage3-pentium4-2005.1.tar.bz2
-rw-r--r-- 1 root root 91866585 Aug 7 04:46 stage3-x86-2005.1.tar.bz2
# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/stages/stage3-x86-2005.1.tar.bz2


That takes a while to uncompress. Now we pickup with 5D (Installing Portage). I'm going to use the portage snapshot on the CD-ROM.

# cd /mnt/gentoo
# ls -l /mnt/cdrom/snapshot
# tar -xvjf /mnt/cdrom/snapshot/portage-2005.1.tar.bz2 -C /mnt/gentoo/usr


Before I configure the make.conf file, I should take a look at my system configuration.

# cat /proc/version
Linux version 2.6.12-gentoo-r6 (root@poseidon) (gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)) #1 SMP Wed Aug 3 20:26:57 UTC 2005
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Celeron (Coppermine)
stepping : 6
cpu MHz : 568.141
cache size : 128 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips : 1114.11
# cat /proc/meminfo
MemTotal: 320792 kB
MemFree: 7600 kB
Buffers: 57472 kB
Cached: 180320 kB
SwapCached: 4 kB
Active: 29596 kB
Inactive: 210948 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 320792 kB
LowFree: 7600 kB
SwapTotal: 2007992 kB
SwapFree: 2000156 kB
Dirty: 0 kB
Writeback: 0 kB
Mapped: 5144 kB
Slab: 63636 kB
CommitLimit: 2168388 kB
Committed_AS: 15752 kB
PageTables: 172 kB
VmallocTotal: 704504 kB
VmallocUsed: 6856 kB
VmallocChunk: 696436 kB


Now to configure compile options (5E in the handbook). Since we're using a stage3 installation, we'll need to be careful to not touch certain settings in the make.conf file. I pretty much plan on using the defaults (except for optimizing for size due to the lower cache size in the Celeron and VIA CPUs, which is merely changing -O2 to -Os).

# nano -w /mnt/gentoo/etc/make.conf

Contents of my make.conf file:

# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example
CFLAGS="-Os -mcpu=i686"
CHOST="i386-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"


Now to Chapter 6 - Installing the Gentoo Base System. Time to "chroot".

# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
# mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
# cat /mnt/gentoo/etc/make.conf
CFLAGS="-Os -mcpu=i686"
CHOST="i386-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"

GENTOO_MIRRORS="http://gentoo.osuosl.org/"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"


Looks good so far.

# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# cp -L /etc/mdadm.conf /mnt/gentoo/etc/mdadm.conf
(do the next 2 commands if you are using LVM2)
# mkdir /mnt/gentoo/etc/lvm
# cp -L /etc/lvm/lvm.conf /mnt/gentoo/etc/lvm/lvm.conf
(end of optional LVM2 commands)
# mount -t proc none /mnt/gentoo/proc
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# emerge --sync


The sync will take a while to run (I generally plan on doing something else for a few hours).

Time to choose a profile. There shouldn't be much to do at this point since I plan on using the 2.6 kernel which is the default on the 2005.1 Gentoo CDs.

# ls -FGg /etc/make.profile
lrwxrwxrwx 1 48 Sep 21 10:22 /etc/make.profile -> ../usr/portage/profiles/default-linux/x86/2005.1/
# ls -d /usr/portage/profiles/default-linux/x86/2005.1/2.4
/usr/portage/profiles/default-linux/x86/2005.1/2.4


Configuring the USE variable comes next in the handbook. You'll see that I'm using a very aggressive set of USE flags that restrict a lot of options (since this is a headless server). You can see the current list of USE flags at the Gentoo.org site. You can find the default set of USE flags via "cat /etc/make.profile/make.defaults". The default listing in the 2005.1 profile is:

livecd / # ls -l /etc/make.profile
lrwxrwxrwx 1 root root 48 Oct 22 21:04 /etc/make.profile -> ../usr/portage/profiles/default-linux/x86/2005.1
livecd / # cat /etc/make.profile/make.defaults
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/profiles/default-linux/x86/2005.1/make.defaults,v 1.4 2005/08/29 22:20:25 wolf31o2 Exp $

USE="alsa apm arts avi berkdb bitmap-fonts crypt cups eds emboss encode fortran foomaticdb gdbm gif gnome gpm gstreamer gtk gtk2 imlib ipv6 jpeg kde libg++ libwww mad mikmod motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pdflib perl png python qt quicktime readline sdl spell ssl tcpd truetype truetype-fonts type1-fonts vorbis X xml2 xmms xv zlib"
livecd / #


Here are my current customized USE flags (for a headless server with no GUI shell).

# less /usr/portage/profiles/use.desc
# echo 'USE="apache2 kerberos ldap postgres samba -alsa -apm -arts -bitmap-fonts -gnome -gtk -gtk2 -kde -mad -mikmod -motif -opengl -oss -qt -quicktime -sdl -truetype -truetype-fonts -type1-fonts -X -xmms -xv"' >> /etc/make.conf
# nano -w /etc/make.conf


The changes between this time and my last install are:

Added: postgres samba
Added: -alsa -arts -bitmap-fonts -gtk2 -mikmod -motif -truetype-fonts -type1-fonts -X
Removed: -gif -jpeg -mpeg -oggvorbis -pdflib -png

Since I'm starting with a stage 3 tarball, I'm skipping directly to 7. Configuring the Kernel in the handbook.

# ls /usr/share/zoneinfo
# ln -sf /usr/share/zoneinfo/EST5EDT /etc/localtime
# date
# zdump GMT
# zdump EST5EDT


Pick your kernel using the kernel guide. Last year, I went with development-sources for the kernel in order to get 2.6. This is no longer necessary (and development-sources has been rolled into vanilla-sources). So I'm going to go with the default gentoo-sources.

# emerge gentoo-sources
# ls -l /usr/src


Next up is configuring the kernel, which I'll cover in another post.