Gentoo Quick Install Guide - headless / systemd-boot

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-20260111T160052Z.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
livecd ~ # tmux ls

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 Sun Oct 12 09:53:24 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}: +1G
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 = 2099200) or {+-}size{KMGTP}:
Last sector (2099200-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 = 27265024) or {+-}size{KMGTP}:
Last sector (27265024-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 = 174065664) or {+-}size{KMGTP}:
Last sector (174065664-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     1G  0 part
├─sda2   8:2    0    12G  0 part
├─sda3   8:3    0    70G  0 part
└─sda4   8:4    0 149.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     1G  0 part             vfat
├─sda2   8:2    0    12G  0 part             swap
├─sda3   8:3    0    70G  0 part             xfs
└─sda4   8:4    0 149.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

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 ~ # wget --show-progress https://gentoo.osuosl.org/releases/amd64/autobuilds/20260111T160052Z/stage3-amd64-desktop-systemd-20260111T160052Z.tar.xz

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

livecd ~ # sha256sum --check stage3-amd64-<release>-<init>.tar.xz.sha256 <arch>
stage3-amd64-desktop-systemd-20260111T160052Z.tar.xz: OK
sha256sum: WARNING: 12 lines are improperly formatted
livecd ~ # 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 ~ # 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 ~ # 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 ~ # 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: In order to install the software in the manner of this guide, there are two files which need to be updated: /etc/portage/make.conf and /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 you would create a file under those directories for each package where you wanted 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. 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.

For systemd-boot as the bootloader, systemd's kernel-install must be used. This requires enabling the systemd and systemd-boot USE flags on sys-kernel/installkernel, and then install the relevant packages: sys-apps/systemd boot and sys-kernel/installkernel systemd-boot.

(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 -debug -generic-uki initramfs -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 -bindist -compress-xz compress-zstd -deduplicate -dist-kernel initramfs redistributable -savedconfig

The sys-kernel/linux-firmware (and other firmware packages) requires a license, so you must add an ACCEPT_LICENSE choice to /etc/portage/make.conf. If you don't need or want any firmware, you can skip this and just install gentoo-kernel-bin by itself, which does not require a license. This is why we add the EULA license. Add the following lines to /etc/portage/make.conf:

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

Updating the system's @world set is optional but might be helpful since we changed package.use and make.conf:

(chroot) livecd / # emerge -aDNtuUv @world

Install a kernel, firmware, and boot manager

We will install a systemd-boot kernel.

I am installing in the order published in the Gentoo Handbook. First we'll emerge sys-kernel/linux-firmware, then sys-firmware/intel-microcode, then sys-apps/systemd and sys-kernel/installkernel, then write our kernel cmdline, and last emerge sys-kernel/gentoo-kernel-bin. Check postinstall messages in /var/log/portage/elog/summary.log, and use eselect kernel to see that your link is setup.

(chroot) livecd / # emerge -atv sys-kernel/linux-firmware
(chroot) livecd / # emerge -atv sys-firmware/intel-microcode
(chroot) livecd / # emerge -atv sys-apps/systemd sys-kernel/installkernel
(chroot) livecd / # echo "net.ifnames=0 panic=30 loglevel=3 modprobe.blacklist=pcspkr" > /etc/kernel/cmdline
(chroot) livecd / # emerge -atv sys-kernel/gentoo-kernel-bin
(chroot) livecd / # less /var/log/portage/elog/summary.log
(chroot) livecd / # eselect kernel show
/usr/src/linux-6.12.54-gentoo-dist

After installing the kernel, even without getting a proper initramfs, what is in the /efi partition?

(chroot) livecd # tree /efi/ -L 3
/efi/
└── EFI
    └── Linux
        └── gentoo-6.12.54-gentoo-dist.efi

3 directories, 1 file

Now rebuild the initramfs:

(chroot) livecd / # systemctl enable systemd-boot-update.service
(chroot) livecd / # emerge --config sys-kernel/gentoo-kernel-bin

Now, install the systemd-boot loader to the EFI System Partition:

(chroot) livecd # bootctl install
Created "/efi/EFI/systemd".
Created "/efi/EFI/BOOT".
Created "/efi/loader".
Created "/efi/loader/keys".
Created "/efi/loader/entries".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/usr/lib/systemd/boot/efi/systemd-bootx64.efi" to "/efi/EFI/BOOT/BOOTX64.EFI".
⚠️ Mount point '/efi' which backs the random seed file is world accessible, which is a security hole! ⚠️
⚠️ Random seed file '/efi/loader/.#bootctlrandom-seed7017eee4002cb120' is world accessible, which is a security hole! ⚠️
Random seed file /efi/loader/random-seed successfully written (32 bytes).

What does our EFI partition look like now?

(chroot) livecd # tree /efi/ -L 3
/efi/
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Linux
│   │   └── gentoo-6.12.54-gentoo-dist.efi
│   └── systemd
│       └── systemd-bootx64.efi
└── loader
    ├── entries
    ├── entries.srel
    ├── keys
    ├── loader.conf
    └── random-seed

8 directories, 6 files

Networking information

Give your computer a name:

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

Configuring the network

I setup Gentoo to have network interface names of my choosing, so I added net.ifnames=0 to the kernel command line via echo "net.ifnames=0 panic=30 loglevel=3 modprobe.blacklist=pcspkr" > /etc/kernel/cmdline in a earlier step. Run the command ip link to find the name of your interface(s).

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