Doing things right, before your eyes
Tuesday, January 18th, 2005Ok, I’ve changed some of the things I’m going to do, so I’m starting from scratch (again)
First, boot off of the livecd. Use the “gentoo” kernel.
gentoo
Next, load in the module for the sata hard drive and the network card.
# modprobe sata_via
# modprove via-velocity
Get an IP, and check to see that we can ping the outside world
# dhcpcd eth0
# ping www.google.ca
Everything working as expected so far.
Here’s where I diverge from the previous attempt - I’ve decided to use LVM to handle most of the system’s filesystems. This way I can get away with leaving them undersized a bit, and expanding them as need arises. I’ve decided to go with two logical volumes, in hopes that I can get away with keeping most of my system on one drive, and only using physical volume spanning when I add another hard drive for the myth recordings. This changes my partition structure as follows:
/dev/sda1 -> /boot - 100Megs
/dev/sda2 -> swap - 2Gigs
/dev/sda3 -> / - 5 Gigs
/dev/sda4 -> Extended
/dev/sda5 -> vg1: /var /usr /home /tmp - 30 Gigs
/dev/sda6 -> vg2: reserved for myth recordings - The rest ~ 163Gigs
I set the type of sda5 and sda6 to Linux LVM (8e)
set up swap:
# mkswap /dev/sda2
# swapon /dev/sda2
Load the LVM module and follow the instructions from the Gentoo LVM2 howto:
#modprobe dm-mod
mkdir -p /etc/lvm
# echo ‘devices { filter=[”r/cdrom/”] }’ >/etc/lvm/lvm.conf
# vgscan
Create the physical volumes:
# pvcreate /dev/sda5 /dev/sda6
Create the volume groups (creatively named vg1 and vg2):
# vgcreate vg1 /dev/sda5
# vgcreate vg2 /dev/sda6
Create the logical volumes:
# lvcreate -L10G -nusr vg1
# lvcreate -L5G -nvar vg1
# lvcreate -L2G -ntmp vg1
# lvcreate -L10G -nhome vg1
If you do the math up there, it doesn’t quite add up to the 30G that I allocated in fdisk. I couldn’t allocate the full 13G for /home, and I assume that’s because of the way space is calculated (1000 vs. 1024) but I’m not positive. I actually increased it with:
# lvextend -L+500M /dev/vg1/home
and so on, until it arrived at 10.95GB, which is all that would fit.
Now I make the filesystems:
# mke2fs -j /dev/sda1
# mke2fs -j /dev/vg1/usr
# mke2fs -j /dev/vg1/var
# mke2fs -j /dev/vg1/tmp
# mke2fs -j /dev/vg1/home
Next we mount the filesystems:
# mount /dev/sda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mkdir /mnt/gentoo/usr
# mkdir /mnt/gentoo/var
# mkdir /mnt/gentoo/tmp
# mkdir /mnt/gentoo/home# mount /dev/sda1 /mnt/gentoo/boot
# mount /dev/vg1/usr /mnt/gentoo/usr
# mount /dev/vg1/var /mnt/gentoo/var
# mount /dev/vg1/tmp /mnt/gentoo/tmp
# mount /dev/vg1/home /mnt/gentoo/home# chmod 1777 /mnt/gentoo/tmp
I made sure the time and date were correct, and set to GMT - we’re GMT-6 here, and I’ll set the timezone stuff up later.
Extract the stage 1 tarball from the liveCD:
# tar -xvjpf /mnt/cdrom/stages/stage1-amd64-2004.3.tar.bz2
Unpack the portage snapshot from the liveCD:
# tar -xvjf /mnt/cdrom/snapshots/portage-20041022.tar.bz2 -C /mnt/gentoo/usr
Add in the use flags that I want:
# nano -w /mnt/gentoo/etc/make.conf
I made the following changes to that file:
CFLAGS=”-march=athlon64 -O2 -pipe”
MAKEOPTS=”-j2″
Next comes the painful mirrorselction bit (only painful because it’s slow, and I should have kept the selected mirrors that I found last time…)
# mirrorselect -a -s4 -o |grep ‘GENTOO_MIRRORS=’ >> /mnt/gentoo/etc/make.conf
While that’s running, I might as well copy over the DNS resolution information to it’s new home:
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# mount -t proc none /mnt/gentoo/proc
Now comes the chroot to the new environment:
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile
Update the portage tree:
# emerge –sync
(Note that’s a double dash before sync, but this blog software autoconverts it to an em-dash)
Based on what I’ve read about MythTV, here’s what I set up for additional use variables (in /etc/make.conf):
“USE=X gtk gtk2 kde mysql apache2 dvd lirc dvdr encode imap php samba xine xvid xvidinfo”
A couple of those aren’t required for Myth, but this box will also be doing other stuff for me, so I added them in. Also worth noting is that those are just the ones that I didn’t spot in the default list. Once I get the system up and running to the point where I can post to this blog with it, I’ll post the output of “emerge info” that lists all the use flags that are set for the system.
Next I set up the system to only activate the locales I care about:
# echo “sys-libs/glibc userlocales” >> /etc/portage/package.use
and then specify the system to only use the following locales:
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
by commenting out all the other lines.
Now I’m ready to bootstrap the installation. I want to see approximately how long it takes to do the compilation, so I download the files first:
# cd /usr/portage
# scripts/bootstrap.sh -f
then once the download is done, I run:
# scripts/bootstrap.sh
…
…
It only took about an hour and a half to two hours. Not so bad.
Next, I need to get the core system source:
# emerge –fetchonly system
It kept timing out, so I hit Ctrl-c and commented out the GENTOO_MIRRORS=”….” line in /etc/make.conf and ran it again.
After a much better download, I did the real deal:
# emerge system
It took a while, but I didn’t think to time it.
Next step is to get the kernel source installed:
# emerge gentoo-dev-sources
Next I did a manual configuration of the kernel:
# cd /usr/src/linux
# make menuconfig
I’ll post my kernel config here later, when I can copy/paste from the menuconfig into the web.
After all that configuring, compiling the kernel and modules with:
# make && make modules_install
took only a couple of minutes to complete - I guess this machine is a lot faster than my old P200 (I compiled my OpenBSD kernel on it once. Once.)
So that’s where I sit. I haven’t configured the modules yet, and I haven’t set up the system for a reboot, but I’m well on my way to a fully functional Gentoo system.