User:NeddySeagoon/YeOldeGentoo 2021 Edition

From Gentoo Wiki
Jump to:navigation Jump to:search

Ye Olde Gentoo 2021 Edition

Round about 2013, I wrote a page on installing Gentoo using a static /dev. I was going to update the original page but a lot has changed so its probably easier to start again. The old page is still valid if you want to install on hardware from 2013.

What You Get

A modern Gentoo base system but without all the bells and whistles added in recent years. Ye Olde Gentoo 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 /usr just works but its not essential. Root in Logical Volume Manager (LVM) on NVMe without an initrd. It works but its risky due to kernel dynamic assignment of some device major numbers.

Overview

The install will use root in LVM on NVMe, with separate /usr and /var. /home, $DISTDIR and $PKGDIR will be in LVM on rotating rust RAID as Conventional Magnetic Recording (CMR) drives are quite good at sequential access of large files.

If you choose to use raid take care not to select Shingled Magnetic Recording (SMR) drives as they are not suited to use in raid sets.

We will use syslinux as a boot loader rather than grub2.

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 package.mask.
  • Follow the handbook to install cron, a logger and a bootloader of choice.
  • Install a kernel.
  • Configure the syslinux bootloader.
  • Review and edit configuration settings.
  • Reboot to test.

Getting Started

Partitioning and Filesystem Creation

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

I will be using Logical Volumes on top of Conventional Magnetic Recording (CMR) raid for /home, /var/cache/distfiles and /var/cache/binpkgs, mostly because my /home won't fit on NVMe. Everything else is LVM on NVMe.

We have

df -hT
Filesystem                     Type   Size  Used Avail Use% Mounted on
/dev/root                      ext4   2.0G 1014M  815M  56% /
tmpfs                          tmpfs   13G  196K   13G   1% /run
shm                            tmpfs   63G  996K   63G   1% /dev/shm
cgroup_root                    tmpfs   10M     0   10M   0% /sys/fs/cgroup
tmpfs                          tmpfs   63G   84K   63G   1% /tmp
/dev/mapper/nvmestatic-usr     ext4   295G   19G  261G   7% /usr
/dev/mapper/nvmestatic-var     ext4   5.9G  1.5G  4.2G  26% /var
/dev/mapper/storage-home       ext4   2.0T  1.4T  567G  71% /home
/dev/mapper/nvmestatic-opt     ext4   2.9G  358M  2.4G  13% /opt
/dev/mapper/nvmestatic-local   ext4   926M   40K  859M   1% /usr/local
/dev/mapper/storage-distfiles  ext4   492G  278G  189G  60% /var/cache/distfiles
/dev/mapper/storage-packages   ext4   118G   24K  112G   1% /var/cache/packages
/dev/mapper/nvmestatic-portage ext4   2.9G  668M  2.0G  25% /var/db/repos/gentoo
/dev/shm                       tmpfs   63G     0   63G   0% /var/tmp/portage
/dev/nvme0n1p2                 ext4   117M  104K  109M   1% /boot
/dev/nvme0n1p1                 vfat    61M   27M   34M  44% /boot/EFI

Fetch and install the stage3 as per the handbook.

/proc, /sys and /dev

Follow the handbook for /proc and /sys. /dev is quite different to the handbook. Its going to be static.

Look in /mnt/gentoo/dev. It contains the static /dev delivered by the stage3. Notice all the old floppy device nodes, the IDE devices nodes and lots of things that can't be connected to modern hardware. Remove it all.

root #rm -rf /mnt/gentoo/dev

Replace it with just the nodes we need right now.

root #cp -a /dev/* /mnt/gentoo/dev

More nodes can be made as required with mknod, or with MAKEDEV (yes its uppercase).

Other /dev Entries

The kernel will show all the devices it knows about in /sys/dev/... That's cheating really as in the good? olde days, /sys did not exist.

Its not an error to have things listed there that are not in /dev, nor vice versa. It's the users task to ensure the major:minor device numbers in /dev match the kernels expectations. DEVTMPFS won't do it for you. Its the users task to set the permissions too. udev won't do it.

Getting Into the chroot

This is conventional handbook. Including fetching and updating the portage snapshot. Do not rebuild or install anything yet.

Note
We have a stage3 tarball with a static /dev. The stage3 still has a lot of undesirable packages installed

Configuring For a Static /dev

I should really make a /no-multilib/static-dev profile and add it to my overlay

/etc/portage/make.conf

For Xorg.

#INPUT_DEVICES="mouse keyboard"  # no longer needed unless you drop udev, and dropped from portage too :(
# Must turn other INPUT_DEVICES off or they want udev .." 
INPUT_DEVICES=""
VIDEO_CARDS="fbdev vesa nv nouveau amdgpu radeonsi"


x11-drivers/xf86-input-mouse and x11-drivers/xf86-input-keyboard have both been removed from portage. The git HEAD for xf86-input-keyboard has had Linux support removed, so don't use HEAD.

x11-base/xorg-server needs to be built with USE=suid in the time honoured way. Do NOT put USE=suid in make.conf. Its an option to set per package.

x11-drivers/xf86-video-nouveau as shipped in ::gentoo has a hard dependency on udev in the ebuild. That can be hidden behind a udev USE flag. That allows it to build, but I no longer have any nVidia hardware, so its not run time tested.

/etc/portage/profile/use.mask

# No automatic hand holding
consolekit
policykit
pulseaudio

# Can't use systemd with a static dev as it forces udev
systemd

# Can't use udev or clones with a static dev.
udev
elogind

# More unsavoury optional black magic
udisks
upower
upnp
zeroconf

Add more to suit your taste.

/etc/portage/package.mask/

# an over my dead body hard mask
# dump GNOME and anything else that has this as a hard dependency at any version
sys-apps/systemd

# go back to a static /dev
sys-fs/eudev
sys-fs/udev

sys-auth/polkit
sys-auth/consolekit
media-sound/pulseaudio
net-dns/avahi

Add more to suit your taste.

/etc/portage/sets/system-groups

Create the file /etc/portage/sets/system-groups with the following content.

# groups needed for a static /dev
# to operate properly

acct-group/render
acct-group/audio
acct-group/disk
acct-group/video
acct-group/input
acct-group/cdrom
acct-group/dialout
acct-group/tty

These are the acct-group files that will be --depcleaned if they are not kept. Everyone needs some of them. Add @system-groups to the world file.