Gentoo Quick Guide Install Guide - headless / EFI stub

Thanks to my friend Scott Robbins for his inspiration, first with his A Quick Guide to Installing ArchLinux, then his A Relatively Quick Guide to Installing Gentoo.

The Gentoo Handbook provides detailed documentation that guides you through the installation process. For me, after having installed Gentoo numerous times, there is considerably more than needed at this point. The purpose of this "Gentoo Quick Install Guide" is to cut out all the extra detail and just provide what is required to install a working headless Gentoo system for amd64 using systemd as the init system. It does have some explanation so that you can copy and paste, changing what might be specific for you, such as disk partitioning and networking. After you finish this install and reboot, it should be fairly easy to install your desktop system of choice. Mine has been Fluxbox for over 20 years. Contact me if you want any pointers.

If you've never installed Gentoo before, this guide is not for you. My recommendation would be to use the Gentoo Handbook and select the Quick links that matches your target machines.

Let the installation begin!

To install according to this guide for a UEFI board using systemd as the init, you'll need to boot your target machine with a suitable media which includes systemd, UEFI support (EFI vars), and sshd. For this guide I chose to use the install-<arch>-minimal-<release timestamp>.iso from the Gentoo mirror in my country. Mine for today is the install-amd64-minimal-20251231T090058Z.iso.

Write the downloaded ISO file to bootable media and boot your target computer with it. Once you are at the livecd ~ # login prompt, read in the message of the day two items that will allow you to ssh into the computer and work from a terminal on another computer:

To start an ssh server on this system, type "/etc/init.d/sshd start". If you need to log in remotely as root, type "passwd root" to reset root's password to a known value.

Suggested: remote into the target computer using ssh and create at least one tmux session

livecd ~ # /etc/init.d/sshd start
livecd ~ # passwd

Ensure a network connection can reach the Internet

Since the Live CD starts dhcpcd, there might already be an IP address and routing configured for this computer. Issue ip a then ping -c2 gentoo.org to check. If your network connection is already working, just note the local IP to ssh into it from your source machine. If not, and you know your network, you can set a manual IP address and route, I have a HOW-TO for manually setting up a network connection . Or, if you need more help with this, the Gentoo Handbook explains several methods.

There is one more suggestion for remote installation from another computer, and that is to run tmux so that you can leave the remote session if needed without losing your work and having to start over.

livecd ~ # tmux

Then from your source machine run tmux ls so that you can see your session on the other computer.

livecd ~ # tmux ls
0: 1 windows (created Wed Nov 26 04:28:31 2025) (attached)

Now you can ssh into the machine and run tmux a -t 0 to attach to that running tmux session, and run ctrl+b d if you want to detach so that you can exit the target computer for whatever reason.

Preparing the disks

To see what disk(s) are available run lsblk with these options:

livecd ~ # lsblk -o +fstype,model

NAME       MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS         FSVER MODEL
loop0        7:0    0 669.6M  1 loop /run/rootfsbase
sda          8:0    0 232.9G  0 disk                      Samsung SSD 860 EVO 250GB
sdb          8:16   1  28.6G  0 disk                              Ultra USB 3.0
├─sdb1       8:17   1  28.6G  0 part                     exfat
│ └─ventoy 253:0    0 761.9M  0 dm   /run/initramfs/live iso9660
└─sdb2       8:18   1    32M  0 part                     vfat

My target drive will be the 256GB Samsung 860 SSD. My choice for partitioning is gdisk, and this drive will have a 2GB partition for an EFI System Partition (ESP), a 12GB partition for swap, 70GB for /, and the remainder for /home. NB: Gentoo's swap recommendation.

livecd ~ # gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-488397134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-488397134, default = 488396799) or {+-}size{KMGTP}: +2G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI system partition'

Command (? for help): n
Partition number (2-128, default 2):
First sector (34-488397134, default = 4196352) or {+-}size{KMGTP}:
Last sector (4196352-488397134, default = 488396799) or {+-}size{KMGTP}: +12G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number (3-128, default 3):
First sector (34-488397134, default = 29362176) or {+-}size{KMGTP}:
Last sector (29362176-488397134, default = 488396799) or {+-}size{KMGTP}: +70G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (4-128, default 4):
First sector (34-488397134, default = 176162816) or {+-}size{KMGTP}:
Last sector (176162816-488397134, default = 488396799) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
livecd ~ #

Run that lsblk command again, this time with your device specified:

livecd ~ # lsblk -o +fstype,model /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS FSTYPE MODEL
sda      8:0    0 232.9G  0 disk                    Samsung SSD 860 EVO 250GB
├─sda1   8:1    0     2G  0 part
├─sda2   8:2    0    12G  0 part
├─sda3   8:3    0    70G  0 part
└─sda4   8:4    0 148.9G  0 part

Creating file systems

The EFI system partition (sda1 for me) must be formatted as FAT32. Choose what you want for / and/or /home. I also give my partitions labels (names) that match their mount points to more easily distinguish them in lsblk output:

livecd ~ # mkswap -L swap /dev/sda2
livecd ~ # mkfs.vfat -n EFI -F 32 /dev/sda1
livecd ~ # mkfs.xfs -L root /dev/sda3
livecd ~ # mkfs.xfs -L home /dev/sda4
livecd ~ # lsblk -o +fstype,model /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS FSTYPE MODEL
sda      8:0    0 232.9G  0 disk                    Samsung SSD 860
├─sda1   8:1    0     2G  0 part             vfat
├─sda2   8:2    0    12G  0 part             swap
├─sda3   8:3    0    70G  0 part             xfs
└─sda4   8:4    0 148.9G  0 part             xfs

Activate the swap partition, mount your / partition, make the directory for the ESP partition under /root, and mount /home if you have it as a separate partition:

livecd ~ # swapon /dev/sda2
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/efi
livecd ~ # mount /dev/sda1 /mnt/gentoo/efi
livecd ~ # mkdir /mnt/gentoo/home
livecd ~ # mount /dev/sda4 /mnt/gentoo/home

Downloading the stage file

Before downloading the stage file, the current directory should be set to the location of the mount used for the install:

livecd ~ # cd /mnt/gentoo

Setting the date and time

The current date and time can be verified with date:

livecd /mnt/gentoo # date
livecd /mnt/gentoo # Tue Mar 24 09:40:55 UTC 2026

Using Network_Time_Protocol to correct clock skew is typically easier and more reliable than manually setting the system clock. chronyd, part of net-misc/chrony, can be used to update the system clock to UTC with:

livecd /mnt/gentoo # chronyd -q
livecd /mnt/gentoo # Tue Mar 24 09:40:55 UTC 2026

Installing the Gentoo installation files

A stage file, also known as a stage tarball, is an archive containing a minimal Gentoo environment, typically serving as a seed for a Gentoo install, and can be obtained from the Gentoo mirror closest to your location. Get the one that suits the type of install and init system you choose; for me today that file is a systemd desktop file. You can download the file with wget, or use links per the Gentoo Handbook's suggestion. My choice is wget with --show-progress:

livecd /mnt/gentoo # wget --show-progress https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/stage3-amd64-desktop-systemd-20260322T154603Z.tar.xz

Make sure to also get the associated checksum file (stage3-amd64-desktop-systemd-20260322T154603Z.tar.xz.sha256 is mine), verify the tarball is not corrupt, and install the files to disk.

livecd /mnt/gentoo # sha256sum --check stage3-amd64-<release>-<init>.tar.xz.sha256 <arch>
stage3-amd64-desktop-systemd-20260322T154603Z.tar.xz: OK
sha256sum: WARNING: 12 lines are improperly formatted
livecd /mnt/gentoo # tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo/

Installing the Gentoo base system

We'll need a resolv.conf file for DNS resolution:

livecd /mnt/gentoo # cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Then we'll use this unique genfstab bash script (from Arch Linux's pacman) to create /etc/fstab for us:

livecd /mnt/gentoo # genfstab -U /mnt/gentoo/ >> /mnt/gentoo/etc/fstab

Check the fstab file by running egrep -v "(^#|^ *$)" /mnt/gentoo/etc/fstab to make sure the uncommented lines are correct for your system.

Now it's time to chroot (change root) into the new Gentoo system by running arch-chroot, which is another bash script on the Gentoo live media that comes from the Arch Linux camp, then set your prompt to reflect we have now moved into the chroot.

livecd /mnt/gentoo # arch-chroot /mnt/gentoo
livecd / # export PS1="(chroot) ${PS1}"
(chroot) livecd / # 

Next install Gentoo's ebuild repo by running emerge-webrsync, then make sure you have the correct profile selected with eselect profile show, and if it's not the one you expected, then show them all with eselect profile list|less and change it to the one you desire with eselect profile set x.

NB: Gentoo has 2 init systems - OpenRC and systemd. The profiles with systemd in the name are for it, the ones without systemd are for OpenRC. For this guide we are only going to install for systemd. This will fetch the latest snapshot (which is released on a daily basis) from one of Gentoo's mirrors and install it onto the system. It is also a good practice to read the news when you see that output after syncing.

(chroot) livecd / # emerge-webrsync
(chroot) livecd / # eselect news list
(chroot) livecd / # eselect news read
(chroot) livecd / # eselect profile show
default/linux/amd64/23.0/desktop/systemd

There are some crucial packages that have been updated since the date of the most recent stage3-amd64-desktop-systemd tarball, so let's go ahead and update all our software now:

(chroot) livecd / # emerge --sync

Since vim has become the only editor for me, we'll install a binary package of it now so that as we configure software we use vim, and we don't have to use nano, which is the $EDITOR of the Gentoo stage3. To get binary packages we first need to download their keys for file verification with getuto for Portage to set up the necessary keyring for verification:

(chroot) livecd / # getuto
(chroot) livecd / # emerge --getbinpkg -atv app-editors/vim

Now set vim as your $EDITOR with these commands:

(chroot) livecd / # eselect editor set vim
(chroot) livecd / # . /etc/profile && export PS1="(chroot) ${PS1}"
(chroot) livecd / # eselect editor show
vim

That should show the $EDITOR that you set.

Set your timezone and check your date ( America/Chicago is mine, choose the one appropriate to you, and tab completion works here):

(chroot) livecd / # date ; ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime ; date

Configure locales

Setup the language(s) you will use on your computer with locales. There 500 or more locales supported. Choose your language with the character format UTF-8. Then update your system.

(chroot) livecd # vim /etc/locale.gen
(chroot) livecd # locale-gen
[1/2] Compiling locale: C.UTF-8
[2/2] Compiling locale: en_US.UTF-8
(chroot) livecd # eselect locale list
(chroot) livecd # eselect locale set 5
Setting LANG to en_US.utf8 ...
(chroot) livecd / # env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

USE flags are keywords that embody support and dependency information for a certain concept. They are a core feature of Gentoo, and a good understanding of how to deal with them is needed for administering a Gentoo system.

NB: To install the software in the manner of this guide requires updating /etc/portage/package.use. By default Gentoo now creates a directory for /etc/portage/package.use/, /etc/portage/package.accept_keywords/, and /etc/portage/package.mask/ and recommends creating a file under those directories for each package where you want to make changes from that package's defaults. IMO that is convoluted and obfuscates something that was formerly simple. Therefore, I remove those directories and use files instead, as was the original method used by Gentoo. If you have an AMD system use */* VIDEO_CARDS: amdgpu radeonsi rather than */* VIDEO_CARDS: intel. There are other options, so you could just omit the VIDEO_CARDS line and install them all now, removing what you don't need later. The USE flags in make.conf are global flags that will apply to every package. The ACCEPT_LICENSE variable is needed for some software. The GRUB_PLATFORM is for using GRUB as the boot manager; not needed for EFI stub or systemd-boot, but doesn't hurt to have it in the file.

(chroot) livecd # rm -rf /etc/portage/package.accept_keywords/
(chroot) livecd # rm -rf /etc/portage/package.mask/
(chroot) livecd # rm -rf /etc/portage/package.use/
(chroot) livecd # vim /etc/portage/package.use
*/* VIDEO_CARDS: intel
*/* INPUT_DEVICES: libinput synaptics
sys-kernel/gentoo-kernel-bin initramfs -debug -generic-uki modules-compress -test -verify-sig
sys-apps/util-linux caps
sys-apps/systemd boot ukify
sys-kernel/installkernel -dracut systemd efistub -grub -refind -systemd-boot ugrd uki ukify
sys-kernel/linux-firmware initramfs redistributable -bindist -compress-xz compress-zstd -deduplicate -dist-kernel savedconfig -unknown-license

Gentoo now has a binary package host. We can edit make.conf and add a host at this point. For amd64 (x86-64) and arm64 (aarch64), the Gentoo binhost includes many packages used on desktop systems.

(chroot) livecd # vim /etc/portage/make.conf
FEATURES="${FEATURES} getbinpkg"
FEATURES="${FEATURES} binpkg-request-signature"
USE="X -wayland -device-mapper"
ACCEPT_LICENSE="* -@EULA"
GRUB_PLATFORMS="efi-64"

Installing EFI stub

The EFI stub kernel is explained in the Gentoo Handbook's bootloader section.

For my Dell XPS 15 9530 this was fairly simple. The sys-kernel/installkernel package needs to have the efistub, systemd, uki, ukify, and urgd USE flags to generate the initramfs. For the distribution kernels we also need to create a kernel cmdline and enable kernel-bootcfg-boot-successful.service.

Install the firmware, microcode, and efibootmgr (to add an entry for an EFI stub kernel into the UEFI firmware). Then write the kernel cmdline.

(chroot) livecd / # emerge -atv sys-kernel/linux-firmware sys-firmware/intel-microcode sys-boot/efibootmgr
(chroot) livecd / # echo "net.ifnames=0 panic=30 loglevel=3 modprobe.blacklist=pcspkr" > /etc/kernel/cmdline

The next step is to emerge the kernel.

(chroot) livecd / # emerge -atv sys-kernel/gentoo-kernel-bin

The kernel build.log will complain about kernel-bootcfg-boot-successful not being enabled. Enable it then run the command it suggests to build the initramfs.

(chroot) livecd / # systemctl enable --now kernel-bootcfg-boot-successful.service
(chroot) livecd / # emerge --config '=sys-kernel/gentoo-kernel-bin-6.12.58:6.12.58'

Then check that you have the UKI executable image in /efi and check that it is an EFI executable image.

(chroot) livecd # find /efi -name *.efi
/efi/EFI/Linux/gentoo-6.12.58-gentoo-dist.efi
(chroot) livecd # file /efi/EFI/Linux/gentoo-6.12.58-gentoo-dist.efi
/efi/EFI/Linux/gentoo-6.12.58-gentoo-dist.efi: PE32+ executable for EFI (application), x86-64 (stripped to external PDB), 11 sections

Give your computer a name:

(chroot) livecd / # echo gentooligan > /etc/hostname

Configuring the network

I setup Gentoo to have the traditional interface naming scheme (eth0, eth1, wlan0, ...) rather than what udev, beginning with v197, calls "predictable, stable network interface names". Those always seemed the opposite to me, so I added net.ifnames=0 to the kernel command line via /etc/kernel/cmdline in that earlier step. This way I will always have eth0, eth1, and wlan0 as my interfaces.

If you want a static IP address, replace my network settings with yours in a file named /etc/systemd/network/10-wired.network:

(chroot) livecd / # vim /etc/systemd/network/10-wired.network
[Match]
Name=eth0
[Network]
Address=192.168.100.28/24
Gateway=192.168.100.1
DNS=192.168.100.1

If you prefer DHCP, the use the below for /etc/systemd/network/10-wired.network:

(chroot) livecd / # vim /etc/systemd/network/10-wired.network
[Match]
Name=eth0
[Network]
DHCP=yes

After writing the /etc/systemd/network/10-wired.network file run the following command to enable networking with systemd on the new system:

(chroot) livecd / # systemctl enable systemd-networkd.service
Created symlink '/etc/systemd/system/dbus-org.freedesktop.network1.service' → '/usr/lib/systemd/system/systemd-networkd.service'.
Created symlink '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service' → '/usr/lib/systemd/system/systemd-networkd.service'.
Created symlink '/etc/systemd/system/sockets.target.wants/systemd-networkd.socket' → '/usr/lib/systemd/system/systemd-networkd.socket'.
Created symlink '/etc/systemd/system/sysinit.target.wants/systemd-network-generator.service' → '/usr/lib/systemd/system/systemd-network-generator.service'.
Created symlink '/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service' → '/usr/lib/systemd/system/systemd-networkd-wait-online.service'.

System information

Set the root password using the passwd command.

(chroot) livecd / # passwd
passwd: password updated successfully

Create a normal user account.

(chroot) livecd / # useradd -m -G users,wheel,audio mingdao
(chroot) livecd / # passwd mingdao
passwd: password updated successfully

Get systemd ready for first boot:

(chroot) livecd / # systemd-machine-id-setup
(chroot) livecd / # systemctl enable gpm.service
(chroot) livecd / # systemctl enable sshd.service
(chroot) livecd / # systemctl enable systemd-timesyncd.service

Leave the chroot and reboot into your shiny, new, Gentoo system!

(chroot) livecd / # exit
livecd ~ # umount -R /mnt/gentoo
livecd ~ # swapoff /dev/sda2
livecd ~ # reboot