Old Fashioned Gentoo Install

This document describes how to install Gentoo without the hand holding automation features that users have come to take for granted over the last 10 years. It gives you an install as it was before devfs was added to the kernel.

Synopsis
Its possible to start with the official stage3 files. This has only been tested on an amd64/no-multilib install.

As this document is aimed at users with at least one Gentoo install to their credit, it is not a keystroke by keystroke guide, unlike the Handbook. The handbook steps are not repeated here, there is just some general references to it from time to time.

Overview
The install will use root in Logical Volume Manager (LVM) on NVMe, with separate /usr and /var. /home, $DISTFILES and $PACKAGES will be in LVM on rotating rust RAID as Conventional Magnetic Recording (CMR) drives are quite good at sequential access of large files. Thus we need an initrd to get started.

Its unlikely that grub2 will be used as the boot loader. The steps include:


 * Partition the target drive following the handbook.
 * Install the stage3 tarball.
 * Install the portage snapshot.
 * Set up package.mask to keep out unwanted junk.
 * Set up global USE flags to be consistent with.
 * Replace udev with.
 * Follow the handbook to install cron, a logger and a bootloader of choice.
 * Install a kernel.
 * Configure the grub bootloader.
 * Review and edit configuration settings.
 * Reboot to test.

Introduction
This document describes how to install Gentoo with a static using the packages from a stage3 tarball.

What You Get

A modern Gentoo base system but without all the bells and whistles added in recent years. Olde Fashioned Gentooee is more about what you don't get. You do not get:


 * udev - instead a static dev is used
 * systemd - why would you want it anyway
 * pulseaudio - I've not known this to actually add anything
 * hotplug support
 * auto mounting of any sort - use mount by label
 * auto module loading
 * device detection in Xorg

Separate should just work as there is no udev to require that  is mounted before udev starts. If udev starts on your box you have done something wrong. Separate is not tested as I'm using root in lvm, so while my  is separate, bad habits have made me mount it in the initrd.

Access to the Gentoo Handbook is required as this guide makes frequent references to it, there is no point in repeating the handbook here.

Partitioning and filesystem creation
Making the filesystem tree

Follow the Gentoo Handbook up to and including making the filesystems and mounting all the bits at the directory.

I will be using Logical Volumes on top of raid5 because its easier to recycle the volumes than it is with real partitions and if the logical volumes are the wrong size, they can be resized. I happen to have lvm on raid5 space free. This means that I will also describe the initramfs to get the raid assembled and Logical Volumes active. Users installing to real partitions should not need the initramfs.

Making the chroot
Mount and but not  inside the chroot. We will be using a static, so we have to. With bind mounted in the normal way, our static dev would go into the parents devtmpfs which is in RAM. If you are very very lucky, the static provided by the stage3 may be enough to get you started.

The stage3 tarball is provided with a static that includes sda ... sdd inclusive. If you need more that that, use to make the extra  entries. Likewise, there ale no md entries for raid or dm enteries for LVM.

Mount the special filesystems

Entering the chroot
Enter the chroot:

Set the chroot environment:

Setting up package.mask
This is important. Enter the package atoms that you do not want to be installed ever.

Add in anything else you can think of they you really don't want. Always use  with emerge and add more things as they come to mind. mdev might need to be there too.

Setting up package.use
This section is only required if you use raid, or lvm. You will need some packages built with the static USE flag.

Removing udev and Friends

There is a bug in the static-dev ebuild (Bug 469620) that prevents it installing if /proc/mounts reports that a dynamic /dev manager is in use. Either patch static-dev in the overlay or unmount /proc from /mnt/gentoo/proc while static-dev is emerged.

Replacing udev with static-dev:

...see.

emerge sys-fs/static-dev will report some file collisions. That is expected as some elements of a static are provided by the stage3.

The last command should offer to remove the following packages:



Let it run, they all depend on udev, which is no longer installed.

Setting USE in make.conf
Some of my USE flags are AMD specific. The flags that are set off here are for avoidance of optional support for packages we have already masked. Optional support being on would attempt to pull those packages in and emerge would complain about masked packages.

The  flag is a special case. Zeroconfig wasn't around 10 years ago so really should be excluded here.

Adding to /dev
static-dev is a good start but its not moved on in a very long time. Add some of the newer entries required. See for a list


 * mknod all of the /dev/sd* entries you need
 * mknod any /dev/md* kernel multipe device entries required
 * mknod any /dev/dm-X device mapper entries required
 * mknod any /dev/srX devices for your optical drive(s)
 * mknod any other /dev nodes you might want. They can be added at any time

Do not forget nodes for removable storage devices.

DRI users, that's almost everyone except those who use nvidia-drivers for Xorg will need to make. What is needed here is driver dependent.

Populating /etc/conf.d/modules
Only you know what you need here. When you reboot, its a good idea to have keyboard support and udev isn't going to load it for you any more.

Setting up a static overlay
A number of packages that are required for a modern Gentoo system require udev. In some the dependency can be avoided by careful use of USE flags. Others like lvm2 and Xorg have udev included in IUSE. Make a local overlay called static_dev, copy these ebuilds there and remove all references to udev.

Making the kernel
Follow the instructions at http://www.kernel-seeds.org which is mirrored at http://kernel-seeds.grytpype-thynne.org ( http://kernel-seeds.bloodnoc.org/ ) with the following changes

We can leave off the hair shirts. Unix98PTY support does work but the permissions on /dev/ptmx need to be set correctly and /dev/ptmx needs to be mounted crw-rw 1 root tty 5, 2 Mar 18 21:47 /dev/ptmx

Genkernel users are on their own here.

Provided your kernel can boot unaided, no initrd is required

Preparing for usr/gen_init_cpio
To make everything robust and independent of what filesystem gets attached to which /dev node, we will use the filesystem UUIDs everywhere.

There are several ways to make an initramfs, we will use the kernel provided usr/gen_init_cpio script.

The script needs two things, a list of files to include in the initramfs and an init sctipt to execute. The use of usr/gen_init_cpio is well documented in the kernel.

Make a directory to hold the two files. I like /root/initrd. The two files that follow go there.

I'm sure there is a sh one liner to feed to busybox mknod as a part of the init script, so I don't need the huge list of nod statements but I don't know it.

If you use files systems other than extX on /usr and / or /var, which the initrd checks and mounts, you need your filesystem tools listed here. Feel free to add other things you find useful when booting fails too.

Now to feed the file to usr/gen_init_cpio. Make sure is mounted.

Running usr/gen_init_cpio:

This what the kernel build system does if you choose to build the initramfs into the kernel binary but if you don't get it right first time, you can fix your kernel without rebuilding your initramfs and vice versa.

Populating /etc/fstab
Run blkid to discover the UUIDs of all your block devices. Paste the output into /etc/fstab, so its easy to refer to in the future. Delete lines that provide the UUIDS of block devices that are not filesystesms, e.g. lvm members, md devices. Comment out the other entries, so they can stay in the file.

Populating as normal, but use UUIDs:

As there is no auto mounting, do not forget entries for optical drives.

Floppy disk users need to remember /dev/fdX and friends. Users who have not formatted a floppy with a static are in for a treat.

Configuring the system
Follow Configuring the system in the handbook.

Installing necessary system tools
Follow Installing system tools in the handbook.

Setting up the boot loader
The Grand Unified Bootloader (GRUB) has already been installed to.

Follow Configuring the bootloader to install GRUB to the Master Boot Record (MBR) or to configure properly when using a GUID Partition Table (GPT). Associated GRUB configuration file(s) will also be needed.

xorg.conf
You need a whole, just like in the good/bad old days. evdev depends on udev auto detecting devices, so that is out.

GNOME or KDE Plasma
Gnome is not an option. I suspect that KDE Plasma is out too.

Xfce 4
Xfce almost works out of the box. You need a patched mesa ebuild to build without udev.

The gentoo-static overlay
hwids works but the ebuild needs to be patched to remove the dependency on udev

mesa

I need to get round to publishing the overlay.

External resources

 * http://swift.siphos.be/linux_sea/ - An ebook that offers a gentle yet technical (from end-user perspective) introduction to the Linux operating system, using Gentoo Linux as the example Linux distribution. (Link included with permission from the author.)