Here are my notes on installing the AMD64 build of Gentoo on my EPoX 9NPA+SLI with an Athlon 64 3000+. It’s my primary Windoze box, for development and gaming, but it’s now being dual-booted as a testbed for a future MythTV-based media center… hopefully IN TIME FOR THE WORLD CUP! 😛
The Gentoo Handbook has pretty much everything you need. This is just a set of notes I’m writing during my installation. The first piece of advice I have is to let go and have fun – you won’t be in control of things at all times, which can be frustrating if you’re champing at the bit to get things running – just view it as an adventure, grab a beer pull up a chair and kick back, here we go.

Grab the latest Gentoo live cd for your architecture (mine is AMD64), pop it in your drive, and reboot. Setting up networking is the first step, and it sucks if it doesn’t go smoothly because you feel completely isolated from any help – at best you have another machine that you can use to browse all the documentation that you can’t copy/paste from. Many eons ago, my friend John and I were both stuck on this part for months, trying to get our first Linux installs off the ground. At that time, the eventual solution was to only use gear that was confirmed to be supported. Network support is much more complete these days, take your time here, you’ll get it running. If it gets bad, go out and plop down a few bucks for a 3Com network card, throw it in your machine, and try again.

Gentoo recognized my mobo’s built-in Nvidia Networking Controller and set it up as eth1, for some reason. I spent a little time trying to get eth0 working before I realized I should just reconfig eth1 to use my pre-assigned LAN IP address. Humming along now.

Once networking is up, save yourself some trouble and take Gentoo up on its advice to ssh from another machine. It’s like installing from your LazyBoy instead of your neighbor’s lawn chair. Just set a root password, start up sshd, and ssh in from a more comfortable location:

passwd root
(type something you will remember, it’s only temporary)
/etc/init.d/sshd start
(then ssh from another machine to the LAN IP address)

Now that you’re in your LazyBoy, put up the footrest and make sure you’ve got the Gentoo handbook up in a browser.

The next major step in the handbook is to set up your disk partitions. If you’re dual booting (I am), you will probably want to shift around and resize existing partitions (unless you dropped in a fresh new hard drive just for Gentoo). I went through all my CD’s looking for that Partition Magic CD that I need without fail every other year or so to no avail. Then I thought – ridiculous, there must be open source partition managers. Viola, found two nice ones:

  1. GParted – Grab the livecd ISO. It’s small and made to do what you need.
  2. QTParted on the Knoppix live CD – OK I could get distracted for HOURS on this one… (two hours and a beer later…) 😛

These babies kick ass, they even find drives for all the media I happen to have plugged in to my USB media reader. Fire up GParted, it’s sweet – and I got a bonus – I found I had an old Linux drive in the Windoze box that I forgot all about – to quote Jack Handy, “because eh, free dummy!” Here’s what it looked like:

  • hdb1 – boot partition
  • hdb2 – swap partition
  • hdb3 – a 74GB partition with only 2GB used! By who knows what, probably Redhat Linux 7 or some such shiznit…

So, being a packrat, I resized the 74GB partition down to 2.5GB, using GParted, and now I’ve got an unpartitioned 72GB to swim around in for the Gentoo AMD64 install, whoop! I will try to reuse the boot (hdb1) and swap (hdb2) partitions – again, “free dummy”, why not.

OK, after resizing, it looks like I am only using 1GB on the small partition. I wonder if there’s anything at all on there… OK I’m bucking the packrat urge and taking over this drive! Once again, the Gentoo Handbook kicks ass, recommending [-O] on ext3 to enable hashed b-tree indexing that “enables high performance in almost all situations”.

mke2fs -j -O dir_index /dev/hdb1
mke2fs -j -O dir_index /dev/hdb3
mkswap /dev/hdb2
swapon /dev/hdb2

Now, to put something on there! Errr… or not… if I make hdb1 bootable, what’s going to make BIOS go there for the Master Boot Record instead of hda1 (which is NTFS, and also bootable)? Oops. Three choices, as I see it…

  1. see if BOIS can be set to boot from the second hard drive
  2. forget booting from hdb and use hda1 as-is
  3. split hda1 into a small bootable hda1 and a huge hda2

(3) is the “correct way to do multi-boot”. (1) would be easy if I were in front of the box, but I’m far away in my LazyBoy. (2) is doable remotely, but hda1 is one huge NTFS partition, and I’m worried I might just blow away my Windows install there if I try to install grub as the boot loader? Jim, the sysadmin at work, says it will work, I have my doubts… Oh well, cest la vie, it’s Windoze, who cares! Here we goooo!!

And here we stop (after attempting to remove the hdb1 boot partition without unmounting first, doh!):

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.

Ah well, the remote session was fun while it lasted. Time to pick it back up when I’m in front of the box again… OK, back, reboot! I dropped in my Hauppage PVR-350 (and blew out 4 pounds of dust) before powering back up. Man this junk is loud! Note to self: buy some quiet fans. Continuing…

mke2fs -j -O dir_index /dev/hdb2
mkswap /dev/hdb1
swapon /dev/hdb1

We’ll see if I wipe out Windoze using it as the boot partition… OK, so that doesn’t make me warm and fuzzy… I researched further and I’m not liking the idea of trying to use hda1 for Windoze AND grub. So… back to resizing. I will make the boot partition AFTER the Windoze partition, since (1) GParted doesn’t seem to want to MOVE NTFS partitions (only resize); and (2) grub is supposedly all OK with LBA “out of the box”, meaning it can handle a boot partition up above the 1024th cylinder. Here goes!OK that was a bust – GParted couldn’t resize hda1 because it says it has bad sectors, and I need to run chkdisk, reboot twice, blah blah blah. Ahh shaddap! 😛 I checked out the BIOS boot order and I can set hdb to boot first. So… back to the original partitioning scheme. We having fun yet, whooop! I am, I’m on my 67th beer here, whoooo! That, and the World Cup kicks off tomorrow!! And all those new tunes from Pandora are really starting to sound good. Life is sweet, who cares about a little re-partitioning.

OK got hdb set up for Gentoo. Wait a minute, wouldn’t it be sweet to have the swap on hda, to get two hard drive heads working for us in parallel? Yeah yeah… Isn’t it fun to obsess? OK, so I’m booting back into Windoze (after flipping BIOS to boot from hda first again) and running chkdisk a couple times or whatever… except I can’t get Windoze to boot up. I think I turned off the boot flag on hda1 at some point. Booting GParted back up and flipping hda1 back to a boot disk. And then reboot, there’s that rascally Windoze again. Apparently stuffing that Hauppage card in really confused it, the rez is pure old skool VGA. Whatever. Now wipe the poop out of your drawers, dopey Windoze. It wouldn’t do a chkdisk without a reboot, man I’m gonna be drunk before this thing gets done… in the meantime, played with the Gimp and posted the next story on alpha-blending… and it’s done… and GParted still isn’t happy, it wants me to reboot more, set some -badsectors flags, blah blah. Forget it, we’ll do it all on hdb for now. Well I’ve gotten really good at configuring the Gentoo live environment:

net-setup eth1
passwd root
/etc/init.d/sshd start

OK (Wow I just realized I say that a lot – I say “wow” a lot too, wow… anyway… (that’s the other word I say a lot) OK! Are you drunk too by now? You’d have to be to read this far!! ). Time to start the Gentoo party. Only a few more hours until World Cup time… which is my goal for all this, to use MythTV to record the games I can’t watch live. Here we go!

Following along in the handbook, we want to mount our shiny new partitions so we can abuse them – err, sorry, BEAUTIFY them with our Gentoo files. Looks like the live CD already created /mnt/gentoo, so here’s all we have to do:

livecd ~ # ls /mnt/gentoo
livecd ~ # mount /dev/hdb3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/hdb1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo
livecd ~ # tar xvjpf /mnt/cdrom/stages/stage3-amd64-2006.0.tar.bz2

And we’re actually doing something. Followed the steps to grab Portage next, just as it’s described in the handbook. Links is cool! OK OK I’ll stop being such a dork with all the exclamation points and smileys and shiznit. I was only doing it because I know it was pissing you off. ALRIGHT! SORRY! Geesh.

After looking through the gcc manual, it seemed obvious that the defaults (-O2, for example) were pretty good and I didn’t need to mess too much. Here’s my /etc/make.conf:

#MDM added -march=k8 to target AMD64.
#MDM Also added -mtune cause i saw it somewhere and thought “what the hell”
CFLAGS=”-march=k8 -mtune=k8 -O2 -pipe”
CHOST=”x86_64-pc-linux-gnu”
CXXFLAGS=”${CFLAGS}”

#MDM “MAKEOPTS for a regular, 1-CPU system”
MAKEOPTS=”-j2″

Now for those crazy-assed USE flags… what to pick… here are some I dug up from googling… I suppose I will just add them all… ugg…

USE=”X mysql mythtv apache2 alsa dvb usb lirc nvidia mmx sse 3dnow avi crypt flac gif imlib jpeg mad mpeg oggvorbis opengl png quicktime sdl tiff truetype xmms xv zlib transcode xinerama net xvid v412 theora qt kde acpi directfb ffmpeg xine divx4linux v4l gtk gtk2″

Or the (more-up-to-date?) shorter list…

USE="X mysql mythtv apache2 alsa dvb usb lirc nvidia"

OK, it’s kernel time. There are two options:

  1. configure it manually – you must completely grok your hardware
  2. use genkernel, which probes for hardware automatically, like the live cd does

I tried configuring manually and couldn’t even figure out what network driver I needed. Fuggedaboudid. One nice trick – boot up with the live cd and type [lspci], it will show you what it sees attached to your motherboard. In my case:

00:00.0 Memory controller: nVidia Corporation CK804 Memory Controller (rev a3)
00:01.0 ISA bridge: nVidia Corporation CK804 ISA Bridge (rev a3)
00:01.1 SMBus: nVidia Corporation CK804 SMBus (rev a2)
00:02.0 USB Controller: nVidia Corporation CK804 USB Controller (rev a2)
00:02.1 USB Controller: nVidia Corporation CK804 USB Controller (rev a3)
00:04.0 Multimedia audio controller: nVidia Corporation CK804 AC’97 Audio Controller (rev a2)
00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev a2)
00:07.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3)
00:08.0 IDE interface: nVidia Corporation CK804 Serial ATA Controller (rev a3)
00:09.0 PCI bridge: nVidia Corporation CK804 PCI Bridge (rev a2)
00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
00:0b.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0c.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0d.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:0e.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:04.0 Multimedia video controller: Internext Compression Inc iTVC15 MPEG-2 Encoder (rev 01)
01:09.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host Controller (rev 80)
02:00.0 RAID bus controller: Silicon Image, Inc. SiI 3132 Serial ATA Raid II Controller (rev 01)
05:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600 GT] (rev a2)

Like I said, fuggedit, let’s just go with genkernel and not be all macho/masochistic about it. Since I couldn’t figure out the network driver, it’s back to the boot cd, then manually mounting/chrooting everything again.

reboot
net-setup eth1
passwd root
/etc/init.d/sshd start
(ssh from elsewhere)
mount /dev/hdb3 /mnt/gentoo
mount /dev/hdb1 /mnt/gentoo/boot
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1=”(chroot) $PS1″

Whew! Now we’re finally ready to rebuild the kernel, genkernel-style…

emerge genkernel genkernel –menuconfig all

The –menuconfig option lets you manually change things if you need, which sounds nice. I have to be honest with you, I’m tired of typing all this, so from here on out it’s just what I need to remember…

Went back to “make menuconfig” after getting ridiculed on #gentoo for using genkernel. 😛

# cd /usr/src/linux # make menuconfig

forcedeth is what was needed

compiled it into kernel, didn’t do it

compiled as module, didn’t do it

examined errors – /var/log/dmesg – looking at eth0 now, not eth1

fixed /etc/conf.d/net to use eth0

used rc-update to change from eth1 default startup to eth0

reboot, seems to work now, cool

used rc-update to add sshd on startup

emerge portage

emerge –ask –update –deep –newuse world

(some conflict, googled for solution)

emerge -C pam-login && emerge -1 shadow

emerge –update –deep –newuse world

going and going… man, glibc is a big bad motha…

done. etc-update to update something like 50 config files, -5 to do em all whoop!

emerge mythtv (here we go! – that kicked off qt and 40 other deps…)

now how do i install a window manager to run at boot again… did it… using gdm…

x won’t start, need nvidia driver – using this

cd /usr/src/linux
make menuconfig
fix as directed (especially, remove nvidia framebuffer/riva support)
make
make modules_install
mount /dev/hdb1 /boot
cp arch/x86_64/boot/bzImage /boot/kernel-genkernel-x86_64-2.6.16-gentoo-r9-mdm_manual_config
(reboot)
emerge nvidia-glx
modprobe nvidia
nano /etc/modules.autoload.d/kernel-2.6 (add nvidia)
modules-update
eselect opengl set nvidia
nano /etc/X11/xorg.conf (farted around here, isn’t there some way to auto-detect and set this up?)
emerge nvidia-settings

Here’s a note from the install guide, I’ll try to remember this: Important: Every time you compile a new kernel or recompile the current one, you have to run “emerge nvidia-kernel” to reinstall the nVidia modules.

I have a couple tools to remember, as well: nvidia-settings (to change video settings without restarting X), glxinfo (with “|grep direct” to check for direct rendering), glxgears (monitors FPS).
OK, X not working, find a “configure X Howto“:

Xorg -configure (to auto configure)
X -config /root/xorg.conf.new

Failing, google revealed that the default /dev/mouse suxx0rz, looks like I need to change it to /dev/input/mouse0. That got it working! But looks like ass, try adjusting to a higher rez – not working. Used the following (taking guesses, screw it) to help me set up the monitor:

xorgconfig

Got it! Both nvidia support and a hirez display. Now, where do we copy it to…

cp /root/xorg.conf.new.mdm /etc/X11/xorg.conf
reboot

OK, everything looks good! Pretty gdm… Next problem, can’t [su -], “permission denied”, wtf. Kind of impossible to google for that without getting a million irrelevant hits. Asked for help on #gentoo, got this:

[moodboom] hey all – i just installed gentoo on an amd64 box – all is well, except i can’t log in as root with “su -” (permission denied) – i can log in from gdm, or single user – any ideas?
[penguin] moodboom: that question has been covered 1234873245 times on the forum
[penguin] and is probably part of the Gentoo Handbook AND several FAQs
[penguin] UTFS, in other words
[penguin] to get back to what I was saying

Sigh… read through the Gentoo forums, for some really stupid reason you have to add users to “wheel” to be able to su to root, whatEHvah:

gpasswd -a m wheel

OK, upwards and onwards, on to MythTV configuration…

To get ivtv to install, I had to add a couple kernel modules (drivers that have been moved from ivtv space to kernel space, FWIU):

  • CONFIG_VIDEO_BT848 found at “Device Drivers”; “Multimedia Devices”; “Video For Linux”; “BT848 Video For Linux”. This option enables the msp3400 module.
  • CONFIG_VIDEO_AUDIO_DECODER found at “Device Drivers”; “Multimedia Devices”; “Video For Linux”; “Add support for additional audio chipsets”. This option enables the wm8775 and cs53l32a modules.
  • CONFIG_VIDEO_DECODER found at “Device Drivers”; “Multimedia Devices”; “Video For Linux”; “Add support for additional video chipsets”. This option enables the saa7115, cx25840 and saa7127 modules.

Then I did [emerge ivtv lirc] and it seemed to work. Note that when I started this process, the ivtv driver was masked for amd64, but now it looks good to go. I was browsing on a gentoo dev site and (re-)realized how much work goes into maintaining a great distribution. Thanks gentoo dudes.
From the Gentoo Mythtv HOWTO:

# this helps to include all the “common features”
echo “media-tv/mythtv alsa opengl vorbis dvb dvd ieee1394 lirc mmx xvmc” >> /etc/portage/package.use
# this shows what USE flags will be/are used for mythtv
emerge -pv –nodeps mythtv

OK, things MIGHT be going well, if gentoo were in a stable spot, but it’s not. I really really wanted to avoid dealing with the big raw ugly bloody newborn that is “modular xorg”, but I can’t do an [emerge world] without hitting a zillion problems. I wonder if I can figure out how to mask around it, as it’s not even supposed to work with nvidia yet… argee…
Correction: 7.1 doesn’t work with “binary drivers” (eg nvidia), just don’t do any unmasking to enable 7.1 and it sounds like 7.0 will be fine, knock on wood. (Andrea says “come here so i can use your head”). So here we go…

emerge gentoolkit
quickpkg xorg-x11
emerge -Ca xorg-x11 virtual/x11
equery uses -a xorg-x11 (geesh that’s a lot of flags, adding “dri mmx 3dnow sse” to /etc/make.conf USE flags)
emerge -a xorg-x11 (101 packages later, zzzzzz….)
* Please note that the xcursors are in /usr/share/cursors/xorg-x11.
* Any custom cursor sets should be placed in that directory.

* If you wish to set system-wide default cursors, please create
* /usr/local/share/cursors/xorg-x11/default/index.theme
* with content: “Inherits=theme_name” so that future
* emerges will not overwrite those settings.

* Listening on TCP is disabled by default with startx.
* To enable it, edit /usr/bin/startx.

* Please read the modular X migration guide at
* http://www.gentoo.org/proj/en/desktop/x/x11/modular-x-howto.xml

* If you encounter any non-configuration issues, please file a bug at
* http://bugs.gentoo.org/enter_bug.cgi?product=Gentoo%20Linux
* and attach /etc/X11/xorg.conf, /var/log/Xorg.0.log and emerge info

* You can now choose which drivers are installed with the VIDEO_CARDS
* and INPUT_DEVICES settings. Set these like any other Portage
* variable in /etc/make.conf or on the command line.

* Visit http://www.gentoo.org/doc/en/index.xml?catid=desktop
* for more information on configuring X.
etc-update
revdep-rebuild

Wow, this isn’t kids’ stuff, it’s rebuilding all of mythtv… zzzz… literally, it’s time for bed…

BACK. I forget where I left off. I think the box is somewhat working now, but I haven’t fully configured MythTV. You’ll have to excuse that lameness, as I’ve ordered a new PC and have been spending my time putting it together…


Before
After

and taking it apart when the mobo wouldn’t post, and sending it back, and (now) waiting for new pieces to arrive (mobo was bad, I fried an AMD64 chip in the process, awaiting a replacement for that)… AHH THE JOY OF BEING A GEEK. Stay tuned for another post on setting up the new box.

4 Comments

  1. who is posting this stuff? who is the addmin of this we8site? Is who i think the addmin acually not the addmin? am i spelling addmin correctly? What is the ultimate answer to life, the universe and everything? Am i really posting this, or am i just 8eing a troll? am i even real? the answer to the last one is yes. and if the addmin is who i think it is, then reply to this with what the gillespies call your house.

  2. How do i change my logo? can i even change my logo? why am i asking so many questions?

    • m says:

      I just turned on those dumb monster thingees, they are cracking me up now!

      I think if you have a gravatar it will use that.

      And… i can’t imagine ANYONE reads this stuff!!! EXCEPT you and me, now! hah

      oh..l. Warm bm run!~?!

  3. Johnc201 says:

    I got what you intend, thankyou for putting up.Woh I am glad to find this website through google. It is a very hard undertaking to seek to please everybody. by Publilius Syrus. fgbegabcdabe

Leave a Reply to m