punkwalrus (punkwalrus) wrote,

  • Mood:
  • Music:

Linux - How to Install Gentoo via Floppies and Network Only Using Fedora Floppies

I had lying around the office an old Pentium box, and suddenly, a lot of time to kill. I was stuck in a 2 hour phone conference from hell, and I was desperate to do something, anything, that didn't require a whole lot of thinking, and to be paced for freqent interruptions (if anything, to fake interest by asking stuff like, "Okay, so if I understand, we're doing XYZ on Site A unless we don't get what we need from Vendor B? Have we thought about using Linux? Okay, just checking"). There is no real comprehensive online "How to" manual on doing this, but there's a lot of scattered info around, and most of it glazed over the "use another distro's floppies." This whole thing took me several days of trial and error doing just that. Problem is with this machine, it has no CDROM. I decided to see if it was possible to install Gentoo via floppy and network. I got far with TomsRtBt disk, but the kernel was too old, and so it halted at the chroot phase. But here's my simple recipe to install Gentoo on a box with no CD-ROM.

Disclaimer: If you use my instructions, and hose your system, tough luck. This is what I did and it worked. You could ask questions, but I could not answer. Ask around on the Gentoo Forums (nicely, not "HELP!!! OMG I used Punkie's system and it faild! WTF!!!1!?? he suzz0RZZ !11!!").

Here we go...

Equipment Used for Test

To do all this, you must have

  • An i386 machine with at least 16mb RAM and 2 gb hard drive space
  • Working network connection to the Internet (so, yeah, also a NIC), with DHCP that gives you DNS
  • The usual stuff like video card, monitor, electical power... you know, "duh!"

If you don't have a network connection on another system to look at documentation, print these instructions out, and print this page out as well.

Step 1: The "Other distribution" You Piggyback

We're using Fedora Core 1 floppies because they have all the tools we need. Slackware didn't have DHCP, so while I love Slack, their floppies left me out cold during emerge attemps with "cannot find [url of portage files]" when I tried to download them. My DHCP gave me the DNS from the ISP, so that worked out fine. I'm not sure what to do if you only have static IP to resolve names.

First, get the floppy images bootdsk.img and the drvnet.img (if you have a laptop with PCMCIA, you need that image as well, but I am not sure what do do about PCMCIA, and so that's, as they say, "beyond the scope of this document"). Burn the floppies using dd or rawwrite, whatever you have. Label at least one of them so you know what the other is.

Put in the boot disk, and make sure the computer knows to boot from the floppy first. You'll get a Bluecurve Fedora logo and prompt. Then hit F5 for rescue mode, and type in "linux rescue." Choose defaults for keyboard and language (or not, see how that screws things up and tell me what happened). For install, we're going to choose FTP, but you can use HTTP or even NFS is you have the ISOs on a local NFS share. Note: Fedora, in its coolness, doesn't even require you unpack and ISO, you can get a rescue image right off the ISO if you want! But right now, I'm keeping this simple. Now it will ask you for the network disk. Put that in. Hopefully, you don't have some weird-ass card the disk doesn't have a driver for. I had a 3com, and that's pretty standard. Choose DHCP (you could put in a static IP, but I don't know how you'd get DNS, you'd probably have to manually edit the /etc/resolv.conf). Now it should ask you for the server and directory. I chose one that was easy:
ftp server: mirror.linux.duke.edu
Red Hat directory: /pub/fedora/linux/core/1/i386/os/

But choose one closest to you and pray that Redhat didn't have some major release that day that clogs the servers. The rescue image might take a while to load "Fedora/base/starge2.img", I am not sure how big it is. On my office LAN and home cable connection, I got it to load in about 1 minute. When Fedora asked me if I wanted to leave my disk read-only, I said, "SKIP," which dumps me to the command shell. You don't want "Read Only," and if you search "CONTINUE," Fedora then searches for existing Red Hat installs, and then puts you in a "bash-ish" shell as root, mounting /mnt/sysimage as your old root directory (if you had anything on that hard drive before). SKIP will just put you in the shell.

Last note here: These floppies use a series of restricted commands through a process known as "Busybox," which is one small program with a ton of aliases that simulates a shell environment. A lot of the functionality you might be used to from certain shell commands might be limited, like switches you are used to might be gone. For example, "df -h" would show you disk info in human readable format, but the "-h" is not used in Busybox.

Step 2: Figure out Your Hard Drive Setup

I needed to plan out where everything went. I decided to devide the disks like thus:
Partition Filesystem Amount
/dev/hda1 /boot 100mb
/dev/hda2 swap 325mb (rest of small disk, because I don't have much RAM)
/dev/hdb1 / 3.1gb (the whole of the larger disk)

Now, here's what I did to partition. When you do this, make sure you get your partitions correct (don't use my example unless you fdisked them the same way):

  • fdisk /dev/hda
  • Used "d" to delete former partitions
  • Used "n" to make new partitions (there's only 2, so I made them primary)
  • Partition 1: +100M
  • Partition 2: (rest of disk, default start and stop cylanders)
  • Used "t" to change partition 2 to type 82 (LINUX SWAP)
  • Used "w" to write new table
  • fdisk /dev/hdb
  • Used "n" to make new partition
  • Partition 1: [all of disk]
  • Used "w" to write new table

Your partitions may vary. Now I had to format everything to a filesystem. I like ext3 (ext2 with journaling), so that's what I used. I made the other a swap file, and turned it on:

  • mke2fs -j /dev/hda1
  • mke2fs -j /dev/hdb1
  • mkswap /dev/hda2
  • swapon /dev/hda2

Now I had to mount them (note the order):

  • mkdir /mnt/gentoo
  • mount /dev/hdb1 /mnt/gentoo [mount root directory on Partition 1 on second hard drive]
  • mkdir /mnt/gentoo/boot
  • mount /dev/hda1 /mnt/gentoo/boot [mount boot directory on Partition 1 on first hard drive]
  • mkdir /mnt/gentoo/proc
  • mount -t proc none /mnt/gentoo/proc [mount x86 process file system]
  • date MMDDhhmmCCYY in date syntax [MMonth, DDay, hhour, mminute, CCentury and YYear] - like "042516212004"]
  • cd /mnt/gentoo

Now you are in your virtual hard drive!

Step 3: Get Your Tarball Stages

Now I had to get the tarball stages! But I don't have links, or lynx, or anything but wget! What am I going to do??? Well, I wrote down where a stage 1 tarball would be (picked at random from here), and did a wget:
wget http://lug.mtu.edu/gentoo/releases/x86/2004.1/stages/x86/stage1-x86-2004.1.tar.bz2

Then I waited a while. Busybox has a really optimized system, so there was no progress meter in wget or anything. The blinking LAN LED told me something was happening. After about 5 minutes, I was back to the prompt again, and when I did an ls, there is was! Next, I had to decompress the stage. The command in Busybox is:

  • bzip2 -d stage1-x86-2004.1.tar.bz2
  • tar -xvf stage1-x86-2004.1.tar.bz2

An ls command showed all the directories were there! So far, so good! Now I needed to check my make.conf to make sure that all my optimizations for a stage 1 were where I liked them. Busybox does not have nano, so I used vi instead (oh, stop complaining).
/mnt/gentoo# vi /mnt/gentoo/etc/make.conf

It already had most the optimizations for a P2 (i686). I only added "-pipe" to CFLAGS, changed CHOST to "i686-pc-linux-gnu", and added MAKEOPTS="-j2". Now usually I'd do a mirrorselect because ... I don't have it on Busybox. Gentoo told me not to worry about it. So I didn't. Now we have to enter our environment.

  • cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
  • chroot /mnt/gentoo /bin/bash
  • env-update
  • source /etc/profile
  • emerge sync [this might take a few minutes]

Now you should be able to follow the directions from here, at "6.c. Progressing from Stage1 to Stage2"

Step 4: Final Notes

I had a prblem when I tried to "emerge grub," I got an error that my /boot was unwriteable. This was fixed by doing a "umount /boot" command, and then "emerge grub" again. Apparently the grub scripts try and remount an already mounted /boot and barf.

When you edit the /etc/fstab, make sure you spell it "tmpfs" and not "tempfs," like I did. Doh.

Don't forget to set your password with passwd before you exit from chroot and unmount everything. I forgot to do that, and couldn't log into my box! I had to redo all the mounting and chrooting, and then do the passwd command. Bleah.

Total build time: 29hours (not including redoing, and pausing for mistakes and studying what to do next).
Helpful place: Gentoo Forums. I cannot stress how great these forums are.

I hope this helps somebody out there. Good luck!
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded