Gentoo Linux amd64 Handbook_ Installing Gentoo - Gentoo wiki
Gentoo Linux amd64 Handbook_ Installing Gentoo - Gentoo wiki
org/wiki/Handbook:AMD64/Full/Installation
(/) Wiki
Contents
▪ 1 Introduction
▪ 1.1 Welcome
▪ 1.1.1 Openness
▪ 1.1.2 Choice
▪ 1.1.3 Power
▪ 1.2 How the installation is structured
▪ 1.2.1 Deciding which steps to take
▪ 1.2.2 Suggested steps
▪ 1.2.3 Optional steps
▪ 1.2.4 Deprecated steps
▪ 1.2.5 Defaults and alternatives
▪ 1.3 Installation options for Gentoo
▪ 1.4 Troubles
▪ 2 Hardware requirements
▪ 3 Gentoo Linux installation media
▪ 3.1 Minimal installation CD
▪ 3.2 The Gentoo LiveGUI
▪ 3.3 What are stage files?
▪ 4 Downloading
▪ 4.1 Obtain the media
▪ 4.1.1 Navigating Gentoo mirrors
▪ 4.2 Verifying the downloaded files
▪ 4.2.1 Microsoft Windows-based verification
▪ 4.2.2 Linux based verification
▪ 5 Writing the boot media
▪ 5.1 Writing a bootable USB
▪ 5.1.1 Writing with Linux
▪ 5.1.1.1 Determining the USB device path
▪ 5.1.1.2 Writing with dd
▪ 5.2 Burning a disk
▪ 5.2.1 Burning with Microsoft Windows 7 and above
▪ 5.2.2 Burning with Linux
▪ 6 Booting
▪ 6.1 Booting the installation media
▪ 6.1.1 Kernel choices
▪ 6.1.2 Hardware options
▪ 6.1.3 Logical volume/device management
▪ 6.1.4 Other options
▪ 6.2 Extra hardware configuration
▪ 6.3 Optional: User accounts
▪ 6.4 Optional: Viewing documentation while installing
▪ 6.4.1 TTYs
▪ 6.4.2 GNU Screen
▪ 6.5 Optional: Starting the SSH daemon
▪ 7 Automatic network configuration
▪ 7.1 Using DHCP
▪ 7.2 Testing the network
▪ 8 Obtaining interface info
1 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
2 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
3 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
4 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
▪ 46.1 Emerge
▪ 46.2 Install
▪ 46.2.1 DOS/Legacy BIOS systems
▪ 46.2.2 UEFI systems
▪ 46.2.2.1 Optional: Secure Boot
▪ 46.2.2.2 Debugging GRUB
▪ 46.3 Configure
▪ 47 Alternative 1: systemd-boot
▪ 47.1 Emerge
▪ 47.2 Installation
▪ 47.3 Optional: Secure Boot
▪ 48 Alternative 2: EFI Stub
▪ 48.1 Unified Kernel Image
▪ 49 Other Alternatives
▪ 50 Rebooting the system
▪ 51 User administration
▪ 51.1 Adding a user for daily use
▪ 51.2 Temporarily elevating privileges
▪ 51.3 Disabling root login
▪ 52 Disk cleanup
▪ 52.1 Removing installation artifacts
▪ 53 Where to go from here
▪ 53.1 Additional documentation
▪ 53.2 Gentoo online
▪ 53.2.1 Forums and IRC
▪ 53.2.2 Mailing lists
▪ 53.2.3 Bugs
▪ 53.2.4 Development guide
▪ 54 Closing thoughts
Introduction
Welcome
Welcome to Gentoo! Gentoo is a free operating system based on Linux that can be automatically optimized and customized
for just about any application or need. It is built on an ecosystem of free software and does not hide what is running beneath
the hood from its users.
Openness
Gentoo's premier tools are built from simple programming languages. Portage (/wiki/Portage), Gentoo's package
maintenance system, is written in Python (https://gitweb.gentoo.org/proj/portage.git/). Ebuilds, which provide package
definitions for Portage are written in bash (https://gitweb.gentoo.org/repo/gentoo.git). Our users are encouraged to review,
modify, and enhance the source code for all parts of Gentoo.
By default, packages are only patched when necessary to fix bugs or provide interoperability within Gentoo. They are installed
to the system by compiling source code provided by upstream projects into binary format (although support for precompiled
binary packages is included too). Configuring Gentoo happens through text files.
For the above reasons and others: openness is built-in as a design principle.
Choice
Choice is another Gentoo design principle.
When installing Gentoo, choice is made clear throughout the Handbook. System administrators can choose two fully
supported init systems (Gentoo's own OpenRC (/wiki/OpenRC) and Freedesktop.org's systemd (/wiki/Systemd)), partition
structure for storage disk(s), what file systems to use on the disk(s), a target system profile (/wiki/Profile), remove or add
features on a global (system-wide) or package specific level via USE flags, bootloader, network management utility, and much,
much more.
As a development philosophy, Gentoo's authors (https://www.gentoo.org/inside-gentoo/developers/) try to avoid forcing
users onto a specific system profile or desktop environment. If something is offered in the GNU/Linux ecosystem, it's likely
available in Gentoo. If not, then we'd love to see it so. For new packages, it is recommended to first submit a package to GURU
(/wiki/GURU). Once it has matured and a Gentoo developer has volunteered to sponsor the new package, it can then be
added to the official Gentoo package repository.
5 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Power
Being a source-based operating system allows Gentoo to be ported onto new computer instruction set architectures (https://
en.wikipedia.org/wiki/instruction_set_architecture) and also allows all installed packages to be tuned. This strength surfaces
another Gentoo design principle: power.
A system administrator who has successfully installed and customized Gentoo has compiled a tailored operating system from
source code. The entire operating system can be tuned at a binary level via the mechanisms included in Portage's make.conf
(/wiki//etc/portage/make.conf) file. If so desired, adjustments can be made on a per-package basis, or a package group
basis. In fact, entire sets of functionality can be added or removed using USE flags.
It is very important that the Handbook reader understands that these design principles are what makes Gentoo unique. With
the principles of great power, many choices, and extreme openness highlighted, diligence, thought, and intentionality should
be employed while using Gentoo.
Step Result
4 The installation environment is prepared and the user is ready to chroot (/wiki/Chroot) into the new
environment.
5 Core packages, which are the same on all Gentoo installations, are installed.
Suggested steps
Prefixed with "Suggested:", some steps are not strictly required, but help in most cases, such as installing
sys-kernel/linux-firmware (https://packages.gentoo.org/packages/sys-kernel/linux-firmware) .
Optional steps
Prefixed with "Optional:", many sections in the handbook are purely optional, and can be skipped if the user is looking for a
simple, mostly vanilla install.
Examples of this include compiler flag customization, using a totally custom kernel, and disabling root login.
Tip
When following optional steps, it's important to be careful that all prerequisites were satisfied. Some optional steps
depend on other optional steps.
Deprecated steps
Gentoo has existed for a long time. Some install processes are described in the handbook because they used to be more
relevant, but are now largely deprecated. Instead of immediately removing this information, as it may still be helpful for some
users, it may be designated as Deprecated: before removal. Once removed, the history must be used to view this content.
6 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
If potential choices are mutually exclusive, "Default:" is used to designate the most supported or commonly chosen option,
while alternatives are listed with "Alternative".
Note
Alternative options are not inferior to Defaults, but Default options are typically more widely used and may have
better support.
Note
For help on the other installation approaches, including using non-Gentoo bootable media, please read our Alternative
installation guide (/wiki/Installation_alternatives).
We also provide a Gentoo installation tips and tricks (/wiki/Gentoo_installation_tips_and_tricks) document that might be
useful.
Troubles
If a problem is found in the installation (or in the installation documentation), please visit our bug tracking system (https://bug
s.gentoo.org) and check if the bug is known. If not, please create a bug report for it so we can take care of it. Do not be afraid
of the developers who are assigned to the bugs - they (generally) don't eat people.
Although this document is architecture-specific, it may contain references to other architectures as well, because large parts
of the Gentoo Handbook use text that is identical for all architectures (to avoid duplication of effort). Such references have
been kept to a minimum, to avoid confusion.
If there is some uncertainty about whether or not the problem is a user-problem (some error made despite having read the
documentation carefully) or a software-problem (some error we made despite having tested the installation/documentation
carefully) everybody is welcome to join the #gentoo (ircs://irc.libera.chat/#gentoo) (webchat (https://web.liber
a.chat/#gentoo)) channel on irc.libera.chat. Of course, everyone is welcome otherwise too as our chat channel covers the
broad Gentoo spectrum.
Speaking of which, if there are any additional questions regarding Gentoo, check out the Frequently Asked Questions (/wiki/
FAQ) article. There are also FAQs (https://forums.gentoo.org/viewforum.php?f=40) on the Gentoo Forums (https://forums.gen
too.org).
Hardware requirements
Before proceeding with the installation process, minimum hardware requirements should be met in order to successfully
install Gentoo for the amd64 system architecture.
Minimal CD LiveDVD
Memory 2 GB
The AMD64 project (/wiki/Project:AMD64) is a good place to be for more information about Gentoo's amd64 support.
7 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Minimal installation CD
The Gentoo minimal installation CD, also known as the installcd, is a small, bootable image: a self-contained Gentoo
environment. This image is maintained by Gentoo developers (/wiki/Project:RelEng) and designed to allow any user with an
Internet connection to install Gentoo. During the boot process, the hardware is detected, and appropriate drivers are
automatically loaded.
Minimal Installation CD releases are named using the format: install-<arch>-minimal-<release timestamp>.iso.
Note
The Gentoo LiveGUI USB image is built for the amd64 architecture weekly.
Tip
For now, stage files can be ignored. They will be described in greater detail later when they are needed
Note
Historically, the handbook described installation steps for stage files (/wiki/Stage_file) with versions lower than 3. These
stages contained environments unsuitable for typical installations, and are no longer covered in the handbook.
Downloading
Obtain the media
The default installation media used by Gentoo Linux are the minimal installation CDs, which provide a very small, bootable,
Gentoo Linux environment. This environment contains the necessary tools to install Gentoo. The images themselves can be
downloaded from the downloads page (https://www.gentoo.org/downloads/) (recommended) or by manually browsing to the
ISO location on one of the many available mirrors (https://www.gentoo.org/downloads/mirrors/).
1. Connect to the mirror, typically using a local one found at Gentoo source mirrors (https://www.gentoo.org/downloads/
mirrors/).
2. Navigate to the releases/ directory.
3. Select the directory for the relevant target architecture (such as amd64/).
4. Select the autobuilds/ directory.
5. For amd64 and x86 architectures select either the current-install-amd64-minimal/ or current-install-x86-
minimal/ directory (respectively). For all other architectures navigate to the current-iso/ directory.
Note
Some target architectures such as arm, mips, and s390 will not have minimal install CDs. At this time the Gentoo Release
Engineering project (/wiki/Project:RelEng) does not support building .iso files for these targets.
Inside this location, the installation media file is the file with the .iso suffix. For instance, take a look at the following listing:
8 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
In the above example, the install-amd64-minimal-20240107T170309Z.iso file is the minimal installation CD itself. But as
can be seen, other related files exist as well:
▪ A .CONTENTS.gz file which is a gz-compressed text file listing all files available on the installation media. This file can be
useful to verify if particular firmware or drivers are available on the installation media before downloading it.
▪ A .DIGESTS file which contains the hash of the ISO file itself, in various hashing formats/algorithms. This file can be
used to verify ISO file integrity.
▪ A .asc file which is a cryptographic signature of the ISO file. This can be used to verify image integrity and authenticity -
that the download is indeed provided by the Gentoo Release Engineering team (/wiki/Project:RelEng), free from
tampering.
Ignore the other files available at this location for now - those will come back when the installation has proceeded further.
Download the .iso file and, if verification of the download is wanted, download the .iso.asc file for the .iso file as well.
Tip
The .DIGESTS file is only needed if the signature in the .iso.asc file is not verified.
This is an optional step and not necessary to install Gentoo Linux. However, it is recommended as it ensures that the
downloaded file is not corrupt and has indeed been provided by the Gentoo Infrastructure team (/wiki/
Project:Infrastructure).
The .asc file provides a cryptographic signature of the ISO. By validating it, one can make sure that the installation file is
provided by the Gentoo Release Engineering team and is intact and unmodified.
Tip
When importing Gentoo keys, verify that the 16-character key ID ( BB572E0E2D182910 ) matches.
Gentoo keys can be downloaded from hkps://keys.gentoo.org using fingerprints available on the signatures page (https://
www.gentoo.org/downloads/signatures/):
9 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Alternatively you can use instead the WKD (/wiki/WKD) to download the key:
gpg: key 9E6438C817072058: public key "Gentoo Linux Release Engineering (Gentoo Linux Release Signing
Key) <[email protected]>" imported
gpg: key BB572E0E2D182910: public key "Gentoo Linux Release Engineering (Automated Weekly Release Key)
<[email protected]>" imported
gpg: Total number processed: 2
gpg: imported: 2
gpg: no ultimately trusted keys found
pub dsa1024 2004-07-20 [SC] [expires: 2025-07-01]
D99EAC7379A850BCE47DA5F29E6438C817072058
uid [ unknown] Gentoo Linux Release Engineering (Gentoo Linux Release Signing Key) <releng@g
entoo.org>
sub elg2048 2004-07-20 [E] [expires: 2025-07-01]
Or if using official Gentoo release media, import the key from /usr/share/openpgp-keys/gentoo-release.asc (provided
by
sec-keys/openpgp-keys-gentoo-release (https://packages.gentoo.org/packages/sec-keys/openpgp-keys-gentoo-release) ):
To be absolutely certain that everything is valid, verify the fingerprint shown with the fingerprint on the Gentoo signatures
page (https://www.gentoo.org/downloads/signatures/).
Note
It's generally good practice to mark an imported key as trusted, once it's certain the key is trustworthy. When trusted
10 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
keys are verified, gpg will not say unknown and warn about the signature being untrusted.
root # dmesg
[268385.319745] sd 19:0:0:0: [sdd] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)
root # lsblk
Once the device name has been determined, this can be added to the path prefix /dev/ to get the device path /dev/sdd.
Tip
Using the base device path, ie. sdd opposed to sdd1, is recommend as the Gentoo boot media contains a full GPT (/wiki/
GPT) partition scheme.
Writing with dd
Warning
Be sure to check the target (of=target) path before executing dd, as it will be overwritten.
With the device path (/dev/sdd) and boot media install-amd64-minimal-<release timestamp>.iso ready:
Note
if= specifies the input file, of= specifies the output file, which in this case, is a device.
Tip
bs=4096 is used as it speeds up transfers in most cases, status=progress displays transfers stats.
Burning a disk
See also
A more elaborate set of instructions can be found in CD/DVD/BD_writing#Image_writing (/wiki/CD/DVD/
BD_writing#Image_writing).
11 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Booting
Booting the installation media
Once the installation media is ready, it is time to boot it. Insert the media in the system, reboot, and enter the motherboard's
firmware user interface. This is usually performed by pressing a keyboard key such as DEL , F1 , F10 , or ESC during the
Power-On Self-Test (POST) process. The 'trigger' key varies depending on the system and motherboard. If it is not obvious use
an internet search engine and do some research using the motherboard's model name as the search keyword. Results should
be easy to determine. Once inside the motherboard's firmware menu, change the boot order so that the external bootable
media (CD/DVD disks or USB drives) are tried before the internal disk devices. Without this change, the system will most likely
reboot to the internal disk device, ignoring the newly attached bootable media.
Important
When installing Gentoo on a system with an UEFI firmware interface, ensure the live image has been booted in UEFI
mode. In the accidental event that DOS/legacy BIOS boot was initiated, then it will be necessary to reboot in UEFI mode
before finalizing the Gentoo Linux installation.
Ensure that the installation media is inserted or plugged into the system, and reboot. A GRUB boot prompt should be shown
with various boot entries. At this screen, Enter will begin the boot process with the default boot options. To boot the
installation media with customized boot options, such as passing additional kernel parameters or the following hardware
options, highlight a boot entry, then press the e key to edit the boot entry. Make the necessary modification(s), then press
ctrl + x or F10 to boot the modified entry.
Note
In all likelihood, the default gentoo kernel, as mentioned above, without specifying any of the optional parameters will
work just fine. For boot troubleshooting and expert options, continue on with this section. Otherwise, just press Enter
and skip ahead to Extra hardware configuration (/wiki/Handbook:AMD64/Installation/
Media#Extra_hardware_configuration).
At the boot prompt, users get the option of displaying the available kernels ( F1 ) and boot options ( F2 ). If no choice is made
within 15 seconds (either displaying information or using a kernel) then the installation media will fall back to booting from
disk. This allows installations to reboot and try out their installed environment without the need to remove the CD from the
tray (something well appreciated for remote installations).
Specifying a kernel was mentioned. On the Minimal installation media, only two predefined kernel boot entries are provided.
The default option is called gentoo. The other being the -nofb variant; this disables kernel framebuffer support.
The next section displays a short overview of the available kernels and their descriptions:
Kernel choices
gentoo
Default kernel with support for K8 CPUs (including NUMA support) and EM64T CPUs.
gentoo-nofb
Same as gentoo but without framebuffer support.
memtest86
Test the system RAM for errors.
Alongside the kernel, boot options help in tuning the boot process further.
Hardware options
acpi=on
This loads support for ACPI and also causes the acpid daemon to be started by the CD on boot. This is only needed if the
system requires ACPI to function properly. This is not required for Hyperthreading support.
acpi=off
Completely disables ACPI. This is useful on some older systems and is also a requirement for using APM. This will disable any
Hyperthreading support of your processor.
console=X
12 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
This sets up serial console access for the CD. The first option is the device, usually ttyS0, followed by any connection options,
which are comma separated. The default options are 9600,8,n,1.
dmraid=X
This allows for passing options to the device-mapper RAID subsystem. Options should be encapsulated in quotes.
doapm
This loads APM driver support. This also requires that acpi=off .
dopcmcia
This loads support for PCMCIA and Cardbus hardware and also causes the pcmcia cardmgr to be started by the CD on boot.
This is only required when booting from PCMCIA/Cardbus devices.
doscsi
This loads support for most SCSI controllers. This is also a requirement for booting most USB devices, as they use the SCSI
subsystem of the kernel.
sda=stroke
This allows the user to partition the whole hard disk even when the BIOS is unable to handle large disks. This option is only
used on machines with an older BIOS. Replace sda with the device that requires this option.
ide=nodma
This forces the disabling of DMA in the kernel and is required by some IDE chipsets and also by some CDROM drives. If the
system is having trouble reading from the IDE CDROM, try this option. This also disables the default hdparm settings from
being executed.
noapic
This disables the Advanced Programmable Interrupt Controller that is present on newer motherboards. It has been known to
cause some problems on older hardware.
nodetect
This disables all of the autodetection done by the CD, including device autodetection and DHCP probing. This is useful for
debugging a failing CD or driver.
nodhcp
This disables DHCP probing on detected network cards. This is useful on networks with only static addresses.
nodmraid
Disables support for device-mapper RAID, such as that used for on-board IDE/SATA RAID controllers.
nofirewire
This disables the loading of Firewire modules. This should only be necessary if your Firewire hardware is causing a problem
with booting the CD.
nogpm
This disables gpm console mouse support.
nohotplug
This disables the loading of the hotplug and coldplug init scripts at boot. This is useful for debugging a failing CD or driver.
nokeymap
This disables the keymap selection used to select non-US keyboard layouts.
nolapic
This disables the local APIC on Uniprocessor kernels.
nosata
This disables the loading of Serial ATA modules. This is used if the system is having problems with the SATA subsystem.
nosmp
This disables SMP, or Symmetric Multiprocessing, on SMP-enabled kernels. This is useful for debugging SMP-related issues
with certain drivers and motherboards.
nosound
This disables sound support and volume setting. This is useful for systems where sound support causes problems.
nousb
This disables the autoloading of USB modules. This is useful for debugging USB issues.
slowusb
This adds some extra pauses into the boot process for slow USB CDROMs, like in the IBM BladeCenter.
Other options
debug
Enables debugging code. This might get messy, as it displays a lot of data to the screen.
docache
This caches the entire runtime portion of the CD into RAM, which allows the user to umount /mnt/cdrom and mount another
13 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
CDROM. This option requires that there is at least twice as much available RAM as the size of the CD.
doload=X
This causes the initial ramdisk to load any module listed, as well as dependencies. Replace X with the module name. Multiple
modules can be specified by a comma-separated list.
dosshd
Starts sshd on boot, which is useful for unattended installs.
passwd=foo
Sets whatever follows the equals as the root password, which is required for dosshd since the root password is by default
scrambled.
noload=X
This causes the initial ramdisk to skip the loading of a specific module that may be causing a problem. Syntax matches that of
doload.
nonfs
Disables the starting of portmap/nfsmount on boot.
nox
This causes an X-enabled LiveCD to not automatically start X, but rather, to drop to the command line instead.
scandelay
This causes the CD to pause for 10 seconds during certain portions the boot process to allow for devices that are slow to
initialize to be ready for use.
scandelay=X
This allows the user to specify a given delay, in seconds, to be added to certain portions of the boot process to allow for
devices that are slow to initialize to be ready for use. Replace X with the number of seconds to pause.
Note
The bootable media will check for no* options before do* options, so that options can be overridden in the exact order
specified.
Now boot the media, select a kernel (if the default gentoo kernel does not suffice) and boot options. As an example, we boot
the gentoo kernel, with dopcmcia as a kernel parameter:
root # passwd
To create a user account, first enter their credentials, followed by the account's password. The useradd and passwd
commands are used for these tasks.
In the next example, a user called john is created:
14 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
To switch from the (current) root user to the newly created user account, use the su command:
root # su - john
Tip
When booted to the Gentoo minimal or Gentoo admin environments, seven TTYs will be available. They can be switched
by pressing Alt then a function key between F1 - F7 . It can be useful to switch to a new terminal when waiting for job
to complete, to open documentation, etc.
GNU Screen
The Screen (/wiki/Screen) utility is installed by default on official Gentoo installation media. It may be more efficient for the
seasoned Linux enthusiast to use screen to view installation instructions via split panes rather than the multiple TTY method
mentioned above.
Note
If users log on to the system, they will see a message that the host key for this system needs to be confirmed (through
what is called a fingerprint). This behavior is typical and can be expected for initial connections to an SSH server.
However, later when the system is set up and someone logs on to the newly created system, the SSH client will warn that
the host key has been changed. This is because the user now logs on to - for SSH - a different server (namely the freshly
installed Gentoo system rather than the live environment that the installation is currently using). Follow the instructions
given on the screen then to replace the host key on the client system.
To be able to use sshd, the network needs to function properly. Continue with the chapter on Configuring the network (/wiki/
Handbook:AMD64/Installation/Networking).
15 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Using DHCP
DHCP (Dynamic Host Configuration Protocol) assists in network configuration, and can automatically provide configuration for
a variety of parameters including: IP address, network mask, routes, DNS servers, NTP servers, etc.
DHCP requires that a server be running on the same Layer 2 (Ethernet) segment as the client requesting a lease. DHCP is often
used on RFC1918 (private) networks, but is also used to acquire public IP information from ISPs.
Tip
Official Gentoo boot media runs dhcpcd automatically at startup. This behavior can be disabled by adding the nodhcp
argument to the boot media kernel commandline (/wiki/Handbook:AMD64/Installation/Media).
root # dhcpcd -x
See also
Dhcpcd usage (/wiki/Dhcpcd#Usage)
root # ip route
If no default route is defined, Internet connectivity is unavailable, and additional configuration is required.
Basic internet connectivity can be confirmed with a ping:
Tip
It's helpful to start by pinging a known IP address instead of a hostname. This can isolate DNS issues from basic Internet
connectivity issues.
16 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
root # ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 10
00
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
4: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group def
ault qlen 1000
link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff
root # ip address
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 100
0<pre>
link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff
inet 10.0.20.77/22 brd 10.0.23.255 scope global enp1s0
valid_lft forever preferred_lft forever
inet6 fe80::ea40:f2ff:feac:257a/64 scope link
valid_lft forever preferred_lft forever
The output of this command contains information for each network interface on the system. Entries begin with the device
index, followed by the device name: enp1s0.
Tip
If no interfaces other than the lo (loopack) are displayed, then the networking hardware is faulty, or the driver for the
interface has not been loaded into the kernel. Both situations reach beyond the scope of this Handbook. Please ask for
support in contact #gentoo (ircs://irc.libera.chat/#gentoo) (webchat (https://web.libera.chat/#gentoo)).
For consistency, the handbook will assume that the primary network interface is called enp1s0.
Note
Note
The # symbol in the following commands is a comment. It has been added for clarity only and does not need to be
typed when entering the commands.
17 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
root # export RSYNC_PROXY="proxy.gentoo.org:8080" # Applies to Portage; Links does not support a rsync
proxy
root # pppoe-setup
root # pppoe-start
In the event of failure, credentials in /etc/ppp/pap-secrets or /etc/ppp/chap-secrets should be verified. If credentials
are correct, PPPoE Ethernet interface selection should be checked.
Using PPTP
If PPTP support is needed, pptpclient can be used, but requires configuration prior to usage.
Edit /etc/ppp/pap-secrets or /etc/ppp/chap-secrets so it contains the correct username/password combination:
Configuring WEP
Warning
Do not use WEP unless it is the only option. WEP provides essentially no security over an open network.
Important
The iw command is only available on the following architectures: amd64, x86, arm, arm64, ppc, ppc64, and riscv.
When using a wireless (802.11) card, the wireless settings need to be configured before going any further. To see the current
wireless settings on the card, one can use iw. Running iw might show something like:
Interface wlp9s0
ifindex 3
wdev 0x1
addr 00:00:00:00:00:00
type managed
wiphy 0
channel 11 (2462 MHz), width: 20 MHz (no HT), center1: 2462 MHz
txpower 30.00 dBm
Not connected.
18 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
or
Note
Some wireless cards may have a device name of wlan0 or ra0 instead of wlp9s0. Run ip link to determine the correct
device name.
For most users, there are only two settings needed to connect, the ESSID (aka wireless network name) and, optionally, the
WEP key.
Note
If the wireless network is set up with WPA or WPA2, then wpa_supplicant needs to be used. For more information on
configuring wireless networking in Gentoo Linux, please read the Wireless networking chapter (/wiki/Handbook:AMD64/
Networking/Wireless) in the Gentoo Handbook.
Confirm the wireless settings by using iw dev wlp9s0 link. Once wireless is working, continue configuring the IP level
networking options as described in the next section (Understanding network terminology (/wiki/Handbook:AMD64/
Installation/Networking#Understanding_network_terminology)) or use the net-setup tool as described previously.
Using net-setup
In cases where automatic network configuration is unsuccessful, the Gentoo boot media provides scripts to aid in network
configuration. net-setup can be used to configure wireless network information and static IPs.
Important
Network status should be tested (/wiki/Handbook:AMD64/Installation/Networking#Testing_the_network) after any
configuration steps are taken. In the event that configuration scripts do not work, manual network configuration (/wiki/
Handbook:AMD64/Installation/Networking#Manual_network_configuration) is required.
19 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Tip
Some CPE (Carrier Provided Equipment) combines the functions of a router, access point, modem, DHCP server, and DNS
server into one unit. It's important to differentiate the functions of a device from the physical appliance.
Important
IP addresses can be set arbitrarily. As a result, it's possible for multiple devices to use the same IP address, resulting in an
address conflict. Address conflicts should be avoided by using DHCP or SLAAC.
Tip
IPv6 typically uses StateLess Address AutoConfiguration (SLAAC) for address configuration. In most cases, manually
setting IPv6 addresses is a bad practice. If a specific address suffix is preferred, interface identification tokens (/wiki/
IPv6_Static_Addresses_using_Tokens) can be used.
▪ The CIDR value, often notated starting with a /, represents the size of the network.
▪ The formula 2 ^ (32 - CIDR) can be used to calculate network size.
▪ Once network size is calculated, usable node count must be reduced by 2.
▪ The first IP in a network is the Network address, and the last is typically the Broadcast address. These
addresses are special and cannot be used by normal hosts.
Tip
The most common CIDR values are /24, and /32, representing 254 nodes and a single node respectively.
A CIDR of /24 is the de-facto default network size. This corresponds to a subnet mask of 255.255.255.0, where the last 8 bits
are reserved for IP addresses for nodes on a network.
The notation: 192.168.0.2/24 can be interpreted as:
Using this configuration, a device should be able to communicate with any host on the same network (192.168.0.0).
The Internet
Once a device is on a network, how does it know how to talk to devices on the Internet?
To communicate with devices outside of local networks, routing must be used. A router is simply a network device that
forwards traffic for other devices. The term default route or gateway typically refers to whatever device on the current network
is used for external network access.
Tip
It's a standard practice to make the gateway the first or last IP on a network.
If an Internet-connected router is available at 192.168.0.1, it can be used as the default route, granting Internet access.
To summarize:
▪ Interfaces must be configured with an address and network information, such as the CIDR value.
20 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Tip
Many routers can also function as a DNS server, and using a local DNS server can augment privacy and speed up queries
through caching.
Many ISPs run a DNS server that is generally advertised to the gateway over DHCP. Using a local DNS server tends to improve
query latency, but most public DNS servers will return the same results, so server usage is largely based on preference.
Tip
The start of this command can be shortened to ip a.
root # ip route
Tip
This command can be shortened to ip r.
DNS configuration
Nameserver info is typically acquired using DHCP, but can be set manually by adding nameserver entries to /etc/
resolv.conf.
Warning
If dhcpcd is running, changes to /etc/resolv.conf will not persist. Status can be checked with ps x | grep dhcpcd .
nano is included in Gentoo boot media and can be used to edit /etc/resolv.conf with:
nameserver 9.9.9.9
nameserver 149.112.112.112
21 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
nameserver 1.1.1.1
nameserver 1.0.0.1
The following table will help readers determine where to find a certain type of block device on the system:
IDE, SATA, /dev/sda Found on hardware from roughly 2007 until the present, this device handle is perhaps the most
SAS, SCSI, commonly used in Linux. These types of devices can be connected via the SATA bus (https://
or USB en.wikipedia.org/wiki/Serial_ATA), SCSI (https://en.wikipedia.org/wiki/SCSI), USB (https://
flash en.wikipedia.org/wiki/USB) bus as block storage. As example, the first partition on the first SATA
device is called /dev/sda1.
NVM /dev/ The latest in solid state technology, NVMe (https://en.wikipedia.org/wiki/NVM_Express) drives are
Express nvme0n1 connected to the PCI Express bus and have the fastest transfer block speeds on the market.
(NVMe) Systems from around 2014 and newer may have support for NVMe hardware. The first partition
on the first NVMe device is called /dev/nvme0n1p1.
The block devices above represent an abstract interface to the disk. User programs can use these block devices to interact
with the disk without worrying about whether the drives are SATA, SCSI, or something else. The program can simply address
the storage on the disk as a bunch of contiguous, randomly-accessible 4096-byte (4K) blocks.
Partition tables
Although it is theoretically possible to use a raw, unpartitioned disk to house a Linux system (when creating a btrfs RAID for
example), this is almost never done in practice. Instead, disk block devices are split up into smaller, more manageable block
devices. On amd64 systems, these are called partitions. There are currently two standard partitioning technologies in use: MBR
(sometimes also called DOS disklabel) and GPT; these are tied to the two boot process types: legacy BIOS boot and UEFI.
22 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Important
There are a few caveats regarding GPT:
▪ Using GPT on a BIOS-based computer works, but the user won't be able to dual-boot with a Microsoft Windows
operating system, since Microsoft Windows refuses to boot from a GPT partition when in BIOS mode.
▪ Some buggy (old) motherboard firmware configured to boot in BIOS/CSM/legacy mode might also have problems
with booting from GPT labeled disks.
Important
Although still supported by most motherboard manufacturers, MBR boot sectors and their associated partitioning
limitations are considered legacy. Unless working with hardware that is pre-2010, it best to partition a disk with GUID
Partition Table (https://en.wikipedia.org/wiki/GUID_Partition_Table). Readers who must proceed with setup type should
knowingly acknowledge the following information:
▪ Most post-2010 motherboards consider using MBR boot sectors a legacy (supported, but not ideal) boot mode.
▪ Due to using 32-bit identifiers, partition tables in the MBR cannot address storage space that is larger than 2 TiBs
in size.
▪ Unless an extended partition is created, MBR supports a maximum of four partitions.
▪ This setup does not provide a backup boot sector, so if something overwrites the partition table, all partition
information will be lost.
That said, MBR and legacy BIOS boot may still used in virtualized cloud environments such as AWS.
The Handbook authors suggest using GPT whenever possible for Gentoo installations.
Advanced storage
The official Gentoo boot media provides support for Logical Volume Manager (LVM) (/wiki/LVM). LVM can combine physical
volumes such as partitions or disks into volume groups. Volume groups are more flexible than partitions and can be used to
define RAID groups or caches on fast SSDs for slow HDs. Although usage is not covered in the handbook, LVM is fully
supported in Gentoo.
While it is possible to mix and match boot types with certain motherboard firmware, mixing goes beyond the intention of the
handbook. As previously stated, it is strongly recommended for installations on modern hardware to use UEFI boot with a
GPT disklabel disk.
The following partitioning scheme will be used as a simple example layout.
Important
The first row of the following table contains exclusive information for either a GPT disklabel or a MBR DOS/legacy BIOS
disklabel. When in doubt, proceed with GPT, since amd64 machines manufactured after the year 2010 generally support
UEFI firmware and GPT boot sector.
23 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
If this suffices as information, the advanced reader can directly skip ahead to the actual partitioning.
Both fdisk and parted are partitioning utilities included within the official Gentoo live image environments. fdisk is well
known, stable, and handles both MBR and GPT disks. parted was one of the first Linux block device management utilities to
support GPT partitions. It can be used as an alternative to fdisk if the reader prefers, however the handbook will only
provide instructions for fdisk, since it is commonly available on most Linux environments.
Before going to the creation instructions, the first set of sections will describe in more detail how partitioning schemes can be
created and mention some common pitfalls.
▪ If not configured properly, the system might have lots of free space on one partition and little free space on another.
▪ A separate partition for /usr/ may require the administrator to boot with an initramfs to mount the partition before
other boot scripts start. Since the generation and maintenance of an initramfs is beyond the scope of this handbook,
we recommend that newcomers do not use a separate partition for /usr/.
▪ There is also a 15-partition limit for SCSI and SATA unless the disk uses GPT labels.
Note
Installations that intend to use systemd as the service and init system must have the /usr directory available at boot,
either as part of the root filesystem or mounted via an initramfs.
24 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
There is no perfect value for swap space size. The purpose of the space is to provide disk storage to the kernel when internal
dynamic memory (RAM) is under pressure. A swap space allows for the kernel to move memory pages that are not likely to be
accessed soon to disk (swap or page-out), which will free memory in RAM for the current task. Of course, if the pages
swapped to disk are suddenly needed, they will need to be put back in memory (page-in) which will take considerably longer
than reading from RAM (as disks are very slow compared to internal memory).
When a system is not going to run memory intensive applications or has lots of RAM available, then it probably does not need
much swap space. However do note in case of hibernation that swap space is used to store the entire contents of memory
(likely on desktop and laptop systems rather than on server systems). If the system requires support for hibernation, then
swap space larger than or equal to the amount of memory is necessary.
As a general rule for RAM amounts less than 4 GB, the swap space size is recommended to be twice the internal memory
(RAM). For systems with multiple hard disks, it is wise to create one swap partition on each disk so that they can be utilized for
parallel read/write operations. The faster a disk can swap, the faster the system will run when data in swap space must be
accessed. When choosing between rotational and solid state disks, it is better for performance to put swap on the solid state
hardware.
It is worth noting that swap files can be used as an alternative to swap partitions; this is mostly helpful for systems with very
limited disk space.
Important
If the ESP is not formatted with a FAT variant, the system's UEFI firmware will not find the bootloader (or Linux kernel)
and will most likely be unable to boot the system!
The table provides a recommended defaults for a trivial Gentoo installation. Additional partitions can be added according to
personal preference or system design goals.
Device path (sysfs) Mount point File system DPS UUID (Type-UUID) Description
25 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
This particular disk was configured to house two Linux filesystems (each with a corresponding partition listed as "Linux") as
well as a swap partition (listed as "Linux swap").
Alternatively, to keep an existing GPT disklabel (see the output of p above), consider removing the existing partitions one by
one from the disk. Press d to delete a partition. For instance, to delete an existing /dev/sda1:
The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions ( p , but it will
not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that
case, press q immediately and hit Enter and the partition will not be deleted.
Repeatedly press p to print out a partition listing and then press d and the number of the partition to delete it. Eventually,
the partition table will be empty:
Now that the in-memory partition table is empty, we're ready to create the partitions.
A smaller ESP is possible but not recommended, especially given it may be shared with other OSes.
First create a small EFI system partition, which will also be mounted as /efi. Type n to create a new partition, followed by 1
to select the first partition. When prompted for the first sector, make sure it starts from 2048 (which may be needed for the
boot loader) and hit Enter . When prompted for the last sector, type +1G to create a partition 1 gibibyte in size:
26 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Selected partition 1
Partition type or alias (type L to list all): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.
After this, press t to set the partition type, 2 to select the partition just created and then type in 19 to set the partition type
to "Linux Swap".
Created a new partition 3 of type 'Linux filesystem' and of size 926.5 GiB..
Note
Setting the root partition's type to "Linux root (x86-64)" is not required and the system will function normally if it is set to
the "Linux filesystem" type. This filesystem type is only necessary for cases where a bootloader that supports it (i.e.
systemd-boot) is used and a fstab file is not wanted.
After creating the root partition, press t to set the partition type, 3 to select the partition just created, and then type in 23
to set the partition type to "Linux Root (x86-64)".
27 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
After completing these steps, pressing p should display a partition table that looks similar to the following:
With partitions now available, the next installation step is to fill them with filesystems.
/dev/sda1 /boot xfs N/A MBR DOS / legacy BIOS boot partition
details.
28 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
This particular disk was until now configured to house two Linux filesystems (each with a corresponding partition listed as
"Linux") as well as a swap partition (listed as "Linux swap"), using a GPT table.
Alternatively, to keep an existing DOS disklabel (see the output of p above), consider removing the existing partitions one by
one from the disk. Press d to delete a partition. For instance, to delete an existing /dev/sda1:
The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions ( p , but it will
not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that
case, type q immediately and hit Enter and the partition will not be deleted.
Repeatedly press p to print out a partition listing and then press d and the number of the partition to delete it. Eventually,
the partition table will be empty:
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-1953525167, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525167, default 1953525167): +1G
29 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Mark the partition as bootable by pressing the a key and pressing Enter :
Selected partition 1
The bootable flag on partition 1 is enabled now.
Note: if more than one partition is available on the disk, then the partition to be flagged as bootable will have to be selected.
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2099200-1953525167, default 2099200):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2099200-1953525167, default 1953525167): +4G
After all this is done, press t to set the partition type, 2 to select the partition just created and then type in 82 to set the
partition type to "Linux Swap".
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (10487808-1953525167, default 10487808):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (10487808-1953525167, default 1953525167):
After completing these steps, pressing p should display a partition table that looks similar to this:
30 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Introduction
Now that the partitions have been created, it is time to place a filesystem on them. In the next section the various file systems
that Linux supports are described. Readers that already know which filesystem to use can continue with Applying a filesystem
to a partition (/wiki/Handbook:AMD64/Installation/Disks#Applying_a_filesystem_to_a_partition). The others should read on to
learn about the available filesystems...
Filesystems
Linux supports several dozen filesystems, although many of them are only wise to deploy for specific purposes. Only certain
filesystems may be found stable on the amd64 architecture - it is advised to read up on the filesystems and their support
state before selecting a more experimental one for important partitions. XFS is the recommended all-purpose, all-platform
filesystem. The below is a non-exhaustive list:
XFS (/wiki/XFS)
Filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. It has been
continuously upgraded to include modern features. The only downside is that XFS partitions cannot yet be shrunk, although
this is being worked on. XFS notably supports reflinks and Copy on Write (CoW) which is particularly helpful on Gentoo
systems because of the amount of compiles users complete. XFS is the recommended modern all-purpose all-platform
filesystem. Requires a partition to be at least 300MB.
ext4 (/wiki/Ext4)
Ext4 is a reliable, all-purpose all-platform filesystem, although it lacks modern features like reflinks.
VFAT (/wiki/VFAT)
Also known as FAT32, is supported by Linux but does not support standard UNIX permission settings. It is mostly used for
interoperability/interchange with other operating systems (Microsoft Windows or Apple's macOS) but is also a necessity for
some system bootloader firmware (like UEFI). Users of UEFI systems will need an EFI System Partition (/wiki/
EFI_System_Partition) formatted with VFAT in order to boot.
btrfs (/wiki/Btrfs)
Newer generation filesystem. Provides advanced features like snapshotting, self-healing through checksums, transparent
compression, subvolumes, and integrated RAID. Kernels prior to 5.4.y are not guaranteed to be safe to use with btrfs in
production because fixes for serious issues are only present in the more recent releases of the LTS kernel branches. RAID 5/6
and quota groups unsafe on all versions of btrfs.
F2FS (/wiki/F2FS)
The Flash-Friendly File System was originally created by Samsung for the use with NAND flash memory. It is a decent choice
when installing Gentoo to microSD cards, USB drives, or other flash-based storage devices.
NTFS (/wiki/NTFS)
This "New Technology" filesystem is the flagship filesystem of Microsoft Windows since Windows NT 3.1. Similarly to VFAT, it
does not store UNIX permission settings or extended attributes necessary for BSD or Linux to function properly, therefore it
should not be used as a root filesystem for most cases. It should only be used for interoperability or data interchange with
Microsoft Windows systems (note the emphasis on only).
ZFS (/wiki/ZFS)
Important: ZFS pools can only be created on the admincd and LiveGUI ISOs, for further information, refer to ZFS/rootfs (/wiki/ZFS/rootfs)
Next generation file system created by Matthew Ahrens and Jeff Bonwick. It was designed around a few key ideas:
Administration of storage should be simple, redundancy should be handled by the filesystem, file systems should never be
31 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
taken offline for repair, automated simulations of worst case scenarios before shipping code is important, and data integrity
is paramount.
More extensive information on filesystems can be found in the community maintained Filesystem article (/wiki/Filesystem).
Please make sure to emerge the relevant user space utilities package for the chosen filesystem before rebooting. There
will be a reminder to do so near the end of the installation process.
To create a filesystem on a partition or volume, there are user space utilities available for each possible filesystem. Click the
filesystem's name in the table below for additional information on each filesystem:
Important
The handbook recommends new partitions as part of the installation process, but it is important to note running any
mkfs command will erase any data contained within the partition. When necessary, ensure any data that exists within is
appropriately backed up before creating a new filesystem.
For instance, to have the root partition (/dev/sda3) as xfs as used in the example partition structure, the following
commands would be used:
32 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Note
Installations which were previously started, but did not finish the installation process can resume the installation from
this point in the handbook. Use this link as the permalink: Resumed installations start here (/wiki/Handbook:AMD64/
Installation/Disks#Resumed_installations_start_here).
Note
If /tmp/ needs to reside on a separate partition, be sure to change its permissions after mounting:
root # chmod 1777 /mnt/gentoo/tmp
This also holds for /var/tmp.
Later in the instructions, the proc filesystem (a virtual interface with the kernel) as well as other kernel pseudo-filesystems will
be mounted. But first the Gentoo stage file (/wiki/Handbook:AMD64/Installation/Stage) must be extracted.
The stage file (/wiki/Stage_file) acts as the seed of a Gentoo install. Stage files are generated with Catalyst (/wiki/Catalyst) by
the Release Engineering Team (/wiki/Project:RelEng). Stage files are based on specific profiles (/wiki/Profile_(Portage)), and
contain an almost-complete system.
When choosing a stage file, it's important to pick one with profile targets corresponding to the desired system type.
Important
33 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
While it's possible to make major profile changes after an installation has been established, switching requires
substantial effort and consideration, and is outside the scope of this installation manual. Switching init systems is
difficult, but switching from no-multilib to multilib requires extensive Gentoo and low-level toolchain knowledge.
Tip
Most users should not need to use the 'advanced' tarballs options; they are for atypical or advanced software or
hardware configurations.
OpenRC
OpenRC (/wiki/OpenRC) is a dependency-based init system (responsible for starting up system services once the kernel has
booted) that maintains compatibility with the system provided init program, normally located in /sbin/init. It is Gentoo's
native and original init system, but is also deployed by a few other Linux distributions and BSD systems.
OpenRC does not function as a replacement for the /sbin/init file by default and is 100% compatible with Gentoo init
scripts. This means a solution can be found to run the dozens of daemons in the Gentoo ebuild repository.
systemd
systemd is a modern SysV-style init and rc replacement for Linux systems. It is used as the primary init system by a majority of
Linux distributions. systemd is fully supported in Gentoo and works for its intended purpose. If something seems lacking in
the Handbook for a systemd install path, review the systemd article (/wiki/Systemd) before asking for support.
Not every architecture has a multilib option. Many only run with native code. Multilib is most commonly applied to
amd64.
The multilib profile uses 64-bit libraries when possible, and only falls back to the 32-bit versions when strictly necessary for
compatibility. This is an excellent option for the majority of installations because it provides a great amount of flexibility for
customization in the future.
Tip
Using multilib targets makes it easier to switch profiles later, compared to no-multilib
Selecting a no-multilib tarball to be the base of the system provides a complete 64-bit operating system environment - free of
32-bit software. This effectively renders the ability to switch to multilib profiles burdensome, although still technically
possible.
root # cd /mnt/gentoo
root # date
34 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
If the displayed date/time is more than few minutes off, it should be updated using one of the following methods.
Automatic
Using NTP (/wiki/NTP) to correct clock skew is typically easier and more reliable than manually setting the system clock.
chronyd, part of net-misc/chrony (https://packages.gentoo.org/packages/net-misc/chrony) can be used to update the
system clock to UTC with:
root # chronyd -q
Important
Systems without a functioning Real-Time Clock (RTC) must sync the system clock at every system start, and on regular
intervals thereafter. This is also beneficial for systems with a RTC, as the battery could fail, and clock skew can
accumulate.
Warning
Standard NTP traffic not authenticated, it is important to verify time data obtained from the network.
Manual
When NTP access is unavailable, date can be used to manually set the system clock.
Note
UTC time is recommended for all Linux systems. Later, a system timezone is defined, which changes the offset when the
date is displayed.
The following argument format is used to set the time: MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year).
For instance, to set the date to October 3rd, 13:16 in the year 2021, issue:
Graphical browsers
Those using environments with fully graphical web browsers will have no problem copying a stage file URL from the main
website's download section (https://www.gentoo.org/downloads/#other-arches). Simply select the appropriate tab, right click
the link to the stage file, then Copy Link to copy the link to the clipboard, then paste the link to the wget utility on the
command-line to download the stage file:
Command-line browsers
More traditional readers or 'old timer' Gentoo users, working exclusively from command-line may prefer using links
(www-client/links (https://packages.gentoo.org/packages/www-client/links) ), a non-graphical, menu-driven browser. To
download a stage, surf to the Gentoo mirror list like so:
35 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Note
Most stages are now explicitly suffixed (https://www.gentoo.org/news/2021/07/20/more-downloads.html) with the init
system type (openrc or systemd), although some architectures may still be missing these for now.
Like with the minimal installation CDs, additional downloads to verify and validate the stage file are available. Although these
steps may be skipped, these files are provided for users who care about the integrity of the file(s) they just downloaded. The
extra files are available under the root of the mirrors directory. Browse to the appropriate location for the hardware
architecture and the system profile and download the associated .CONTENTS.gz, .DIGESTS, and .sha256 files.
Cryptographic tools and utilities such as openssl, sha256sum, or sha512sum can be used to compare the output with the
checksums provided by the .DIGESTS file.
To verify the SHA512 checksum with openssl:
36 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Now that the stage file is unpacked, proceed with Configuring compile options (/wiki/Handbook:AMD64/Installation/
Stage#Configuring_compile_options).
Note
Technically variables can be exported via the shell's (/wiki/Shell) profile or rc files, however that is not best practice for
basic system administration.
Portage reads in the make.conf (/wiki/Make.conf) file when it runs, which will change runtime behavior depending on the
values saved in the file. make.conf can be considered the primary configuration file for Portage, so treat its content carefully.
Tip
A commented listing of all possible variables can be found in /mnt/gentoo/usr/share/portage/config/
make.conf.example. Additional documentation on make.conf can be found by running man 5 make.conf.
For a successful Gentoo installation only the variables that are mentioned below need to be set.
Fire up an editor (in this guide we use nano) to alter the optimization variables we will discuss hereafter.
37 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Tip
Although the GCC optimization (/wiki/GCC_optimization) article has more information on how the various compilation
options can affect a system, the Safe CFLAGS (/wiki/Safe_CFLAGS) article may be a more practical place for beginners to
start optimizing their systems.
RUSTFLAGS
Many programs are now written in Rust which has its own way of optimising. By default Rust optimizes to level 3 on all release
builds unless a project changes it so this should be left as is. A full optimization list (known as codegen) that can be passed to
the rust compiler is available at https://doc.rust-lang.org/rustc/codegen-options/index.html (https://doc.rust-lang.org/rustc/
codegen-options/index.html).
The most useful optimization would be to tell Rust to compile for your CPU using the following example:
RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native"
Note
The above command only works on desktop stage3 tarballs or after emerging
dev-lang/rust-bin (https://packages.gentoo.org/packages/dev-lang/rust-bin) or
dev-lang/rust (https://packages.gentoo.org/packages/dev-lang/rust) .
MAKEOPTS
The MAKEOPTS variable defines how many parallel compilations should occur when installing a package. As of Portage version
3.0.31[1], if left undefined, Portage's default behavior is to set the MAKEOPTS jobs value to the same number of threads
returned by nproc.
Further, as of Portage 3.0.53[2], if left undefined, Portage's default behavior is to set the MAKEOPTS load-average value to the
same number of threads returned by nproc.
A good choice is the smaller of: the number of threads the CPU has, or the total amount of system RAM divided by 2 GiB.
Warning
Using a large number of jobs can significantly impact memory consumption. A good recommendation is to have at least
2 GiB of RAM for every job specified (so, e.g. -j6 requires at least 12 GiB). To avoid running out of memory, lower the
number of jobs to fit the available memory.
Tip
When using parallel emerges ( --jobs ), the effective number of jobs run can grow exponentially (up to make jobs
multiplied by emerge jobs). This can be worked around by running a localhost-only distcc configuration that will limit the
number of compiler instances per host.
38 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
References
1. https://gitweb.gentoo.org/proj/portage.git/commit/?id=5d2af567772bb12b073f1671daea6263055cbdc2 (https://
gitweb.gentoo.org/proj/portage.git/commit/?id=5d2af567772bb12b073f1671daea6263055cbdc2)
2. https://gitweb.gentoo.org/proj/portage.git/commit/?id=de7be7f45ee54e3f789def46542919550687d15e (https://
gitweb.gentoo.org/proj/portage.git/commit/?id=de7be7f45ee54e3f789def46542919550687d15e)
Chrooting
Copy DNS info
One thing still remains to be done before entering the new environment and that is copying over the DNS information in /
etc/resolv.conf. This needs to be done to ensure that networking still works even after entering the new environment. /
etc/resolv.conf contains the name servers for the network.
To copy this information, it is recommended to pass the --dereference option to the cp command. This ensures that, if /
etc/resolv.conf is a symbolic link, that the link's target file is copied instead of the symbolic link itself. Otherwise in the new
environment the symbolic link would point to a non-existing file (as the link's target is most likely not available inside the new
environment).
In a few moments, the Linux root will be changed towards the new location.
The filesystems that need to be made available are:
▪ /proc/ is a pseudo-filesystem. It looks like regular files, but is generated on-the-fly by the Linux kernel
▪ /sys/ is a pseudo-filesystem, like /proc/ which it was once meant to replace, and is more structured than /proc/
▪ /dev/ is a regular file system which contains all device. It is partially managed by the Linux device manager (usually
udev)
▪ /run/ is a temporary file system used for files generated at runtime, such as PID files or locks
The /proc/ location will be mounted on /mnt/gentoo/proc/ whereas the others are bind-mounted. The latter means that,
for instance, /mnt/gentoo/sys/ will actually be /sys/ (it is just a second entry point to the same filesystem) whereas /mnt/
gentoo/proc/ is a new mount (instance so to speak) of the filesystem.
Note
The --make-rslave operations are needed for systemd support later in the installation.
Warning
When using non-Gentoo installation media, this might not be sufficient. Some distributions make /dev/shm a symbolic
link to /run/shm/ which, after the chroot, becomes invalid. Making /dev/shm/ a proper tmpfs mount up front can fix
this:
39 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
1. The root location is changed from / (on the installation medium) to /mnt/gentoo/ (on the partitions) using chroot or
arch-chroot, if available.
2. Some settings (those in /etc/profile) are reloaded in memory using the source command
3. The primary prompt is changed to help us remember that this session is inside a chroot environment.
Tip
If the Gentoo installation is interrupted anywhere after this point, it should be possible to 'resume' the installation at this
step. There is no need to re-partition the disks again! Simply mount the root partition (/wiki/Handbook:AMD64/
Installation/Disks#Mounting_the_root_partition) and run the steps above starting with copying the DNS info (/wiki/
Handbook:AMD64/Installation/Base#Copy_DNS_info) to re-enter the working environment. This is also useful for fixing
bootloader issues. More information can be found in the chroot (/wiki/Chroot) article.
UEFI systems
For UEFI systems, /dev/sda1 was formatted with the FAT32 filesystem and will be used as the EFI System Partition (ESP).
Create a new /efi directory (if not yet created), and then mount ESP there:
Configuring Portage
Installing a Gentoo ebuild repository snapshot from the web
Next step is to install a snapshot of the Gentoo ebuild repository. This snapshot contains a collection of files that informs
Portage about available software titles (for installation), which profiles the system administrator can select, package or profile
specific news items, etc.
The use of emerge-webrsync is recommended for those who are behind restrictive firewalls (it uses HTTP/FTP protocols for
downloading the snapshot) and saves network bandwidth. Readers who have no network or bandwidth restrictions can
happily skip down to the next section.
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:
root # emerge-webrsync
Note
During this operation, emerge-webrsync might complain about a missing /var/db/repos/gentoo/ location. This is to be
expected and nothing to worry about - the tool will create the location.
From this point onward, Portage might mention that certain updates are recommended to be executed. This is because
system packages installed through the stage file might have newer versions available; Portage is now aware of new packages
40 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
because of the repository snapshot. Package updates can be safely ignored for now; updates can be delayed until after the
Gentoo installation has finished.
A profile is a building block for any Gentoo system. Not only does it specify default values for USE, CFLAGS, and other important
variables, it also locks the system to a certain range of package versions. These settings are all maintained by Gentoo's
Portage developers.
To see what profile the system is currently using, run eselect using the profile module:
41 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Note
The output of the command is just an example and evolves over time.
Note
To use systemd, select a profile which has "systemd" in the name and vice versa, if not
There are also desktop sub-profiles available for some architectures which include software packages commonly necessary
for a desktop experience.
Warning
Profile upgrades are not to be taken lightly. When selecting the initial profile, use the profile corresponding to the same
version as the one initially used by the stage file (e.g. 23.0). Each new profile version is announced through a news item
containing migration instructions; be sure to carefully follow the instructions before switching to a newer profile.
After viewing the available profiles for the amd64 architecture, users can select a different profile for the system:
No-multilib
In order to select a pure 64-bit environment, with no 32-bit applications or libraries, use a no-multilib profile:
Note
The developer sub-profile is specifically for Gentoo Linux development and is not meant to be used by casual users.
Repository configuration
42 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
The repository configuration for a binhost is found in Portage's /etc/portage/binrepos.conf/ directory, which functions
similarly to the configuration mentioned in the Gentoo ebuild repository (/wiki/Handbook:AMD64/Installation/
Base#Gentoo_ebuild_repository) section.
When defining a binary host, there are two important aspects to consider:
1. The architecture and profile targets within the sync-uri value do matter and should align to the respective computer
architecture (amd64 in this case) and system profile selected in the Choosing the right profile (/wiki/Handbook:AMD64/
Installation/Base#Choosing_the_right_profile) section.
2. Selecting a fast, geographically close mirror will generally shorten retrieval time. Review the mirrorselect tool
mentioned in the Optional: Selecting mirrors (/wiki/Handbook:AMD64/Installation/Base#Gentoo_ebuild_repository)
section or review the online list of mirrors (https://www.gentoo.org/downloads/mirrors/) where URL values can be
discovered.
[binhost]
priority = 9999
sync-uri = https://distfiles.gentoo.org/releases/<arch>/binpackages/<profile>/x86-64/
1. The --getbinpkg option can be passed when invoking the emerge command. This method of for binary package
installation is useful to install only a particular binary package.
2. Changing the system's default via Portage's FEATURES variable, which is exposed through the /etc/portage/
make.conf file. Applying this configuration change will cause Portage to query the binary package host for the
package(s) to be requested and fall back to compiling locally when no results are found.
Please also run getuto for Portage to set up the necessary keyring for verification:
root # getuto
Additional Portage features will be discussed in the the next chapter (/wiki/Handbook:AMD64/Working/
Features#Portage_features) of the handbook.
USE="X acl alsa amd64 berkdb bindist bzip2 cli cracklib crypt cxx dri ..."
Note
The above example is truncated, the actual list of USE values is much, much larger.
43 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
A full description on the available USE flags can be found on the system in /var/db/repos/gentoo/profiles/use.desc.
When a USE value is defined in /etc/portage/make.conf it is added to the system's USE flag list. USE flags can be globally
removed by adding a - minus sign in front of the value in the the list. For example, to disable support for X graphical
environments, -X can be set:
Warning
Although possible, setting -* (which will disable all USE values except the ones specified in make.conf) is strongly
discouraged and unwise. Ebuild developers choose certain default USE flag values in ebuilds in order to prevent conflicts,
enhance security, and avoid errors, and other reasons. Disabling all USE flags will negate default behavior and may cause
major issues.
CPU_FLAGS_*
Some architectures (including AMD64/X86, ARM, PPC) have a USE_EXPAND (/wiki/USE_EXPAND) variable called
CPU_FLAGS_<ARCH> (/wiki/CPU_FLAGS_X86), where <ARCH> is replaced with the relevant system architecture name.
Important
Do not be confused! AMD64 and X86 systems share some common architecture, so the proper variable name for AMD64
systems is CPU_FLAGS_X86.
This is used to configure the build to compile in specific assembly code or other intrinsics, usually hand-written or otherwise
extra, and is not the same as asking the compiler to output optimized code for a certain CPU feature (e.g. -march= ).
Users should set this variable in addition to configuring their COMMON_FLAGS as desired.
A few steps are needed to set this up:
root # cpuid2cpuflags
Then copy the output into package.use:
VIDEO_CARDS
Below is an example of a properly set package.use for VIDEO_CARDS. Substitute the name of the driver(s) to be used.
FILE /etc/portage/package.use/00video_cards
Below is a table that can be used to easily compare the different video card types to their respective VIDEO_CARDS value.
44 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Details for various GPU(s) can be found at the AMDGPU (/wiki/AMDGPU), Intel (/wiki/Intel), Nouveau (Open Source) (/wiki/
Nouveau), or NVIDIA (Proprietary) (/wiki/NVIDIA) articles.
Name Description
@GPL-COMPATIBLE GPL compatible licenses approved by the Free Software Foundation [a_license 1]
@MISC-FREE Misc licenses that are probably free software, i.e. follow the Free Software Definition [a_license 3] but
are not approved by either FSF or OSI
@FSF-APPROVED-OTHER FSF-approved licenses for "free documentation" and "works of practical use besides software and
documentation" (including fonts)
@MISC-FREE-DOCS Misc licenses for free documents and other works (including fonts) that follow the free definition
[a_license 4]
but are NOT listed in @FSF-APPROVED-OTHER .
@FREE Metaset of all licenses with the freedom to use, share, modify and share modifications. Combines
@FREE-SOFTWARE and @FREE-DOCUMENTS .
@BINARY- Licenses that at least permit free redistribution of the software in binary form. Includes @FREE .
REDISTRIBUTABLE
@EULA License agreements that try to take away your rights. These are more restrictive than "all-rights-
reserved" or require explicit approval
1. https://www.gnu.org/licenses/license-list.html (https://www.gnu.org/licenses/license-list.html)
2. https://www.opensource.org/licenses (https://www.opensource.org/licenses)
3. https://www.gnu.org/philosophy/free-sw.html (https://www.gnu.org/philosophy/free-sw.html)
4. https://freedomdefined.org/ (https://freedomdefined.org/)
Currently set system wide acceptable license values can be viewed via:
@FREE
As visible in the output, the default value is to only allow software which has been grouped into the @FREE category to be
45 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
installed.
Specific licenses or licenses groups for a system can be defined in the following locations:
▪ System wide within the selected profile - this sets the default value.
▪ System wide within the /etc/portage/make.conf file. System administrators override the profile's default value within
this file.
▪ Per-package within a /etc/portage/package.license file.
▪ Per-package within a /etc/portage/package.license/ directory of files.
The system wide license default in the profile is overridden within the /etc/portage/make.conf:
Optionally system administrators can also define accepted licenses per-package as shown in the following directory of files
example. Note that the package.license directory will need created if it does not already exist:
app-arch/unrar unRAR
sys-kernel/linux-firmware linux-fw-redistributable
sys-firmware/intel-microcode intel-ucode
Important
The LICENSE variable in an ebuild is only a guideline for Gentoo developers and users. It is not a legal statement, and
there is no guarantee that it will reflect reality. It is recommended to not solely rely on a ebuild developer's interpretation
of a software package's license; but check the package itself in depth, including all files that have been installed to the
system.
1. A profile target different from the stage file has been selected.
2. Additional USE flags have been set for installed packages.
Readers who are performing an 'install Gentoo speed run' may safely skip @world set updates until after their system has
rebooted into the new Gentoo environment.
Readers who are performing a slow run can have Portage perform updates for package, profile, and/or USE flag changes at
the present time:
Tip
If a desktop environment profile target has been selected from a non-desktop stage file, the @world update process
could greatly extend the amount of time necessary for the install process. Those in a time crunch can work by this 'rule
of thumb': the shorter the profile name, the less specific the system's @world set (/wiki/World_set_(Portage)). The less
specific the @world set, the fewer packages the system will require. E.g.:
46 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Timezone
Note
This step does not apply to users of the musl libc. Users who do not know what that means should perform this step.
Warning
Please avoid the /usr/share/zoneinfo/Etc/GMT* timezones as their names do not indicate the expected zones. For
instance, GMT-8 is in fact GMT+8.
Select the timezone for the system. Look for the available timezones in /usr/share/zoneinfo/:
root # ls -l /usr/share/zoneinfo
root # ls -l /usr/share/zoneinfo/Europe/ [Expand]
Suppose the timezone of choice is Europe/Brussels, to select this timezone, a symlink can be created from this [Expand]
zoneinfo file to /etc/localtime:
Tip
The target path with ../ at the start is relative to the link location, not the current directory.
Note
An absolute path can be used for the symlink, but a relative link is also created by systemd's timedatectl and is more
compatible with alternate ROOTs.
Configure locales
Note
This step does not apply to users of the musl libc. Users who do not know what that means should perform this step.
Locale generation
Most users will want to use only one or two locales on their system.
Locales specify not only the language that the user should use to interact with the system, but also the rules for sorting
strings, displaying dates and times, etc. Locales are case sensitive and must be represented exactly as described. A full listing
of available locales can be found in the /usr/share/i18n/SUPPORTED file.
Supported system locales must be defined in the /etc/locale.gen file.
FILE /etc/locale.gen Enabling US and DE locales with the appropriate character formats
en_US ISO-8859-1
en_US.UTF-8 UTF-8
de_DE ISO-8859-1
de_DE.UTF-8 UTF-8
Warning
Many applications require least one UTF-8 locale to build properly.
47 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
The next step is to run the locale-gen command. This command generates all locales specified in the /etc/locale.gen file.
root # locale-gen
To verify that the selected locales are now available, run locale -a.
On systemd installs, localectl can be used, e.g. localectl set-locale ... or localectl list-locales.
Locale selection
Once done, it is now time to set the system-wide locale settings. Again eselect is used, now with the locale module.
With eselect locale list, the available targets are displayed:
With eselect locale set <NUMBER> the correct locale can be selected:
LANG="de_DE.UTF-8"
LC_COLLATE="C.UTF-8"
Setting the locale will avoid warnings and errors during kernel and software compilations later in the installation.
Now reload the environment:
References
1. https://www.gentoo.org/news/2023/12/29/Gentoo-binary.html (https://www.gentoo.org/news/2023/12/29/Gentoo-
binary.html)
2. https://www.gentoo.org/glep/glep-0023.html#id7 (https://www.gentoo.org/glep/glep-0023.html#id7)
Tip
Most wireless cards and GPUs require firmware to function.
48 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Note
Installing certain firmware packages often requires accepting the associated firmware licenses. If necessary, visit the
license handling section (/wiki/Handbook:AMD64/Working/Portage#Licenses) of the Handbook for help on accepting
licenses.
Firmware Loading
Firmware files are typically loaded when the associated kernel module is loaded. This means the firmware must be built into
the kernel using CONFIG_EXTRA_FIRMWARE if the kernel module is set to Y instead of M. In most cases, building-in a module
which required firmware can complicate or break loading.
SOF Firmware
Sound Open Firmware (SOF) is a new open source audio driver meant to replace the proprietary Smart Sound Technology
(SST) audio driver from Intel. 10th gen+ and Apollo Lake (Atom E3900, Celeron N3350, and Pentium N4200) Intel CPUs require
this firmware for certain features and certain AMD APUs also have support for this firmware. SOF's supported platforms
matrix can be found here (https://thesofproject.github.io/latest/platforms/index.html) for more information.
Microcode
In addition to discrete graphics hardware and network interfaces, CPUs also can require firmware updates. Typically this kind
of firmware is referred to as microcode. Newer revisions of microcode are sometimes necessary to patch instability, security
concerns, or other miscellaneous bugs in CPU hardware.
Microcode updates for AMD CPUs are distributed within the aforementioned
sys-kernel/linux-firmware (https://packages.gentoo.org/packages/sys-kernel/linux-firmware) package. Microcode for
Intel CPUs can be found within the
sys-firmware/intel-microcode (https://packages.gentoo.org/packages/sys-firmware/intel-microcode) package, which
will need to be installed separately. See the Microcode article (/wiki/Microcode) for more information on how to apply
microcode updates.
sys-kernel/installkernel
Installkernel (/wiki/Installkernel) may be used to automate the kernel installation, initramfs (/wiki/Initramfs) generation,
unified kernel image (/wiki/Unified_kernel_image) generation and/or bootloader configuration among other things.
sys-kernel/installkernel (https://packages.gentoo.org/packages/sys-kernel/installkernel) implements two paths of
achieving this: the traditional installkernel originating from Debian and systemd (/wiki/Systemd)'s kernel-install. Which
one to choose depends, among other things, on the system's bootloader. By default, systemd's kernel-install is used on
systemd profiles, while the traditional installkernel is the default for other profiles.
Bootloader
Now is the time to think about which bootloader the user wants for the system, if unsure, follow the 'Traditional layout'
subsection below.
GRUB
Users of GRUB can use either systemd's kernel-install or the traditional Debian installkernel. The
systemd (https://packages.gentoo.org/useflags/systemd) (/wiki/USE_flag) USE flag switches between these
implementations. To automatically run grub-mkconfig when installing the kernel, enable the
grub (https://packages.gentoo.org/useflags/grub) (/wiki/USE_flag) USE flag (/wiki/USE_flag).
FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel grub
systemd-boot
When using systemd-boot (/wiki/Systemd/systemd-boot) (formerly gummiboot) as the bootloader, systemd's kernel-
install must be used. Therefore ensure the
systemd (https://packages.gentoo.org/useflags/systemd) (/wiki/USE_flag) and the
systemd-boot (https://packages.gentoo.org/useflags/systemd-boot) (/wiki/USE_flag) USE flags are enabled
on sys-kernel/installkernel (https://packages.gentoo.org/packages/sys-kernel/installkernel) , and then install the
relevant package for systemd-boot.
On OpenRC systems:
FILE /etc/portage/package.use/systemd-boot
49 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
FILE /etc/portage/package.use/systemd
sys-apps/systemd boot
sys-kernel/installkernel systemd-boot
FILE /etc/kernel/cmdline
quiet splash
EFI stub
UEFI-based computer systems technically do not need secondary bootloaders in order to boot kernels. Secondary
bootloaders exist to extend the functionality of UEFI firmware during the boot process. That being said, using a secondary
bootloader is typically easier and more robust because it offers a more flexible approach for quickly modifying kernel
parameters at boot time. Note also that UEFI implentations strongly differ between vendors and between models and there is
no guarantee that a given firmware follows the UEFI specification. Therefore, EFI Stub booting is not guaranteed to work on
every UEFI-based system, and hence the USE flag is stable masked and testing keywords must be accepted for installkernel to
use this feature.
FILE /etc/portage/package.accept_keywords/installkernel
sys-kernel/installkernel
sys-boot/uefi-mkconfig
app-emulation/virt-firmware
FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel efistub
Initramfs
An initial ram-based file system, or initramfs (/wiki/Initramfs), may be required for a system to boot. A wide of variety of cases
may necessitate one, but common cases include:
Tip
Distribution kernels (/wiki/Project:Distribution_Kernel) are designed to be used with an initramfs, as many storage and
filesystem drivers are built as modules.
In addition to mounting the root filesystem, an initramfs may also perform other tasks such as:
▪ Running file system consistency check fsck, a tool to check and repair consistency of a file system in such events of
uncleanly shutdown a system.
▪ Providing a recovery environment in the event of late-boot failures.
Installkernel (/wiki/Installkernel) can automatically generate an initramfs when installing the kernel if the
dracut (https://packages.gentoo.org/useflags/dracut) (/wiki/USE_flag) or
ugrd (https://packages.gentoo.org/useflags/ugrd) (/wiki/USE_flag) USE flag is enabled:
50 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel dracut
FILE /etc/portage/package.use/uki
sys-apps/systemd boot
FILE /etc/portage/package.use/uki
For dracut:
FILE /etc/portage/package.use/uki
FILE /etc/dracut.conf.d/uki.conf
uefi="yes"
kernel_cmdline="some-kernel-command-line-arguments"
FILE /etc/portage/package.use/uki
FILE /etc/kernel/cmdline
some-kernel-command-line-arguments
Important
In the above configuration examples (for both Dracut and ukify) it is important to specify at least an appropriate root=
parameter for the kernel command line to ensure that the Unified Kernel Image can find the root partition. This is not
required for systemd based systems following the Discoverable Partitions Specification (DPS), in that case the embedded
initramfs will be able to dynamically find the root partition.
51 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
FILE /etc/portage/package.use/uki
sys-kernel/gentoo-kernel-bin generic-uki
sys-kernel/installkernel -dracut -ukify -ugrd uki
Secure Boot
Warning
If following this section and manually compiling your own kernel, then make sure to follow the steps outlined in Signing
the kernel (/wiki/Kernel#Optional:_Signing_the_kernel_image_.28Secure_Boot.29)
FILE /etc/dracut.conf.d/uki.conf
uefi="yes"
kernel_cmdline="some-kernel-command-line-arguments"
uefi_secureboot_key="/path/to/kernel_key.pem"
uefi_secureboot_cert="/path/to/kernel_key.pem"
For ukify:
FILE /etc/kernel/uki.conf
[UKI]
SecureBootPrivateKey=/path/to/kernel_key.pem
SecureBootCertificate=/path/to/kernel_key.pem
Now it is time to configure and compile the kernel sources. For the purposes of the installation, three approaches to kernel
management will be presented, however at any point post-installation a new approach can be employed.
Note
During the installation phase of Gentoo, only one kernel type should be installed i.e. either the
sys-kernel/gentoo-kernel-bin (https://packages.gentoo.org/packages/sys-kernel/gentoo-kernel-bin) or
sys-kernel/gentoo-sources (https://packages.gentoo.org/packages/sys-kernel/gentoo-sources) .
52 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
We use the term hybrid here but, do note that the dist-kernel and manual sources, both include methods to achieve the same
goal. New kernel sources are installed via the system package manager. System administrators may use Gentoo's genkernel
tool to configure, build, and install the Linux kernel, its associated modules, and (optionally, but not enabled by default) an
initramfs file. It is possible provide a custom kernel configuration file if customization is necessary. Future kernel
configuration, compilation, and installation require the system administrator's involvement in the form of running eselect
kernel, genkernel, and potentially other commands for each update. This option should only considered for users that
know they have a need for genkernel
The core around which all distributions are built is the Linux kernel. It is the layer between the user's programs and the
system hardware. Although the handbook provides its users several possible kernel sources, a more comprehensive listing
with more detailed descriptions is available at the Kernel overview page (/wiki/Kernel/Overview).
Tip
Kernel installation tasks such as copying the kernel image to /boot or the EFI System Partition (/wiki/
EFI_System_Partition), generating an initramfs (/wiki/Initramfs) and/or Unified Kernel Image (/wiki/Unified_Kernel_Image),
updating bootloader configuration, can be automated with installkernel (/wiki/Installkernel). Users may wish to configure
and install sys-kernel/installkernel (https://packages.gentoo.org/packages/sys-kernel/installkernel) before
proceeding. See the Kernel installation section below (/wiki/Handbook:AMD64/Installation/Kernel#Kernel_installation) for
more more information.
Distribution kernels
Distribution Kernels (/wiki/Project:Distribution_Kernel) are ebuilds that cover the complete process of unpacking, configuring,
compiling, and installing the kernel. The primary advantage of this method is that the kernels are updated to new versions by
the package manager as part of @world upgrade. This requires no more involvement than running an emerge command.
Distribution kernels default to a configuration supporting the majority of hardware, however two mechanisms are offered for
customization: savedconfig and config snippets. See the project page for more details on configuration. (/wiki/
Project:Distribution_Kernel#Modifying_kernel_configuration)
Optional: Signed kernel modules
The kernel modules in the prebuilt distribution kernel
(sys-kernel/gentoo-kernel-bin (https://packages.gentoo.org/packages/sys-kernel/gentoo-kernel-bin) ) are already
signed. To sign the modules of kernels built from source enable the
modules-sign (https://packages.gentoo.org/useflags/modules-sign) (/wiki/USE_flag) USE flag, and optionally
specify which key to use for signing in /etc/portage/make.conf (/wiki//etc/portage/make.conf):
USE="modules-sign"
If MODULES_SIGN_KEY is not specified the kernel build system will generate a key, it will be stored in /usr/src/linux-x.y.z/
certs. It is recommended to manually generate a key to ensure that it will be the same for each kernel release. A key may be
generated with:
root # openssl req -new -nodes -utf8 -sha256 -x509 -outform PEM -out kernel_key.pem -keyout kernel_key.pem
Note
The MODULES_SIGN_KEY and MODULES_SIGN_CERT may be different files. For this example the pem file generated by
OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.
OpenSSL will ask some questions about the user generating the key, it is recommended to fill in these questions as detailed
as possible.
Store the key in a safe location, at the very least the key should be readable only by the root user. Verify this with:
root # ls -l kernel_key.pem
If this outputs anything other then the above, correct the permissions with:
53 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
USE="modules-sign secureboot"
# Optionally, to boot with secureboot enabled, may be the same or different signing key.
SECUREBOOT_SIGN_KEY="/path/to/kernel_key.pem"
SECUREBOOT_SIGN_CERT="/path/to/kernel_key.pem"
Note
The SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT may be different files. For this example the pem file generated
by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.
Note
For this example the same key that was generated to sign the modules is used to sign the kernel image. It is also possible
to generate and use a second separate key for signing the kernel image. The same OpenSSL command as in the previous
section may be used again.
See the above section for instructions on generating a new key, the steps may be repeated if a separate key should be used to
sign the kernel image.
To successfully boot with Secure Boot enabled, the used bootloader must also be signed and the certificate must be accepted
by the UEFI (/wiki/UEFI) firmware or Shim (/wiki/Shim). This will be explained later in the handbook.
Important
Distribution Kernels (/wiki/Project:Distribution_Kernel), such as
sys-kernel/gentoo-kernel (https://packages.gentoo.org/packages/sys-kernel/gentoo-kernel) and
sys-kernel/gentoo-kernel-bin (https://packages.gentoo.org/packages/sys-kernel/gentoo-kernel-bin) , by default,
expect to be installed alongside an initramfs (/wiki/Handbook:AMD64/Installation/Kernel#Initramfs). Before running
emerge to install the kernel users should ensure that
sys-kernel/installkernel (https://packages.gentoo.org/packages/sys-kernel/installkernel) has been configured to
utilize an initramfs generator (for example Dracut (/wiki/Dracut)) as described in the installkernel section (/wiki/
Handbook:AMD64/Installation/Kernel#Initramfs).
Tip
54 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
By design, emerge only removes the kernel build directory. It does not actually remove the kernel modules, nor the
installed kernel image. To completely clean-up old kernels, the
app-admin/eclean-kernel (https://packages.gentoo.org/packages/app-admin/eclean-kernel) tool may be used.
Post-install/upgrade tasks
An upgrade of a distribution kernel is capable of triggering an automatic rebuild for external kernel modules installed by
other packages (for example: sys-fs/zfs-kmod (https://packages.gentoo.org/packages/sys-fs/zfs-kmod) or
x11-drivers/nvidia-drivers (https://packages.gentoo.org/packages/x11-drivers/nvidia-drivers) ). This automated
behaviour is enabled by enabling the
dist-kernel (https://packages.gentoo.org/useflags/dist-kernel) (/wiki/USE_flag) USE flag. When required,
this same flag will also trigger re-generation of the initramfs (/wiki/Initramfs).
It is highly recommended to enable this flag globally via /etc/portage/make.conf when using a distribution kernel:
USE="dist-kernel"
In case it was missed, this section requires the kernel sources to be installed. (/wiki/Handbook:AMD64/Installation/
Kernel#Installing_the_kernel_sources) Be sure to obtain the relevant kernel sources, then return here for the rest of
section.
Manually configuring a kernel is commonly seen as one of the most difficult procedures a system administrator has to
perform. Nothing is less true - after configuring a few kernels no one remembers that it was difficult! There are two ways for a
Gentoo user to manage a manual kernel system, both of which are listed below:
55 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Modprobed-db process
A very easy way to manage the kernel is to first install
sys-kernel/gentoo-kernel-bin (https://packages.gentoo.org/packages/sys-kernel/gentoo-kernel-bin) and use the
sys-kernel/modprobed-db (https://packages.gentoo.org/packages/sys-kernel/modprobed-db) to collect information about
what the system requires. modprobed-db is a tool which monitors the system via crontab to add all modules of all devices
over the system's life to make sure it everything a user needs is supported. For example, if an Xbox controller is added after
installation, then modprobed-db will add the modules to be built next time the kernel is rebuilt. More on this topic can be
found in the Modprobed-db (/wiki/Modprobed-db) article.
Manual process
This method allows a user to have full control of how their kernel is built with as minimal help from outside tools as they wish.
Some could consider this as making it hard for the sake of it.
However, with this choice one thing is true: it is vital to know the system when a kernel is configured manually. Most
information can be gathered by emerging sys-apps/pciutils (https://packages.gentoo.org/packages/sys-apps/pciutils)
which contains the lspci command:
Note
Inside the chroot, it is safe to ignore any pcilib warnings (like pcilib: cannot open /sys/bus/pci/devices) that lspci might
throw out.
Another source of system information is to run lsmod to see what kernel modules the installation CD uses as it might provide
a nice hint on what to enable.
Now go to the kernel source directory.
root # cd /usr/src/linux
The kernel has a method of autodetecting the modules currently being used on the installcd which will give a great starting
point to allow a user to configure their own. This can be called by using:
Naturally the choice in the last two lines depends on the selected init system (OpenRC (/wiki/OpenRC) vs. systemd (/wiki/
Systemd)). It does not hurt to have support for both init systems enabled.
When using sys-kernel/vanilla-sources (https://packages.gentoo.org/packages/sys-kernel/vanilla-sources) , the
additional selections for init systems will be unavailable. Enabling support is possible, but goes beyond the scope of the
handbook.
Enabling support for typical system components
Make sure that every driver that is vital to the booting of the system (such as SATA controllers, NVMe block device support,
filesystem support, etc.) is compiled in the kernel and not as a module, otherwise the system may not be able to boot
completely.
Next select the exact processor type. It is also recommended to enable MCE features (if available) so that users are able to be
notified of any hardware problems. On some architectures (such as x86_64), these errors are not printed to dmesg, but to /
dev/mcelog. This requires the app-admin/mcelog (https://packages.gentoo.org/packages/app-admin/mcelog) package.
Also select Maintain a devtmpfs file system to mount at /dev so that critical device files are already available early in the boot
process (CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT):
56 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
KERNEL Enabling basic SATA and PATA support (CONFIG_ATA_ACPI, CONFIG_SATA_PMP, CONFIG_SATA_AHCI,
CONFIG_ATA_BMDMA, CONFIG_ATA_SFF, CONFIG_ATA_PIIX)
Now go to File Systems and select support for the filesystems that will be used by the system. Do not compile the file system
that is used for the root filesystem as module, otherwise the system may not be able to mount the partition. Also select Virtual
memory and /proc file system. Select one or more of the following options as needed by the system:
57 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
If PPPoE is used to connect to the Internet, or a dial-up modem, then enable the following options (CONFIG_PPP,
CONFIG_PPP_ASYNC, and CONFIG_PPP_SYNC_TTY):
The two compression options won't harm but are not definitely needed, neither does the PPP over Ethernet option, that
might only be used by ppp when configured to do kernel mode PPPoE.
Don't forget to include support in the kernel for the network (Ethernet or wireless) cards.
Most systems also have multiple cores at their disposal, so it is important to activate Symmetric multi-processing support
(CONFIG_SMP):
Note
If USB input devices (like keyboard or mouse) or other USB devices will be used, do not forget to enable those as well:
KERNEL Enable USB and human input device support (CONFIG_HID_GENERIC, CONFIG_USB_HID, CONFIG_USB_SUPPORT,
CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD, (CONFIG_HID_GENERIC, CONFIG_USB_HID,
CONFIG_USB_SUPPORT, CONFIG_USB_XHCI_HCD, CONFIG_USB_EHCI_HCD, CONFIG_USB_OHCI_HCD, CONFIG_USB4)
58 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
To use a custom key, specify the location of this key in CONFIG_MODULE_SIG_KEY. If unspecified, the kernel build system will
generate a key. It is recommended to generate one manually instead. This can be done with:
root # openssl req -new -nodes -utf8 -sha256 -x509 -outform PEM -out kernel_key.pem -keyout kernel_key.pem
OpenSSL will ask some questions about the user generating the key, it is recommended to fill in these questions as detailed
as possible.
Store the key in a safe location, at the very least the key should be readable only by the root user. Verify this with:
root # ls -l kernel_key.pem
If this outputs anything other then the above, correct the permissions with:
To also sign external kernel modules installed by other packages via linux-mod-r1.eclass , enable the
modules-sign (https://packages.gentoo.org/useflags/modules-sign) (/wiki/USE_flag) USE flag globally:
USE="modules-sign"
Note
MODULES_SIGN_KEY and MODULES_SIGN_CERT may point to different files. For this example, the pem file generated by
OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the same value.
59 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Where ""image"" is a placeholder for the architecture specific image name. These options, from the top to the bottom:
enforces that the kernel image in a kexec call must be signed (kexec allows replacing the kernel in-place), enforces that kernel
modules are signed, enables lockdown integrity mode (prevents modifying the kernel at runtime), and enables various
keychains.
On arches that do not natively support decompressing the kernel (e.g. arm64 and riscv), the kernel must be built with its
own decompressor (zboot):
After compilation of the kernel, as explained in the next section, the kernel image must be signed. First install
app-crypt/sbsigntools (https://packages.gentoo.org/packages/app-crypt/sbsigntools) and then sign the kernel image:
Note
For this example, the same key that was generated to sign the modules is used to sign the kernel image. It is also
possible to generate and use a second separate key for signing the kernel image. The same OpenSSL command as in the
previous section may be used again.
60 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
USE="modules-sign secureboot"
# Optionally, to boot with secureboot enabled, may be the same or different signing key.
SECUREBOOT_SIGN_KEY="/path/to/kernel_key.pem"
SECUREBOOT_SIGN_CERT="/path/to/kernel_key.pem"
Note
SECUREBOOT_SIGN_KEY and SECUREBOOT_SIGN_CERT may point to different files. For this example, the pem file
generated by OpenSSL includes both the key and the accompanying certificate, and thus both variables are set to the
same value.
Note
When generating an Unified Kernel Image (/wiki/Unified_Kernel_Image) with systemd's ukify the kernel image will be
signed automatically before inclusion in the unified kernel image and it is not necessary to sign it manually.
Enable GPT partition label support if that was used previously when partitioning the disk (CONFIG_PARTITION_ADVANCED and
CONFIG_EFI_PARTITION):
Enable EFI stub support, EFI variables and EFI Framebuffer in the Linux kernel if UEFI is used to boot the system (CONFIG_EFI,
CONFIG_EFI_STUB, CONFIG_EFI_MIXED, CONFIG_EFI_VARS, and CONFIG_FB_EFI):
61 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Device Drivers
Graphics support --->
Frame buffer Devices --->
<*> Support for frame buffer devices --->
[*] EFI-based Framebuffer Support
File Systems
Pseudo filesystems --->
<*> EFI Variable filesystem
To enable the Kernel options for the use of SOF Firmware (/wiki/Handbook:AMD64/Installation/Kernel#SOF_Firmware)
covered earlier:
Note
It is possible to enable parallel builds using make -jX with X being an integer number of parallel tasks that the build
process is allowed to launch. This is similar to the instructions about /etc/portage/make.conf earlier, with the
MAKEOPTS variable.
When the kernel has finished compiling, copy the kernel image to /boot/. This is handled by the make install command:
Deprecated: Genkernel
Genkernel should only be considered by users with a required need that only Genkernel can meet. For others, it is
recommended to use the Distribution kernel or manually compile their own as it will make maintaining a Gentoo system a lot
more simple. An example of why genkernel is more difficult to manage is the lack of integration with
sys-kernel/installkernel (https://packages.gentoo.org/packages/sys-kernel/installkernel) . This means a user will not
get the same level of automation as provided by the other methods; for example, Unified Kernel Images will need to be
created manually when using Genkernel.
Users still wishing to use Genkernel should see the Genkernel (/wiki/Genkernel) article for more information.
Kernel modules
62 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Hardware modules are optional to be listed manually. udev will normally load all hardware modules that are detected to
be connected in most cases. However, it is not harmful for modules that will be automatically loaded to be listed.
Modules cannot be loaded twice; they are either loaded or unloaded. Sometimes exotic hardware requires help to load
their drivers.
The modules that need to be loaded during each boot in can be added to /etc/modules-load.d/*.conf files in the format
of one module per line. When extra options are needed for the modules, they should be set in /etc/modprobe.d/*.conf
files instead.
To view all modules available for a specific kernel version, issue the following find command. Do not forget to substitute
"<kernel version>" with the appropriate version of the kernel to search:
root # find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less
3c59x
Filesystem information
Filesystem labels and UUIDs
Both MBR (BIOS) and GPT include support for filesystem labels and filesystem UUIDs. These attributes can be defined in /etc/
fstab as alternatives for the mount command to use when attempting to find and mount block devices. Filesystem labels and
UUIDs are identified by the LABEL and UUID prefix and can be viewed with the blkid command:
root # blkid
Warning
If the filesystem inside a partition is wiped, then the filesystem label and the UUID values will be subsequently altered or
removed.
For uniqueness, readers who are using MBR-style partition tables are advised to use UUIDs rather than labels to specify
mountable volumes in /etc/fstab.
Important
UUIDs of the filesystem on a LVM volume and its LVM snapshots are identical, therefore using UUIDs to mount LVM
volumes should be avoided.
root # blkid
63 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
While not always true for partition labels, using a UUID to identify a partition in fstab provides a guarantee that the
bootloader will not be confused when looking for a certain volume, even if the filesystem is changed or re-written in the future.
Using the older default block device files (/dev/sd*N) for defining the partitions in fstab is risky for systems that have SATA
block devices regularly added or removed.
The naming for block device files depends on a number of factors, including how and in what order the disks are attached to
the system. They also could show up in a different order depending on which of the devices are detected by the kernel first
during the early boot process. With this being stated, unless the system administrator intends to constantly fiddle with the
disk ordering, using default block device files is a simple and straightforward approach.
About fstab
Under Linux, all partitions used by the system must be listed in /etc/fstab (/wiki//etc/fstab). This file contains the
mount points of those partitions (where they are seen in the file system structure), how they should be mounted and with
what special options (automatically or not, whether users can mount them or not, etc.)
If the init system being used is systemd, the partition UUIDs conform to the Discoverable Partition Specification as given
in Preparing the disks (/wiki/Handbook:AMD64/Installation/Disks), and the system uses UEFI, then creating an fstab can
be skipped, since systemd auto-mounts partitions that follow the spec.
The /etc/fstab file uses a table-like syntax. Every line consists of six fields, separated by whitespace (space(s), tabs, or a
mixture of the two). Each field has its own meaning:
1. The first field shows the block special device or remote filesystem to be mounted. Several kinds of device identifiers are
available for block special device nodes, including paths to device files, filesystem labels and UUIDs, and partition labels
and UUIDs.
2. The second field shows the mount point at which the partition should be mounted.
3. The third field shows the type of filesystem used by the partition.
4. The fourth field shows the mount options used by mount when it wants to mount the partition. As every filesystem has
its own mount options, so system admins are encouraged to read the mount man page (man mount) for a full listing.
Multiple mount options are comma-separated.
5. The fifth field is used by dump to determine if the partition needs to be dumped or not. This can generally be left as 0
(zero).
6. The sixth field is used by fsck to determine the order in which filesystems should be checked if the system wasn't shut
down properly. The root filesystem should have 1 while the rest should have 2 (or 0 if a filesystem check is not
necessary).
Important
The default /etc/fstab file provided in Gentoo stage files is not a valid fstab file but instead a template that can be
used to enter in relevant values.
# Adjust for any formatting differences and/or additional partitions created from the "Preparing the d
isks" step
/dev/sda1 /boot xfs defaults 0 2
Some system administrators want the /boot partition to not be mounted automatically to improve their system's security.
Those people should substitute the defaults with noauto . This does mean that those users will need to manually mount
this partition every time they want to use it.
64 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
# Adjust for any formatting differences and/or additional partitions created from the "Preparing the d
isks" step
/dev/sda1 /boot xfs defaults 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / xfs defaults,noatime 0 1
UEFI systems
Below is an example of an /etc/fstab file for a system that will boot via UEFI firmware:
# Adjust for any formatting differences and/or additional partitions created from the "Preparing the d
isks" step
/dev/sda1 /efi vfat umask=0077 0 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / xfs defaults,noatime 0 1
# Adjust any formatting difference and additional partitions created from the "Preparing the disks" st
ep.
# This example shows a GPT disklabel with Discoverable Partition Specification (DSP) UUID set:
PARTUUID=c12a7328-f81f-11d2-ba4b-00a0c93ec93b /efi vfat umask=0077 0 2
PARTUUID=0657fd6d-a4ab-43c4-84e5-0933c84b4f4f none swap sw 0 0
PARTUUID=4f68bce3-e8cd-4db1-96e7-fbcaf984b709 / xfs defaults,noatime 0 1
When auto is used in the third field, it makes the mount command guess what the filesystem would be. This is recommended
for removable media as they can be created with one of many filesystems. The user option in the fourth field makes it
possible for non-root users to mount the CD.
To improve performance, most users would want to add the noatime mount option, which results in a faster system since
access times are not registered (those are not needed generally anyway). This is also recommended for systems with solid
state drives (SSDs). Users may wish to consider lazytime instead.
Tip
Due to degradation in performance, defining the discard mount option in /etc/fstab is not recommended. It is
generally better to schedule block discards on a periodic basis using a job scheduler such as cron or a timer (systemd).
See Periodic fstrim jobs (/wiki/SSD#Periodic_fstrim_jobs) for more information.
Networking information
It is important to note the following sections are provided to help the reader quickly setup their system to partake in a local
area network.
For systems running OpenRC, a more detailed reference for network setup is available in the advanced network configuration
(/wiki/Handbook:AMD64/Networking/Introduction) section, which is covered near the end of the handbook. Systems with
more specific network needs may need to skip ahead, then return here to continue with the rest of the installation.
65 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
For more specific systemd network setup, please review see the networking portion (/wiki/Systemd#Network) of the systemd
(/wiki/Systemd) article.
Hostname
One of the choices the system administrator has to make is name their PC. This seems to be quite easy, but lots of users are
having difficulties finding the appropriate name for the hostname. To speed things up, know that the decision is not final - it
can be changed afterwards. In the examples below, the hostname tux is used.
systemd
To set the system hostname for a system currently running systemd, the hostnamectl utility may be used. During the
installation process however, systemd-firstboot (/wiki/Handbook:AMD64/Installation/
System#Init_and_boot_configuration_systemd) command must be used instead (see later on in handbook).
For setting the hostname to "tux", one would run:
Network
There are many options available for configuring network interfaces. This section covers a only a few methods. Choose the
one which seems best suited to the setup needed.
netifrc (OpenRC)
Tip
This is one particular way of setting up the network using Netifrc (/wiki/Netifrc) on OpenRC. Other methods exist for
simpler setups like Dhcpcd (/wiki/Dhcpcd).
Note
More detailed information about networking, including advanced topics like bonding, bridging, 802.1Q VLANs or wireless
networking is covered in the advanced network configuration (/wiki/Handbook:AMD64/Networking/Introduction) section.
All networking information is gathered in /etc/conf.d/net. It uses a straightforward - yet perhaps not intuitive - syntax. Do
not fear! Everything is explained below. A fully commented example that covers many different configurations is available in /
usr/share/doc/netifrc-*/net.example.bz2.
66 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Set both config_eth0 and routes_eth0 to enter IP address information and routing information:
Note
This assumes that the network interface will be called eth0. This is, however, very system dependent. It is recommended
to assume that the interface is named the same as the interface name when booted from the installation media if the
installation media is sufficiently recent. More information can be found in the Network interface naming (/wiki/
Handbook:AMD64/Networking/Advanced#Network_interface_naming) section.
config_eth0="dhcp"
Please read /usr/share/doc/netifrc-*/net.example.bz2 for a list of additional configuration options. Be sure to also
read up on the DHCP client man page if specific DHCP options need to be set.
If the system has several network interfaces, then repeat the above steps for config_eth1, config_eth2, etc.
Now save the configuration and exit to continue.
Automatically start networking at boot
To have the network interfaces activated at boot, they need to be added to the default runlevel.
root # cd /etc/init.d
root # ln -s net.lo net.eth0
root # rc-update add net.eth0 default
If the system has several network interfaces, then the appropriate net.* files need to be created just like we did with
net.eth0.
If, after booting the system, it is discovered the network interface name (which is currently documented as eth0 ) was wrong,
then execute the following steps to rectify:
1. Update the /etc/conf.d/net file with the correct interface name (like enp3s0 or enp5s0 , instead of eth0 ).
2. Create new symbolic link (like /etc/init.d/net.enp3s0).
3. Remove the old symbolic link (rm /etc/init.d/net.eth0).
4. Add the new one to the default runlevel.
5. Remove the old one using rc-update del net.eth0 default.
System information
Root password
Set the root password using the passwd command.
root # passwd
67 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Later an additional regular user account will be created for daily operations.
systemd
First, it is recommended to run systemd-machine-id-setup and then systemd-firstboot which will prepare various
components of the system are set correctly for the first boot into the new systemd environment. The passing the following
options will include a prompt for the user to set a locale, timezone, hostname, root password, and root shell values. It will also
assign a random machine ID to the installation:
root # systemd-machine-id-setup
root # systemd-firstboot --prompt
Next users should run systemctl to reset all installed unit files to the preset policy values:
System logger
OpenRC
Some tools are missing from the stage3 archive because several packages provide the same functionality. It is now up to the
user to choose which ones to install.
The first tool to decision is a logging mechanism for the system. Unix and Linux have an excellent history of logging
capabilities - if needed, everything that happens on the system can be logged in a log file.
Gentoo offers several system logger utilities. A few of these include:
There may be other system logging utilities available through the Gentoo ebuild repository as well, since the number of
available packages increases on a daily basis.
68 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Tip
If syslog-ng is going to be used, it is recommended to install and configure logrotate (/wiki/Logrotate). syslog-ng does not
provide any rotation mechanism for the log files. Newer versions (>= 2.0) of sysklogd however handle their own log
rotation.
To install the system logger of choice, emerge it. On OpenRC, add it to the default runlevel using rc-update. The following
example installs and activates app-admin/sysklogd (https://packages.gentoo.org/packages/app-admin/sysklogd) as the
system's syslog utility:
systemd
While a selection of logging mechanisms are presented for OpenRC-based systems, systemd includes a built-in logger called
the systemd-journald service. The systemd-journald service is capable of handling most of the logging functionality outlined
in the previous system logger section. That is to say, the majority of installations that will run systemd as the system and
service manager can safely skip adding a additional syslog utilities.
See man journalctl for more details on using journalctl to query and review the systems logs.
For a number of reasons, such as the case of forwarding logs to a central host, it may be important to include redundant
system logging mechanisms on a systemd-based system. This is a irregular occurrence for the handbook's typical audience
and considered an advanced use case. It is therefore not covered by the handbook.
Default: cronie
The following example uses sys-process/cronie (https://packages.gentoo.org/packages/sys-process/cronie) :
Alternative: dcron
root # emerge --ask sys-process/dcron
If dcron is the go forward cron agent, an additional initialization command needs to be executed:
Alternative: fcron
root # emerge --ask sys-process/fcron
If fcron is the selected scheduled task handler, an additional emerge step is required:
Alternative: bcron
69 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
systemd
Similar to system logging, systemd-based systems include support for scheduled tasks out-of-the-box in the form of timers.
systemd timers can run at a system-level or a user-level and include the same functionality that a traditional cron daemon
would provide. Unless redundant capabilities are necessary, installing an additional task scheduler such as a cron daemon is
generally unnecessary and can be safely skipped.
To be able to access the system remotely after installation, sshd must be configured to start on boot.
For more in-depth details on the configuration of SSH, refer to the SSH (/wiki/SSH) article.
OpenRC
To add the sshd init script to the default runlevel on OpenRC:
# SERIAL CONSOLES
s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
systemd
To enable the SSH server, run:
70 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
OpenRC
On OpenRC, run:
systemd
On systemd, run:
Filesystem tools
Depending on the filesystems used, it may be necessary to install the required file system utilities (for checking the filesystem
integrity, (re)formatting file systems, etc.). Note that ext4 user space tools
(sys-fs/e2fsprogs (https://packages.gentoo.org/packages/sys-fs/e2fsprogs) ) are already installed as a part of the
@system set (/wiki/System_set_(Portage)).
The following table lists the tools to install if a certain filesystem tools will be needed in the installed environment.
Filesystem Package
Tip
For more information on filesystems in Gentoo see the filesystem article (/wiki/Filesystem).
Networking tools
If networking was previously configured in the Configuring the system (/wiki/Handbook:AMD64/Installation/System) step and
network setup is complete, then this 'networking tools' section can be safely skipped. In this case, proceed with the section on
Configuring a bootloader (/wiki/Handbook:AMD64/Installation/Bootloader).
A DHCP client obtains automatically an IP address for one or more network interface(s) using netifrc scripts. We recommend
the use of net-misc/dhcpcd (https://packages.gentoo.org/packages/net-misc/dhcpcd) (see also dhcpcd (/wiki/Dhcpcd)):
71 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Default: GRUB
By default, the majority of Gentoo systems now rely upon GRUB (/wiki/GRUB) (found in the
sys-boot/grub (https://packages.gentoo.org/packages/sys-boot/grub) package), which is the direct successor to GRUB
Legacy (/wiki/GRUB_Legacy). With no additional configuration, GRUB gladly supports older BIOS ("pc") systems. With a small
amount of configuration, necessary before build time, GRUB can support more than a half a dozen additional platforms. For
more information, consult the Prerequisites section (/wiki/GRUB#Prerequisites) of the GRUB (/wiki/GRUB) article.
Emerge
When using an older BIOS system supporting only MBR partition tables, no additional configuration is needed in order to
emerge GRUB:
Install
Next, install the necessary GRUB files to the /boot/grub/ directory via the grub-install command. Presuming the first disk
(the one where the system boots from) is /dev/sda, one of the following commands will do:
72 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
UEFI systems
Important
Make sure the EFI system partition has been mounted before running grub-install. It is possible for grub-install to
install the GRUB EFI file (grubx64.efi) into the wrong directory without providing any indication the wrong directory
was used.
Upon successful installation, the output should match the output of the previous command. If the output does not match
exactly, then proceed to Debugging GRUB (/wiki/Handbook:AMD64/Blocks/Bootloader#Debugging_GRUB), otherwise jump to
the Configure step (/wiki/Handbook:AMD64/Blocks/Bootloader#GRUB_Configure).
Optional: Secure Boot
To successfully boot with secure boot enabled the signing certificate must either be accepted by the UEFI (/wiki/UEFI)
firmware, or shim (/wiki/Shim) must be used as a pre-loader. Shim is pre-signed with the third-party Microsoft Certificate,
accepted by default by most UEFI motherboards.
How to configure the UEFI firmware to accept custom keys depends on the firmware vendor, which is beyond the scope of the
handbook. Below is shown how to setup shim instead. Here it is assumed that the user has already followed the instructions
in the previous sections to generate a signing key and to configure portage to use it. If this is not the case please return first to
the Kernel installation (/wiki/Handbook:AMD64/Installation/Kernel) section.
The package sys-boot/grub (https://packages.gentoo.org/packages/sys-boot/grub) installs a prebuilt and signed stand-
alone EFI executable if the secureboot (https://packages.gentoo.org/useflags/secureboot) (/wiki/USE_flag)
USE flag is enabled. Install the required packages and copy the stand-alone grub, Shim, and the MokManager to the same
directory on the EFI System Partition. For example:
root # openssl x509 -in /path/to/kernel_key.pem -inform PEM -out /path/to/kernel_key.der -outform DER
Note
The path used here must be the path to the pem file containing the certificate belonging to the generated key. In this
example both key and certificate are in the same pem file.
Then the converted certificate can be imported into Shims MOKlist, this command will ask to set some password for the
import request:
Note
When the currently booted kernel already trusts the certificate being imported, the message "Already in kernel trusted
keyring." will be returned here. If this happens, re-run the above command with the argument --ignore-keyring
added.
Next, register Shim with the UEFI firmware. In the following command, boot-disk and boot-partition-id must be
replaced with the disk and partition identifier of the EFI system partition:
73 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
FILE /etc/env.d/99grub
GRUB_CFG=/efi/EFI/Gentoo/grub.cfg
root # env-update
Note
The import process will not be completed until the system is rebooted. After completing all steps in the handbook,
restart the system and Shim will load, it will find the import request registered by mokutil. The MokManager application
will start and ask for the password that was set when creating the import request. Follow the on-screen instructions to
complete the import of the certificate, then reboot the system into the UEFI menu and enable the Secure Boot setting.
Debugging GRUB
When debugging GRUB, there are a couple of quick fixes that may result in a bootable installation without having to reboot to
a new live image environment.
In the event that "EFI variables are not supported on this system" is displayed somewhere in the output, it is likely the live
image was not booted in EFI mode and is presently in Legacy BIOS boot mode. The solution is to try the removable GRUB step
(/wiki/Handbook:AMD64/Blocks/Bootloader#GRUB_Install_EFI_systems_removable) mentioned below. This will overwrite the
executable EFI file located at /EFI/BOOT/BOOTX64.EFI. Upon rebooting in EFI mode, the motherboard firmware may execute
this default boot entry and execute GRUB.
If grub-install returns an error that says "Could not prepare Boot variable: Read-only file system", and the live environment
was correctly booted in UEFI mode, then it should be possible to remount the efivars special mount as read-write and then re-
run the aforementioned grub-install command (/wiki/Handbook:AMD64/Blocks/
Bootloader#GRUB_Install_EFI_systems_command):
Configure
Next, generate the GRUB configuration based on the user configuration specified in the /etc/default/grub file and /etc/
grub.d scripts. In most cases, no configuration is needed by users as GRUB will automatically detect which kernel to boot (the
highest one available in /boot/) and what the root file system is. It is also possible to append kernel parameters in /etc/
default/grub using the GRUB_CMDLINE_LINUX variable.
The output of the command must mention that at least one Linux image is found, as those are needed to boot the system. If
an initramfs is used or genkernel was used to build the kernel, the correct initrd image should be detected as well. If this is
not the case, go to /boot/ and check the contents using the ls command. If the files are indeed missing, go back to the
kernel configuration and installation instructions.
Tip
The os-prober utility can be used in conjunction with GRUB to detect other operating systems from attached drives.
Windows 7, 8.1, 10, and other distributions of Linux are detectable. Those desiring dual boot systems should emerge the
sys-boot/os-prober (https://packages.gentoo.org/packages/sys-boot/os-prober) package then re-run the grub-
mkconfig command (as seen above). If detection problems are encountered be sure to read the GRUB (/wiki/GRUB)
article in its entirety before asking the Gentoo community for support.
74 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Alternative 1: systemd-boot
Another option is systemd-boot (/wiki/Systemd/systemd-boot), which works on both OpenRC and systemd machines. It is a
thin chainloader and works well with secure boot.
Emerge
To install systemd-boot, enable the boot (https://packages.gentoo.org/useflags/boot) (/wiki/USE_flag) USE
flag and re-install sys-apps/systemd (https://packages.gentoo.org/packages/sys-apps/systemd) (for systemd systems) or
sys-apps/systemd-utils (https://packages.gentoo.org/packages/sys-apps/systemd-utils) (for OpenRC systems):
FILE /etc/portage/package.use/systemd-boot
sys-apps/systemd boot
sys-apps/systemd-utils boot
Installation
Now, install the systemd-boot loader to the EFI System Partition (/wiki/EFI_System_Partition):
Important
Make sure the EFI system partition has been mounted before running bootctl install.
When using this bootloader, before rebooting, verify that a new bootable entry exists using:
Warning
The kernel command line for new systemd-boot entries is read from /etc/kernel/cmdline or /usr/lib/kernel/
cmdline. If neither file is present, then the kernel command line of the currently booted kernel is re-used (/proc/
cmdline). On new installs it might therefore happen that the kernel command line of the live CD is accidentally used to
boot the new kernel. The kernel command line for registered entries can be checked with:
root # bootctl list
If this does not show the desired kernel command line then create /etc/kernel/cmdline containing the correct kernel
command line and re-install the kernel.
Important
When installing kernels for systemd-boot, no root= kernel command line argument is added by default. On systemd
systems that are using an initramfs users may rely instead on systemd-gpt-auto-generator (/wiki/
Systemd#Automatic_mounting_of_partitions_at_boot) to automatically find the root partition at boot. Otherwise users
should manually specify the location of the root partition by setting root= in /etc/kernel/cmdline as well as any other
kernel command line arguments that should be used. And then reinstalling the kernel as described above.
75 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
root # openssl x509 -in /path/to/kernel_key.pem -inform PEM -out /path/to/kernel_key.der -outform DER
Note
The path used here must be the path to the pem file containing the certificate belonging to the generated key. In this
example both key and certificate are in the same pem file.
Note
When the currently booted kernel already trusts the certificate being imported, the message "Already in kernel trusted
keyring." will be returned here. If this happens, re-run the above command with the argument --ignore-keyring
added.
And finally we register Shim with the UEFI firmware. In the following command, boot-disk and boot-partition-id must be
replaced with the disk and partition identifier of the EFI system partition:
Note
The import process will not be completed until the system is rebooted. After completing all steps in the handbook,
restart the system and Shim will load, it will find the import request registered by mokutil. The MokManager application
will start and ask for the password that was set when creating the import request. Follow the on-screen instructions to
complete the import of the certificate, then reboot the system into the UEFI menu and enable the Secure Boot setting.
Note
To reiterate, efibootmgr is not a requirement to boot an UEFI system; it is merely necessary to add an entry for an EFI-
stub kernel into the UEFI firmware. When built appropriately with EFI stub support, the Linux kernel itself can be booted
directly. Additional kernel command-line options can be built-in to the Linux kernel (there is a kernel configuration option
called CONFIG_CMDLINE. Similarly, support for initramfs can be 'built-in' to the kernel as well.
To boot the kernel directly from the firmware, the kernel image must be present on the EFI System Partition (/wiki/
76 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
FILE /etc/portage/package.accept_keywords/installkernel
sys-kernel/installkernel
sys-boot/uefi-mkconfig
app-emulation/virt-firmware
FILE /etc/portage/package.use/installkernel
sys-kernel/installkernel efistub
Then reinstall installkernel (/wiki/Installkernel), create the /efi/EFI/Gentoo directory and reinstall the kernel:
root # efibootmgr --create --disk /dev/sda --part 1 --label "gentoo" --loader "\EFI\Gentoo\bzImage.efi"
Note
The use of a backslash ( \ ) as directory path separator is mandatory when using UEFI definitions.
If an initial RAM file system (initramfs) is used, copy it to the EFI System Partition as well, then add the proper boot option to it:
root # efibootmgr --create --disk /dev/sda --part 1 --label "gentoo" --loader "\EFI\Gentoo\bzImage.efi" --
unicode "initrd=\EFI\Gentoo\initramfs.img"
Tip
Additional kernel command line options may be parsed by the firmware to the kernel by specifying them along with the
initrd=... option as shown above.
With these changes done, when the system reboots, a boot entry called "gentoo" will be available.
root # efibootmgr --create --disk /dev/sda --part 1 --label "gentoo" --loader "\EFI\Linux\gentoo-x.y.z.efi"
Other Alternatives
For other options that are not covered in the Handbook, see the full list of available bootloaders (/wiki/Bootloader).
77 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
User administration
Adding a user for daily use
Working as root on a Unix/Linux system is dangerous and should be avoided as much as possible. Therefore it is strongly
recommended to add one or more standard user account(s) for day-to-day use.
The groups the user is member of define what activities the user can perform. The following table lists a number of important
groups:
Group Description
cron Enable the user account to access time-based job scheduling via cron. Note: user accounts
on systems running the systemd service system can use systemd timers and user service
files instead of cron jobs.
floppy Enable the user account to directly access ancient mechanical devices known as floppy
drives. This group is not generally used on modern systems.
video Enables the user account to access video capturing hardware and hardware acceleration.
wheel Enables the user account able to use the su (substitute user) command, which allows
switching to the root account or other accounts. For single user systems that include a root
account, it is a good idea to add this group for the primary standard user.
For instance, to create a user called larry (/wiki/User:Larry) who is a member of the wheel, users, and audio groups, log in as
root first (only root can create users) and run useradd:
Login: root
When setting passwords for standard user accounts, it is good security practice to avoid using the same or a similar password
as set for the root user.
Handbook authors recommended to use a password at least 16 characters in length, with a value fully unique from every
other user on the system.
78 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
To prevent possible threat actors from logging in as root, deleting the root password and/or disabling root login can help
improve security.
To disable root login:
Disk cleanup
Removing installation artifacts
With the Gentoo installation finished and the system rebooted, if everything has gone well, the stage file and other installation
artifacts - such as DIGEST, CONTENT, or *.asc (PGP signature) files - can now be safely removed.
The files are located in the / directory and can be removed with the following command:
root # rm /stage3-*.tar.*
Additional documentation
It is important to note that, due to the number of choices available in Gentoo, the documentation provided by the handbook
is limited in scope - it mainly focuses on the basics of getting a Gentoo system up and running and basic system management
activities. The handbook intentionally excludes instructions on graphical environments, details on hardening, and other
important administrative tasks. That being stated, there are more sections of the handbook to assist readers with more basic
functions.
Readers should definitely take a look at the next part of the handbook entitled Working with Gentoo (/wiki/Handbook:AMD64/
Working/Portage) which explains how to keep the software up to date, install additional software packages, details on USE
flags, the OpenRC init system, and various other informative topics relating to managing a Gentoo system post-installation.
Apart from the handbook, readers should also feel encouraged to explore other corners of the Gentoo wiki to find additional,
community-provided documentation. The Gentoo wiki team also offers a documentation topic overview (/wiki/
Main_Page#Documentation_topics) which lists a selection of wiki articles by category. For instance, it refers to the localization
guide (/wiki/Localization/Guide) to make a system feel more at home (particularly useful for users who speak English as a
second language).
The majority of users with desktop use cases will setup graphical environments in which to work natively. There are many
community maintained 'meta' articles for supported desktop environments (DEs) (/wiki/Desktop_environment) and window
managers (WMs) (/wiki/Window_manager). Readers should be aware that each DE will require slightly different setup steps,
which will lengthen add complexity to bootstrapping.
Many other Meta articles (/wiki/Category:Meta) exist to provide our readers with high level overviews of available software
within Gentoo.
Gentoo online
Important
Readers should note that all official Gentoo sites online are governed by Gentoo's code of conduct (/wiki/Project:Council/
Code_of_conduct). Being active in the Gentoo community is a privilege, not a right, and users should be aware that the
code of conduct exists for a reason.
With the exception of the Libera.Chat hosted internet relay chat (IRC) network and the mailing lists, most Gentoo websites
require an account on a per site basis in order to ask questions, open a discussion, or enter a bug.
79 of 80 2/27/25, 10:52
Gentoo Linux amd64 Handbook: Installing Gentoo - Gento... https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
Mailing lists
Several mailing lists (https://www.gentoo.org/get-involved/mailing-lists/) are available to the community members who prefer
to ask for support or feedback over email rather than create a user account on the forums or IRC. Users will need to follow
the instructions in order to subscribe to specific mailing lists.
Bugs
Sometimes after reviewing the wiki, searching the forums, and seeking support in the IRC channel or mailing lists there is no
known solution to a problem. Generally this is a sign to open a bug on Gentoo's Bugzilla site (https://bugs.gentoo.org).
Development guide
Readers who desire to learn more about developing Gentoo can take a look at the Development guide (https://devmanual.ge
ntoo.org/). This guide provides instructions on writing ebuilds, working with eclasses, and provides definitions for many
general concepts (https://devmanual.gentoo.org/general-concepts/index.html) behind Gentoo development.
Closing thoughts
Gentoo is a robust, flexible, and excellently maintained distribution. The developer community is happy to hear feedback on
how to make Gentoo an even better distribution.
As a reminder, any feedback for this handbook should follow the guidelines detailed in the How do I improve the Handbook? (/
wiki/Handbook:Main_Page#How_do_I_improve_the_Handbook.3F) section at the beginning of the handbook.
We look forward to seeing how our users will choose to implement Gentoo to fit their unique use cases and needs.
80 of 80 2/27/25, 10:52