Wednesday, April 20, 2005
Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 5)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

(previous step)

Time to install the bootloader. I plan on using GRUB:

# emerge grub

Now to configure GRUB (refer to my old post about GRUB for a more in-depth explanation of what I'm telling GRUB to do here).

# 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
#


Now, edit your config file for grub:

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

Here is what mine looks like. Yours may be different, depending on how you configured things (and remember that I'm using Software RAID).

# cat /boot/grub/grub.conf
default 0
timeout 30
title=Gentoo Linux 2.6.11 (April 20 2005)
root (hd0,0)
kernel /kernel-2.6.11-gentoo-Apr20 root=/dev/md2
#


Now I install various system tools (see the handbook):

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


Note: Now you need to unmount everything that you can (including LVM), possibly shutdown the RAID as well prior to reboot.

livecd gentoo # exit
livecd / # cd /
livecd / # cat /proc/mounts

(unmount all of your mounted partitions, including the LVM mounts)

livecd / # umount ... (insert list of mounted file systems)

livecd / # vgchange -an vgmirror
livecd / # reboot


Pull the CD-ROM at this point, otherwise the LiveCD will probably boot.

(next step)

Labels: ,

Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 4)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

(previous step)

Time to configure the kernel.

# emerge lvm2
# emerge mdadm
# 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
--> (P)arallel port support (turned OFF)
--> (A)TA/ATAPI/MFM/RLL support (turned ON the PDC20262 chipset support as BUILT-IN)
--> 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
(P)rofiling support
(K)ernel hacking
(S)ecurity options
(C)ryptographic options
(L)ibrary routines

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

# make && make modules_install

Now you need to install your kernel into the boot partition. Change the "2.6.6-gentoo" portion of the filenames to whatever you want.

# cp arch/i386/boot/bzImage /boot/kernel-2.6.11-gentoo-Apr20
# cp System.map /boot/System.map-2.6.11-gentoo-Apr20
# cp .config /boot/config-2.6.11-gentoo-Apr20


Now we need to configure LVM to auto-load.

# nano -w /etc/modules.autoload.d/kernel-2.6

Here is what my autoload file looks like:

# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07/16 18:13:45 azarah Exp $
#
# Note that this file is for 2.6 kernels.
#
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line. Comments begin with # and
# are ignored. Read man modules.autoload for additional details.

# For example:
# 3c59x

dm-mod


Now, edit the /etc/fstab file:

# /etc/fstab: static file system information.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency). It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs> <mountpoint> <type> <opts> <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/md0 /boot ext2 noauto,noatime 1 2
/dev/md1 / ext3 noatime 0 1
/dev/md2 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

# NOTE: The next line is critical for boot!
none /proc proc defaults 0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
# Adding the following line to /etc/fstab should take care of this:

none /dev/shm tmpfs defaults 0 0


Now, some misc stuff:

# echo yourhostname > /etc/hostname
# echo yourdnsname > /etc/dnsdomainname
# rc-update add domainname default
# nano -w /etc/conf.d/net
(either use iface_eth0="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/rc.conf
(change CLOCK="UTC" to CLOCK="local")
# passwod
(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)


(next step)

Labels: ,

Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 3)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

(previous step)

Time to configure the timezone and setup the kernel, this is chapter 7 in the Gentoo handbook.

Timezone for me is EST5EDT, so here's how to set that up.

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


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


This takes a while to run (maybe an hour or two).

(next step)

Labels: ,

Tuesday, April 19, 2005
Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 2)
(Continuation of part 1)

# ls -l /etc/make.profile

As far as I can tell the 2004.3 already uses the 2.6 kernel, so there's nothing to do here. I also configured my USE flags in my last post, so that's already done as well.

# cd /usr/portage
# scripts/bootstrap.sh


This will take a while to run (I estimate a few hours, maybe even overnight). Once that finishes, you move from stage2 to stage3.

# emerge --emptytree system

Which will also take a few hours.

(next step)

Labels: ,

Gentoo 2004.3 on Gigabyte GA-6VA7+ (part 1)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

This is a continuation of Gentoo and Software RAID (2004.3), where I configured the disks and setup the RAID array. I'm now picking up at the point where the RAID array has been configured and we're ready to start installing file systems.

/dev/md0 - 128MB boot
/dev/md1 - 2GB root partition
/dev/md2 - 2GB swap
/dev/md3 - rest of disk (user files)

Now, some folks say copy the /etc/mdadm.conf file, but in the same breath, they indicate that mdadm does not require the use of a config file at all. Since I'm documenting my configuration here, and my array is extremely straightforward, I'm going to skip creating the mdadm.conf file and see how it goes.

Links:
Software RAID (Gentoo Tips-n-Tricks)
LinuxDevCenter article on mdadm

The LinuxDevCenter article actually explains how to create the mdadm.conf file yourself (semi-automatically). Notice the use of wild cards that lets me compactly express that I want all 4 partitions on /dev/hda and /dev/hdc to be used in arrays. You will need to edit the results to match the syntax of the mdadm.conf file.

# echo 'DEVICES /dev/hda*' >> /etc/mdadm.conf
# echo 'DEVICES /dev/hdc*' >> /etc/mdadm.conf
# mdadm --detail --scan >> /etc/mdadm.conf
# nano -w /etc/mdadm.conf


Contents of my mdadm.conf file:

EVICES /dev/hda*
DEVICES /dev/hdc*
ARRAY /dev/md3 level=raid1 num-devices=2 devices=/dev/hda4,/dev/hdc4
ARRAY /dev/md2 level=raid1 num-devices=2 devices=/dev/hda3,/dev/hdc3
ARRAY /dev/md1 level=raid1 num-devices=2 devices=/dev/hda2,/dev/hdc2
ARRAY /dev/md0 level=raid1 num-devices=2 devices=/dev/hda1,/dev/hdc1


Picking up again with Chapter 4 of the installation handbook. This is also very similar to what I did back in June 2004 with Software RAID and LVM2.

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


Now, we initialize the 4th raid partition for LVM2 operations. See Gentoo LVM2 Documentation for more details about this.

# modprobe dm-mod
# pvcreate /dev/md3
# echo 'devices { filter=["r/cdrom/"] }' >/etc/lvm/lvm.conf
# vgcreate vgmirror /dev/md3
# vgscan


Here is my plan for logical volumes inside the vgmirror partition (this uses up 22GB):

4GB /tmp (ext2)
4GB /var/tmp (ext2)
2GB /opt (ext3)
4GB /usr (ext3)
4GB /var (ext3)
4GB /home (ext3)

Create the logical volumes. If you see the error message "/etc/lvm/backup: fsync failed: Invalid argument", you can ignore this warning (according to Gentoo's LVM2 page).

# lvcreate -L4G -ntmp vgmirror
# lvcreate -L4G -nvartmp vgmirror
# lvcreate -L2G -nopt vgmirror
# lvcreate -L4G -nusr vgmirror
# lvcreate -L4G -nvar vgmirror
# lvcreate -L4G -nhome vgmirror
# ls -l /dev/vgmirror
# lvscan


Output of the lvscan command:

ACTIVE '/dev/vgmirror/tmp' [4.00 GB] next free (default)
ACTIVE '/dev/vgmirror/vartmp' [4.00 GB] next free (default)
ACTIVE '/dev/vgmirror/opt' [2.00 GB] next free (default)
ACTIVE '/dev/vgmirror/usr' [4.00 GB] next free (default)
ACTIVE '/dev/vgmirror/var' [4.00 GB] next free (default)
ACTIVE '/dev/vgmirror/home' [4.00 GB] next free (default)


Format the logical volumes:

# 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


Make the directories to hold your mounted volumes. Mount your volumes.

# mkdir /mnt/gentoo/opt
# mkdir /mnt/gentoo/usr
# mkdir /mnt/gentoo/var
# mkdir /mnt/gentoo/home
# mount /dev/vgmirror/opt /mnt/gentoo/opt
# mount /dev/vgmirror/usr /mnt/gentoo/usr
# mount /dev/vgmirror/var /mnt/gentoo/var
# mount /dev/vgmirror/home /mnt/gentoo/home


Make the special directories to hold your temp file volumes (these require special permissions). Then mount your temp file volumes. Also mount your proc folder.

# 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
# mkdir /mnt/gentoo/proc
# mount -t proc none /mnt/gentoo/proc


Now we move into Installation (chapter 5) in the handbook. Verify your system date and then start extracting the tarballs.

# date
# ls -l /mnt/cdrom/stages
# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/stages/stage1-x86-2004.3.tar.bz2
# ls -l /mnt/cdrom/snapshots
# cd /mnt/gentoo
# tar -xvjf /mnt/cdrom/snapshots/portage-20041022.tar.bz2 -C /mnt/gentoo/usr
# cd /mnt/gentoo
# mkdir /mnt/gentoo/usr/portage/distfiles
# cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/


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

# cat /proc/version
Linux version 2.6.9-gentoo-r1 (root@inertia) (gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)) #1 SMP Thu Nov 25 03:43:53 UTC 2004
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Celeron (Coppermine)
stepping : 6
cpu MHz : 568.097
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


Now we're ready to edit the make.conf file and change flags:

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

Here is my personal make.conf (use at your own risk). This is for a Celeron Coppermine CPU (Pentium III). I prefer to compile for size given the small amount of installed RAM on this system.

CFLAGS="-Os -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
USE="apache2 kerberos ldap -apm -gif -gnome -gtk -jpeg -kde -mad -mikmod -mpeg -oggvorbis -opengl -oss -pdflib -png -qt -quicktime -sdl -truetype -xmms -xv"


Pick up again with Installing the Gentoo Base System in the handbook. Where we pick a mirror and start the move from stage1 to stage3. I see that the mirrorselect command has changed between 2004.0 and 2004.3.

# mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
# mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf


This should have dumped 2 extra lines into your make.conf file (cat /mnt/gentoo/etc/make.conf). Here is what got added to my make.conf file:

GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ http://gentoo.chem.wisc.edu/gentoo/"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"


Now we need to copy some files.

# cp -L /mnt/gentoo/etc/make.conf /mnt/gentoo/boot/make.conf-backupcopy
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# cp -L /etc/mdadm.conf /mnt/gentoo/etc/mdadm.conf
# cp -L /etc/mdadm.conf /mnt/gentoo/boot/mdadm.conf-backupcopy
# mkdir /mnt/gentoo/etc/lvm
# cp -L /etc/lvm/lvm.conf /mnt/gentoo/etc/lvm/lvm.conf
# cp -L /etc/lvm/lvm.conf /mnt/gentoo/boot/lvm.conf-backupcopy


Change into the new system (note that we already mounted the proc filesystem earlier).

# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
# emerge --sync


This should update your portage tree to the latest version (and make take a while to run).

(See the next step)

Labels: ,

Thursday, March 31, 2005
Gentoo 2005.0 on Gigabyte GA-6VA7+ (part 2)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

Okay, tossed the new 2005.0 boot CD in, and I'm booting it up. Just trying a standard default boot for the moment (not trying to use the "nohotplug" option yet).

Load the RAID modules, and verify some things:

# modprobe md
# modprobe dm-mod
# ifconfig { verifies that the ethernet card is working }
# ls -l /dev/hd*


Now, use fdisk to blow away and setup partitions. (Note: You will lose all data on these disks when you perform this step.) Use the 'w' command to confirm the destruction of all partitions when you're finished.

Setup the new 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

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

Command: n
Command action: p
First cylinder: [enter]
Last cylinder: [enter]
Command: t
Partition number: 4
Hex code: fd

Command: p

Command: w


This gives me a 128MB boot area, a 2GB swap area, a 2GB root area, with the rest of the disk set aside for my LVM partitions. Repeat the above commands to configure the 2nd disk in the same fashion. Note that I'm using a different partition type then that shown in chapter 4.c. The 'fd' partition type is what I need to use since all 4 partitions on hda/hdc are going to be put into a software RAID1 set.

The 3rd disk is a single primary partition with the '8E' (LVM) type. (Need to verify this, but I'm pretty sure that's correct.)

Create your "/etc/raidtab" configuration file (I used "nano -w /etc/raidtab", but other text editors will work).

# this config is for mirroring /dev/hda with /dev/hdc
# /boot (RAID1)
raiddev /dev/md0
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 32
persistent-superblock 1
device /dev/hda1
raid-disk 0
device /dev/hdc1
raid-disk 1

# *swap* (RAID1)
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 8
persistent-superblock 1
device /dev/hda2
raid-disk 0
device /dev/hdc2
raid-disk 1

# / (RAID1)
raiddev /dev/md2
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 32
persistent-superblock 1
device /dev/hda3
raid-disk 0
device /dev/hdc3
raid-disk 1

# LVM (RAID1)
raiddev /dev/md3
raid-level 1
nr-raid-disks 2
nr-spare-disks 0
chunk-size 16
persistent-superblock 1
device /dev/hda4
raid-disk 0
device /dev/hdc4
raid-disk 1

# end of /etc/raidtab


Create the raid set(s).

# mkraid /dev/md0
# mkraid /dev/md1
# mkraid /dev/md2
# mkraid /dev/md3


If you get the error message: "raid_disks + spare_disks != nr_disks" when attempting to create any of your RAID sets, go back and verify your "/etc/raidtab" file as well as verifying your disk partitions. The RAID sets will build in the background and you should periodically monitor their progress using "cat /proc/mdstat". Another possibility is that you have set the "chunk-size" setting to be too small or too large (e.g. "chunk-size 4" did not work for me, but "chunk size 8" worked fine).

Building the raid sets may take a while, so once again, I'll come back to this point in a few hours.

Update: mkraid is tossing errors (see my next post)

Labels: ,

Gentoo 2005.0 on Gigabyte GA-6VA7+ (part 1)
Note: These directions are works-in-progress... in fact, they might not even work at all until I find out why I'm ending up with non-bootable systems (looks like a bug in the 2.6 kernel).

While I swap around some memory modules in the old EPIA box, I'm also going to take a swipe at using the new 2005.0 Gentoo image and build a 2nd box.

This is an old Celeron 350Mhz or 400Mhz CPU with 384MB of RAM (Gigabyte GA-6VA7+). About the same power as the VIA EPIA motherboard. I've already gone into the BIOS and disabled all optional ports (serial, parallel, etc). Drives are configured as:

Pri M: 72GB - /dev/hda
Pri S: (free)
Sec M: 72GB - /dev/hdc
Sec S: CD-ROM - /dev/hdd

I also have a 3rd hard drive (80GB, /dev/hde) hooked up to an old Promise FastTrak66 PCI RAID card. It uses the PDC20262 chip and I'm really just using it as an IDE card rather then making use of its RAID functionality.

I plan on mirroring using the two 72GB master drives and using the 80GB as a backup/scratch disk. Similar setup and goals as the EPIA box from last June's install.

Labels: ,