User:Bugalo/MSI MPG x870E Edge TI Wifi AMD 9950x3d
Summary
This document will serve as a guide on how to install Gentoo on the MSI MPG x870E Edge TI Wifi motherboard with an AMD 9950x3d CPU and the following configuration:
- Single Gentoo boot, in UEFI with GPT mode, using GRUB2 as a boot loader.
- ZFS on all partitions, except the ESP, including root, with native transparent compression and encryption. Deduplication will not be configured:
- Mirrored Zpools for all system partitions. Those will be located in two 4TB NVMe hard drives.
- GNOME with systemd profile.
Installation
Preparing the Ubuntu Live Environment
- Create an Ubuntu bootable USB using, for example using UNetbootin.
- Plug the USB and boot the PC.
- Access the One-time boot menu of the BIOS by pressing F2.
- Choose the appropriate entry to boot from the live USB.
- In the GRUB menu, choose Try Ubuntu without installing.
- Connect to the internet, through either a wireless[1] or wired network[2].
- Upgrade Ubuntu to use the latest ZFS modules availabe.
root #
apt-get update
root #
apt-get upgrade
- Verify that ZFS is loaded
user $
dmesg | grep -i zfs
[ 9.658459] ZFS: Loaded module v0.8.1-1ubuntu12, ZFS pool version 5000, ZFS filesystem version 5
- Create a folder for the Gentoo install.
root #
mkdir /mnt/gentoo
- Install the text editor of your choice, e.g. Vim.
root #
apt-get install vim
Important
This guide uses Vim as a text editor. Feel free to substitute it by your preferred editor.
Create the ZFS layout
All the partitions of the system will use the ZFS filesystem. ZFS allows the use of whole disks, without partitioning, to install the different parts of the system. In this case, the whole disk would be a ZFS pool, and we would create different ZFS datasets in it that would be conceptually similar to traditional partitions, but they don't need to have a fixed predetermined size. However, the choice of GRUB2 as a boot manager requires partitioning the disk, i.e a ZFS pool needs to be created in a partition, not in the whole disk. GRUB2 cannot currently reside in a ZFS pool with advanced features activated, such as encryption[3]. In order to satisfy both requirements of using GRUB2 as a boot loader and having the system residing in ZFS with native encryption, we need to create a ZFS pool compatible with GRUB2. Furthermore, a FAT formatted EFI System Partition needs to be created.
- Open GParted.
- Select the device
/dev/nvme0n1
. - Go to Device / Create Partition Table ... / gpt / Apply.
- Select the device
/dev/nvme1n1
. - Go to Device / Create Partition Table ... / gpt / Apply.
- Delete any partition of the NVMe drives
/dev/nvme0n1
and/dev/nvme1n1
. - Create two new partitions,
/dev/nvme0n1p1
and/dev/nvme1n1p1
, in the unallocated space, formatted in FAT32, named "EFI system partition" and "EFI system partition 2" respectively, with labels ESP and ESP_2, of 128MB, and with flags "boot" and "esp". - Create two unformatted partitions,
/dev/nvme0n1p2
and/dev/nvme1n1p2
, in the unallocated space, named Gentoo-Boot and Gentoo-Boot-2, of around 1GB. - Create two unformatted partitions,
/dev/nvme0n1p3
and/dev/nvme1n1p3
, in the unallocated space, named Gentoo-Root and Gentoo-Root-2, occupying the remaining space. - Apply all operations and exit.
- Create a mirror ZFS pool, with all GRUB's unsupported features disabled, in
/dev/nvme0n1p2
and/dev/nvme1n1p2
.root #
zpool create -d -o feature@allocation_classes=enabled \
-o feature@async_destroy=enabled \
-o feature@bookmarks=enabled \
-o feature@embedded_data=enabled \
-o feature@empty_bpobj=enabled \
-o feature@enabled_txg=enabled \
-o feature@extensible_dataset=enabled \
-o feature@filesystem_limits=enabled \
-o feature@hole_birth=enabled \
-o feature@large_blocks=enabled \
-o feature@lz4_compress=enabled \
-o feature@project_quota=enabled \
-o feature@resilver_defer=enabled \
-o feature@spacemap_histogram=enabled \
-o feature@spacemap_v2=enabled \
-o feature@userobj_accounting=enabled \
-o feature@zpool_checkpoint=enabled \
-f -o ashift=12 \
-o autotrim=on \
-o cachefile=/tmp/zpool.cache \
-O aclinherit=passthrough \
-O acltype=posixacl \
-O atime=off \
-O canmount=off \
-O devices=off \
-O mountpoint=/ \
-O normalization=formD \
-O xattr=sa \
-R /mnt/gentoo \
bpool mirror /dev/nvme0n1p2 /dev/nvme1n1p2
- Create a mirror ZFS pool, for the Gentoo system, in
/dev/nvme0n1p3
and/dev/nvme1n1p3
.root #
zpool create -f -o ashift=12 \
-o autotrim=on \
-o cachefile=/tmp/zpool.cache \
-O acltype=posixacl \
-O aclinherit=passthrough \
-O atime=off \
-O canmount=off \
-O devices=off \
-O dnodesize=auto \
-O mountpoint=/ \
-O normalization=formD \
-O xattr=sa \
-R /mnt/gentoo \
rpool mirror /dev/nvme0n1p3 /dev/nvme1n1p3
- The status and properties of the pools created above can be checked with the following commands:
root #
zpool status
pool: bpool
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(5) for details.
scan: none requested
config:
NAME STATE READ WRITE CKSUM
bpool ONLINE 0 0 0
nvme0n1p4 ONLINE 0 0 0
errors: No known data errors
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
nvme0n1p5 ONLINE 0 0 0
errors: No known data errors
root #
zfs get all bpool
root #
zfs get all rpool
- Create the ZFS dataset where GRUB2 will reside:
root #
zfs create -o canmount=off -o compression=gzip-9 -o mountpoint=none bpool/BOOT
root #
zfs create -o canmount=noauto -o compression=gzip-9 -o dnodesize=legacy -o mountpoint=/mnt/gentoo/boot bpool/BOOT/gentoo
Important
The LZ4 compression algorithm is generally favored over Gzip, due to its good balance between compression ratio and computational power required[6]. However, this guide usesgzip-9
as compression algorithm, offering the highest compression level at a higher computational cost. This is due to the availability of a powerful CPU in the system.Warning
At the time of writing this paragraph, Grub does not support booting from a zfs pool compressed with zstd.Warning
Setting here the parameterdnodesize
to anything other thanlegacy
will result in the following error[7]:cannot set property for 'bpool': operation not supported on this type of pool
- Create the ZFS dataset where root will reside:
root #
zfs create -o canmount=off -o compression=zstd-19 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=none rpool/ROOT
root #
zfs create -o canmount=noauto -o compression=zstd-19 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=/mnt/gentoo rpool/ROOT/gentoo
Important
The default mode of operation of ZFS native encryption is aes-256-ccm. However, aes-256-gcm is generally preferred[8].Important
According to various benchmarks, zstd should provide similar or higher compression levels than gzip, but with higher compression and decompression speed. - Create the ZFS dataset where home will reside:
root #
zfs create -o compression=zstd-19 -o encryption=aes-256-gcm -o keyformat=passphrase -o mountpoint=/mnt/gentoo/home rpool/ROOT/home
- Mount all the ZFS datasets : Warning
At the time of writing this paragraph, mounting the datasets withzfs mount
will result in a double preffix (see [9]) and ZFS Chroot. Usemount -t zfs
instedad.root #
zfs set mountpoint=/ rpool
root #
zfs set mountpoint=/ rpool/ROOT/gentoo
root #
zfs set mountpoint=/home rpool/ROOT/home
root #
zfs set mountpoint=/ bpool
root #
zfs set mountpoint=/boot bpool/BOOT/gentoo
root #
mount -t zfs -o zfsutil rpool/ROOT/gentoo /mnt/gentoo
root #
mkdir /mnt/gentoo/home
root #
mount -t zfs -o zfsutil rpool/ROOT/home /mnt/gentoo/home
root #
mkdir /mnt/gentoo/boot
root #
mount -t zfs -o zfsutil bpool/BOOT/gentoo /mnt/gentoo/boot
- Check that the ZFS layout is correct:
root #
zfs list -t all
- Set the ZFS dataset used for booting: Check that the
root #
zpool set bootfs=bpool/BOOT/gentoo bpool
bootfs
property has been properly set:root #
zpool get bootfs bpool
Install the Gentoo base system
This section will closely follow Gentoo's AMD64 Handbook, with adjustments where appropriate.
- Verify that the date and time of the system is correct. If not, fix it:
root #
date
Thu Jan 23 23:35:23 CET 2020
- Choose a stage tarball:
desktop systemd 64-bit stage tarball
. - Move to the root installation directory:
root #
cd /mnt/gentoo/
- Find the name of the latest amd64 systemd stage3 at http://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3-amd64-systemd.txt and download it: Note
Modify the name of the stage3 file appropriately.Tip
The downloaded stage3 file can be verified. - Unpack the stage3 tarball:
root #
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
- Edit make.conf to configure:
- The compile options to optimize compiled code, including the CPU_FLAGS_X86[10].
- The global USE variable to specify system-wide package support.
- The ACCEPT_LICENSE variable to select the license group automatically accepted.
root #
vim /mnt/gentoo/etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the CPU_FLAGS_X86, USE and ACCEPT_LICENSE variables for systemwide support... USE="..." CPU_FLAGS_X86="adcx aes avx avx2 bmi bmi2 clflushopt fsgsbase f16c fma fma3 mmx mmxext movbe pclmul popcnt prefetchw rdrnd rdseed sse sse2 sse3 sse4_1 sse4_2 ssse3 xsavec xsaves" ... ACCEPT_LICENSE="*" ...
Tip
A working make.conf for this system can be found here.
- Configure the Gentoo ebuild repository:
root #
mkdir --parents /mnt/gentoo/etc/portage/repos.conf
root #
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
- Copy the DNS info:
root #
cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
- Mount the necessary filesystems:
root #
mount --types proc /proc /mnt/gentoo/proc
root #
mount --rbind /sys /mnt/gentoo/sys
root #
mount --make-rslave /mnt/gentoo/sys
root #
mount --rbind /dev /mnt/gentoo/dev
root #
mount --make-rslave /mnt/gentoo/dev
root #
mount --bind /run /mnt/gentoo/run
root #
mount --make-slave /mnt/gentoo/run
- Copy the zpool.cache to the installation directory:
root #
mkdir -p /mnt/gentoo/etc/zfs
root #
cp /tmp/zpool.cache /mnt/gentoo/etc/zfs/zpool.cache
- Copy /etc/hostid, genkernel will later complain if it does not exist[11]:
root #
cp /etc/hostid /mnt/gentoo/etc/hostid
- Chroot into the new environment:
root #
chroot /mnt/gentoo /bin/bash
root #
source /etc/profile
root #
export PS1="(chroot) ${PS1}"
- Update the Gentoo ebuild repository:
(chroot) root #
emerge --sync --quiet
(chroot) root #
eselect news list
(chroot) root #
eselect news read
(chroot) root #
eselect news purge
- Choose the appropriate portage profile:
(chroot) root #
eselect profile list
(chroot) root #
eselect profile set default/linux/amd64/23.0/desktop/gnome/systemd
- Select fast mirrors available for source code download, by using mirrorselect:
(chroot) root #
emerge --ask app-portage/mirrorselect
(chroot) root #
mirrorselect -s4 -b10 -D
- Emerge Vim to be used as a text editor:
(chroot) root #
echo "app-editors/vim ~amd64" >> /etc/portage/package.accept_keywords/vim
(chroot) root #
echo "app-editors/vim-core ~amd64" >> /etc/portage/package.accept_keywords/vim-core
(chroot) root #
echo "app-editors/gvim ~amd64" >> /etc/portage/package.accept_keywords/gvim
(chroot) root #
emerge --ask app-editors/vim app-editors/gvim
- Set Vim to be used as the default text editor:
(chroot) root #
eselect editor list
(chroot) root #
eselect editor set vim
(chroot) root #
eselect editor list
- Set the timezone and reconfigure the sys-libs/timezone-data:
(chroot) root #
ls /usr/share/zoneinfo
(chroot) root #
echo "Europe/Madrid" > /etc/timezone
(chroot) root #
emerge --config sys-libs/timezone-data
- Configure the locales to use, at leaset, one UTF-8 locale:
- Edit /etc/locale.gen: and uncomment the line referencing
(chroot) root #
vim /etc/locale.gen
en_US.UTF-8 UTF-8
:FILE/etc/locale.gen
Adding an UTF-8 locale... en_US.UTF-8 UTF-8 ...
- Generate the locales:
(chroot) root #
locale-gen
(chroot) root #
eselect locale list
(chroot) root #
eselect locale set en_US.utf8
- Reload the environment:
(chroot) root #
env-update && source /etc/profile && export PS1="(chroot) ${PS1}"
- Edit /etc/locale.gen:
- Unmask the latest versions of sys-fs/zfs and sys-fs/zfs-kmod:
(chroot) root #
echo "sys-fs/zfs ~amd64" >> /etc/portage/package.accept_keywords/zfs
(chroot) root #
echo "sys-fs/zfs-kmod ~amd64" >> /etc/portage/package.accept_keywords/zfs-kmod
Note
ZFSOnLinux is under very active development, and the latest versions provide bug fixes and implement new interesting features, e.g zfs-0.8.0 introduced native encryption, support for TRIM in SSDs, etc[12].Important
Versions of sys-fs/zfs lower than 0.8.0 depend on sys-kernel/spl. However, as of version 0.8.0, this dependency has been removed.[12]. - Unmask the latest versions of sys-boot/grub and add ZFS support:
(chroot) root #
echo "sys-boot/grub ~amd64" >> /etc/portage/package.accept_keywords/grub
(chroot) root #
echo "sys-boot/grub libzfs" > /etc/portage/package.use/grub
- Update the world set:
(chroot) root #
emerge -auvDN @world
Configuring, building and installing the Linux kernel
- Unmask a suitable kernel version:
(chroot) root #
echo "sys-kernel/gentoo-sources ~amd64" >> /etc/portage/package.accept_keywords/gentoo-sources
Warning
At the time of writing this, ZFS 2.3.2 is not compatible with kernel versions 6.15.0 and above. Mask the incompatible kernel versions:(chroot) root #
echo ">=sys-kernel/gentoo-sources-6.15.0" >> /etc/portage/package.mask/gentoo-sources
- Emerge sys-kernel/gentoo-sources with the
experimental
USE flag to expose theAMD Zen 5
processor family type:(chroot) root #
echo "sys-kernel/gentoo-sources experimental" >> /etc/portage/package.use/gentoo-sources
- Install the kernel and genkernel:
(chroot) root #
emerge -auvDN sys-kernel/gentoo-sources sys-kernel/genkernel
- Add compression support to sys-apps/kmod in order to be able to load compressed modules:
(chroot) root #
echo "sys-apps/kmod lzma zlib" >> /etc/portage/package.use/kmod
(chroot) root #
emerge -auvDN sys-apps/kmod
- Configure the kernel:
(chroot) root #
eselect kernel list
(chroot) root #
eselect kernel set 2
(chroot) root #
cd /usr/src/linux
(chroot) root #
make menuconfig
- Enable Firmware loading support: KERNEL Enable support for Linux firmware
Device Drivers ---> Generic Driver Options ---> Firmware loader ---> -*- Firmware loading facility () Build named firmware blobs into the kernel binary [*] Enable compressed firmware support [*] Enable XZ-compressed firmware support [*] Enable ZSTD-compressed firmware support
- Gentoo-specific configuration options: KERNEL Gentoo-specific configuration options
Gentoo Linux ---> [*] Gentoo Linux support [*] Linux dynamic and persistent device naming (userspace devfs) support [*] Select options required by Portage features Support for init systems, system and service managers ---> [ ] OpenRC, runit and other script based systems and managers [*] systemd
- Architecture specific kernel configuration: KERNEL Selecting processor types and features
General setup ---> [*] Core Scheduling for SMT Processor type and features ---> [*] x86 CPU resource control support [*] MTRR cleanup support (1) MTRR cleanup enable value (0-1) [*] Support x2apic [*] AMD ACPI2Platform devices support [*] Supported processor vendors ---> [*] Support AMD processors [*] Machine Check / overheating reporting [*] AMD MCE features Processor family (Core 2/newer Xeon) ---> (X) AMD Zen 5 Performance monitoring ---> <*> Intel/AMD rapl performance events <*> AMD Processor Power Reporting Mechanism <*> AMD Uncore performance events [ ] AMD Zen3 Branch Sampling support Power management and ACPI options ---> CPU Frequency scaling ---> Default CPUFreq governor (schedutil) ---> -*- AMD Processor P-State driver <*> ACPI Processor P-States driver [*] Legacy cpb sysfs knob support for AMD CPUs < > AMD Opteron/Athlon64 PowerNow! <*> AMD frequency sensitivity feedback powersave bias Device Drivers ---> Generic Driver Options ---> Firmware loader ---> [*] Firmware loading facility (amd-ucode/microcode_amd_fam19h.bin) External firmware blobs to build into the kernel binary (/lib/firmware) Firware blobs root directory [*] Hardware Monitoring support ---> <*> AMD Family 10h+ temperature sensor [*] IOMMU Hardware Support ---> [*] AMD IOMMU support [*] Hardware Monitoring support ---> [*] Hard disk drives with temperature sensors Binary Emulations ---> [*] IA32 Emulation Memory Management options ---> [*] Transparent Hugepage Support ---> Transparent Hugepage Support sysfs defaults (madvise) ---> [*] Multi-Gen LRU [*] Enable by default Cryptographic API ---> CRCs (cyclic redundancy checks) ---> [*] CRC32c <*> CRC32
- Enable Hyper-Threading support: KERNEL Configuration for multi-processing support
Processor type and features ---> [*] Symmetric multi-processing support [*] SMT (Hyperthreading) scheduler support [*] Multi-core scheduler support
KERNEL Power management for multi-processor systemsPower management and ACPI options ---> [*] ACPI (Advanced Configuration and Power Interface) Support
- Enable CPU CCD core selection: KERNEL Configuration for CCD core selection
Device Drivers ---> -*- X86 Platform Specific Device Drivers ---> <*> AMD 3D V-Cache Performance Optimizer Driver
- Various chipset drivers: KERNEL Additional chipset drivers
Device Drivers ---> I2C support ---> I2C Hardware Bus Support ---> <*> Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC) [*] Pin Controllers ---> [*] AMD GPIO pin control [*] GPIO Support ---> Memory mapped GPIO drivers ---> <*> AMD Promontory GPIO support [*] X86 Platform Specific Device Drivers ---> <*> AMD SoC PMC driver <*> AMD 3D V-Cache Performance Optimizer Driver [*] AMD Wifi RF Band mitigations (WBRF) [*] Cryptographic API ---> [*] Hardware crypto devices ---> [*] Support for AMD Secure Processor [*] Cryptographic Coprocessor device <*> Encryption and hashing offload support <*> Secure Processor device driver <*> Platform Security Processor (PSP) device
- Enable SATA support, needed if using a SATA hard drive; SCSI, needed for SATA devices, USB external hard drives and optical drives, etc.: KERNEL Configuration options for SCSI support
Device Drivers ---> SCSI device support ---> -*- SCSI device support <*> SCSI disk support <*> SCSI CDROM support <*> SCSI generic support [ ] SCSI low-level drivers ---> <*> Serial ATA and Parallel ATA drivers (libata) ---> [*] ATA ACPI Support [*] SATA Port Multiplier support <*> AHCI SATA support (ahci) [*] ATA BMDMA support [*] ATA SFF support (for legacy IDE and PATA) < > Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support (ata_piix) < > AMD/NVidia PATA support
- Enable NVMe device support: KERNEL Configuration for NVMe support
Device Drivers ---> NVME Support ---> <*> NVM Express block device [*] NVMe multipath support [*] NVMe hardware monitoring <M> NVM Express over Fabrics FC host driver <M> NVM Express over Fabrics TCP host driver
- Enable compressed kernel modules: Warning
I have not been able to boot from a ZFS system with compressed modules enabled, although it should be entirely possible. Use at your own risk.KERNEL Enable module compression[*] Enable loadable module support ---> [*] Compress modules on installation Compression algorithm (XZ) ---> ( ) GZIP (X) XZ
- Enable devtmpfs support: KERNEL Enabling devtmpfs support
Device Drivers ---> Generic Driver Options ---> [*] Maintain a devtmpfs filesystem to mount at /dev [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs
- Enable support for the filesystems used: KERNEL Selecting necessary file systems
File systems ---> < > Second extended fs support < > The Extended 3 (ext3) filesystem <*> The Extended 4 (ext4) filesystem [*] Use ext4 for ext2 file systems < > Reiserfs support < > JFS filesystem support < > XFS filesystem support < > GFS2 file system support < > Btrfs filesystem support < > NILFS2 file system support < > F2FS file system support DOS/FAT/NT Filesystems ---> <*> MSDOS fs support <*> VFAT (Windows-95) fs support <*> exFAT filesystem support <*> NTFS Read-Write file system support [*] activate support of external compressions lzx/xpress Pseudo Filesystems ---> -*- /proc file system support -*- Tmpfs virtual memory file system support (former shm fs)
- Enable support for FUSE: KERNEL Enable support for FUSE
File systems ---> <*> FUSE (Filesystem in Userspace) support
- Enable GPT support: KERNEL Enable support for GPT
-*- Enable the block layer ---> Partition Types ---> [*] Advanced partition selection [*] EFI GUID Partition support
- Enable UEFI support: KERNEL Enable support for UEFI
Processor type and features ---> [*] EFI runtime service support [*] EFI stub support [*] EFI mixed-mode support Firmware Drivers ---> EFI (Extensible Firmware Interface) Support ---> <*> EFI Variable Support via sysfs
- Configure USB support: KERNEL Configuration for USB Host Controller Devices
Device Drivers ---> SCSI device support ---> *** SCSI support type (disk, tape, CD-ROM) *** <*> SCSI disk support < > SCSI tape support <*> SCSI CDROM support <*> SCSI generic support [*] USB support ---> -*- Support for Host-side USB *** USB Host Controller Drivers *** <*> xHCI HCD (USB 3.0) support <*> EHCI HCD (USB 2.0) support <*> OHCI HCD (USB 1.1) support < > UHCI HCD (most Intel and VIA) support <*> USB Mass Storage support <*> Unified support for USB4 and Thunderbolt --->
- Configure USB support for input devices: KERNEL Configuration for USB input devices
Device Drivers ---> HID support ---> -*- HID bus support [*] Battery level reporting for HID devices <*> Generic HID driver USB HID support ---> <*> USB HID transport layer
- Enable USB Type-C and Thunderbolt support: KERNEL PCI Hotplugging
Device Drivers ---> [*] PCI support ---> --- PCI support [*] PCI Express Port Bus support [*] PCI Express Hotplug driver [*] Support for PCI Hotplug ---> [*] ACPI PCI Hotplug driver
- Enable USB audio: KERNEL Enable support for SND_USB_AUDIO
Device Drivers --> <*> Sound card support --> --- Sound card support <*> Advanced Linux Sound Architecture ---> [*] USB sound devices ---> <*> USB Audio/MIDI driver
- Enable systemd support: KERNEL Enable support for Linux firmware
General setup ---> -*- Control Group support ---> --- Control Group support -*- Support for eBPF programs attached to cgroups -*- Namespaces support ---> --- Namespaces support -*- Network namespace [*] Checkpoint/restore support [ ] Enable deprecated sysfs features to support old userspace tools [*] Configure standard kernel features (expert users) ---> --- Configure standard kernel features (expert users) -*- open by fhandle syscalls -*- Enable eventpoll support -*- Enable signalfd() system call -*- Enable timerfd() system call BPF subsystem ---> -*- Enable bpf() system call Processor type and features ---> [*] EFI runtime service support General architecture-dependent options ---> -*- Enable seccomp to safely compute untrusted bytecode Device Drivers ---> Firmware Drivers ---> -*- Export DMI identification via sysfs to userspace Generic Driver Options ---> [*] Support for uevent helper () path to uevent helper -*- Maintain a devtmpfs filesystem to mount at /dev Firmware loader ---> -*- Enable the firmware sysfs fallback mechanism -*- Enable the block layer ---> --- Enable the block layer -*- Block layer SG support v4 helper lib Partition Types ---> [*] Advanced partition selection [*] EFI GUID Partition support IO Schedulers ---> <*> BFQ I/O scheduler [*] BFQ hierarchical scheduling support (NEW) -*- Networking support ---> --- Networking support Networking options ---> -*- The IPv6 protocol ---> [*] Unix domain sockets File systems ---> -*- Inotify support for userspace -*- Kernel automounter support (supports v3, v4 and v5) Pseudo filesystems ---> -*- /proc file system support -*- sysfs file system support -*- Tmpfs virtual memory file system support (former shm fs) -*- Tmpfs POSIX Access Control Lists -*- Tmpfs extended attributes Gentoo Linux ---> Support for init systems, system and service managers ---> [ ] OpenRC, runit and other script based systems and managers [*] systemd
- Configure the AMD graphics: KERNEL Configuration for AMD graphics
Processor type and features ---> [*] MTRR (Memory Type Range Register) support Memory Management options ---> [*] Memory hotplug ---> [*] Allow for memory hot remove [*] Device memory (pmem, HMM, etc...) hotplug support [*] Unaddressable device memory (GPU memory, ...) Device Drivers ---> Graphics support ---> <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> Supported DRM clients ---> [*] Enable legacy fbdev support for your modesetting driver < > ATI Radeon <M> AMD GPU [ ] Enable amdgpu support for SI parts (only needed for Southern Islands GPUs with the amdgpu driver) [ ] Enable amdgpu support for CIK parts (only needed for Sea Islands GPUs with the amdgpu driver) ACP (Audio CoProcessor) Configuration ---> [*] Enable AMD Audio CoProcessor IP support (only needed for APUs) Display Engine Configuration ---> [*] AMD DC - Enable new display engine [ ] DC support for Polaris and older ASICs (only needed for Polaris, Carrizo, Tonga, Bonaire, Hawaii) [ ] AMD FBC - Enable Frame Buffer Compression [ ] DCN 1.0 Raven family (only needed for Vega RX as part of Raven Ridge APUs) [ ] DCN 3.0 family (only needed for NAVI21/Sienna Cichlid GPUs with the amdgpu driver) [*] HSA kernel driver for AMD GPU devices [*] Enable HMM-based shared virtual memory manager <*> Sound card support ---> <*> Advanced Linux Sound Architecture ---> [*] PCI sound devices ---> HD-Audio ---> <*> HD Audio PCI [*] Support initialization patch loading for HD-audio <*> Build HDMI/DisplayPort HD-audio codec support (2048) Pre-allocated buffer size for HD-audio driver
- Configure the Xorg support: KERNEL Enabling evdev in the kernel
Device Drivers ---> Input device support ---> <*> Event interface
KERNEL Disable legacy framebuffer support and enable basic console FB supportDevice Drivers ---> Graphics support ---> Frame Buffer Devices ---> -*- Support for frame buffer devices ---> --- Support for frame buffer devices *** Frame buffer hardware drivers *** ## (Disable all other drivers, including VGA, Intel, NVIDIA, and ATI) [*] Simple framebuffer support [*] EFI-based Framebuffer Support Console display driver support ---> [*] Framebuffer Console Support
- Configure the Wifi support: KERNEL Enabling IEEE 802.11 support
'"`UNIQ--pre-0000009B-QINU`"''"`UNIQ--pre-0000009C-QINU`"''"`UNIQ--pre-0000009D-QINU`"''"`UNIQ--pre-0000009E-QINU`"''"`UNIQ--pre-0000009F-QINU`"''"`UNIQ--pre-000000A0-QINU`"''"`UNIQ--pre-000000A1-QINU`"''"`UNIQ--pre-000000A2-QINU`"''"`UNIQ--pre-000000A3-QINU`"''"`UNIQ--pre-000000A4-QINU`"''"`UNIQ--pre-000000A5-QINU`"''"`UNIQ--pre-000000A6-QINU`"''"`UNIQ--pre-000000A7-QINU`"''"`UNIQ--pre-000000A8-QINU`"''"`UNIQ--pre-000000A9-QINU`"''"`UNIQ--pre-000000AA-QINU`"''"`UNIQ--pre-000000AB-QINU`"''"`UNIQ--pre-000000AC-QINU`"''"`UNIQ--pre-000000AD-QINU`"''"`UNIQ--pre-000000AE-QINU`"''"`UNIQ--pre-000000AF-QINU`"'
KERNEL Configure the iwlwifi module'"`UNIQ--pre-000000B2-QINU`"''"`UNIQ--pre-000000B3-QINU`"''"`UNIQ--pre-000000B4-QINU`"''"`UNIQ--pre-000000B5-QINU`"''"`UNIQ--pre-000000B6-QINU`"''"`UNIQ--pre-000000B7-QINU`"''"`UNIQ--pre-000000B8-QINU`"''"`UNIQ--pre-000000B9-QINU`"''"`UNIQ--pre-000000BA-QINU`"''"`UNIQ--pre-000000BB-QINU`"''"`UNIQ--pre-000000BC-QINU`"''"`UNIQ--pre-000000BD-QINU`"''"`UNIQ--pre-000000BE-QINU`"''"`UNIQ--pre-000000BF-QINU`"''"`UNIQ--pre-000000C0-QINU`"''"`UNIQ--pre-000000C1-QINU`"''"`UNIQ--pre-000000C2-QINU`"''"`UNIQ--pre-000000C3-QINU`"''"`UNIQ--pre-000000C4-QINU`"''"`UNIQ--pre-000000C5-QINU`"''"`UNIQ--pre-000000C6-QINU`"''"`UNIQ--pre-000000C7-QINU`"''"`UNIQ--pre-000000C8-QINU`"''"`UNIQ--pre-000000C9-QINU`"''"`UNIQ--pre-000000CA-QINU`"''"`UNIQ--pre-000000CB-QINU`"''"`UNIQ--pre-000000CC-QINU`"''"`UNIQ--pre-000000CD-QINU`"''"`UNIQ--pre-000000CE-QINU`"''"`UNIQ--pre-000000CF-QINU`"''"`UNIQ--pre-000000D0-QINU`"''"`UNIQ--pre-000000D1-QINU`"''"`UNIQ--pre-000000D2-QINU`"''"`UNIQ--pre-000000D3-QINU`"''"`UNIQ--pre-000000D4-QINU`"''"`UNIQ--pre-000000D5-QINU`"''"`UNIQ--pre-000000D6-QINU`"''"`UNIQ--pre-000000D7-QINU`"''"`UNIQ--pre-000000D8-QINU`"''"`UNIQ--pre-000000D9-QINU`"''"`UNIQ--pre-000000DA-QINU`"''"`UNIQ--pre-000000DB-QINU`"''"`UNIQ--pre-000000DC-QINU`"'
- Enable NetworkManager support: KERNEL Enabling NetworkManager support
-*- Networking support ---> --- Networking support Networking options ---> <*> Packet socket -*- Wireless ---> --- Wireless <*> cfg80211 - wireless configuration API [*] cfg80211 wireless extensions compatibility
- Enable hardware clock support: KERNEL Necessary kernel options for a hardware clock
Device Drivers ---> [*] Real Time Clock ---> --- Real Time Clock *** RTC interfaces *** [*] /sys/class/rtc/rtcN (sysfs) [*] /proc/driver/rtc (procfs for rtcN) [*] /dev/rtcN (character devices) *** Platform RTC drivers *** <*> PC-style 'CMOS'
KERNEL Letting the kernel sync the system clockDevice Drivers ---> [*] Real Time Clock ---> --- Real Time Clock [*] Set system time from RTC on startup and resume (rtc0) RTC used to set the system time [*] Set the RTC time based on NTP synchronization (rtc0) RTC used to synchronize NTP adjustment *** RTC interfaces *** [*] /sys/class/rtc/rtcN (sysfs) [*] /proc/driver/rtc (procfs for rtcN) [*] /dev/rtcN (character devices) *** Platform RTC drivers *** <*> PC-style 'CMOS'
- Enable CPU microcode for the AMD CPU loading support: KERNEL Configuring the kernel to support Intel microcode loading
General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support Device Drivers ---> Generic Driver Options Firmware loader ---> {*} Firmware loading facility
- Enable NTFS read and write support: KERNEL Enable built-in NTFS filesystem reading support
File systems ---> DOS/FAT/NT Filesystems ---> <*> NTFS Read-Write file system support < > NTFS file system support
- Enable tmpfs support: KERNEL Enable tmpfs support
File systems ---> Pseudo filesystems ---> -*- Tmpfs virtual memory file system support (former shm fs) -*- Tmpfs POSIX Access Control Lists -*- Tmpfs extended attributes
- Enable ALSA and PulseAudio sound support: KERNEL Enable ALSA support
'"`UNIQ--pre-000000EB-QINU`"''"`UNIQ--pre-000000EC-QINU`"'</br>'"`UNIQ--pre-000000ED-QINU`"''"`UNIQ--pre-000000EE-QINU`"''"`UNIQ--pre-000000EF-QINU`"''"`UNIQ--pre-000000F0-QINU`"''"`UNIQ--pre-000000F1-QINU`"''"`UNIQ--pre-000000F2-QINU`"''"`UNIQ--pre-000000F3-QINU`"''"`UNIQ--pre-000000F4-QINU`"''"`UNIQ--pre-000000F5-QINU`"''"`UNIQ--pre-000000F6-QINU`"''"`UNIQ--pre-000000F7-QINU`"'
KERNEL Enable PulseAudio support'"`UNIQ--pre-000000FA-QINU`"''"`UNIQ--pre-000000FB-QINU`"''"`UNIQ--pre-000000FC-QINU`"'</br>'"`UNIQ--pre-000000FD-QINU`"''"`UNIQ--pre-000000FE-QINU`"''"`UNIQ--pre-000000FF-QINU`"''"`UNIQ--pre-00000100-QINU`"''"`UNIQ--pre-00000101-QINU`"'</br>'"`UNIQ--pre-00000102-QINU`"''"`UNIQ--pre-00000103-QINU`"''"`UNIQ--pre-00000104-QINU`"''"`UNIQ--pre-00000105-QINU`"'
- Enable Firmware loading support:
- Enable QEMU and KVM support: KERNEL Enabling QEMU and KVM support
'"`UNIQ--pre-00000108-QINU`"''"`UNIQ--pre-00000109-QINU`"''"`UNIQ--pre-0000010A-QINU`"''"`UNIQ--pre-0000010B-QINU`"''"`UNIQ--pre-0000010C-QINU`"''"`UNIQ--pre-0000010D-QINU`"''"`UNIQ--pre-0000010E-QINU`"''"`UNIQ--pre-0000010F-QINU`"''"`UNIQ--pre-00000110-QINU`"''"`UNIQ--pre-00000111-QINU`"''"`UNIQ--pre-00000112-QINU`"''"`UNIQ--pre-00000113-QINU`"''"`UNIQ--pre-00000114-QINU`"''"`UNIQ--pre-00000115-QINU`"''"`UNIQ--pre-00000116-QINU`"''"`UNIQ--pre-00000117-QINU`"''"`UNIQ--pre-00000118-QINU`"''"`UNIQ--pre-00000119-QINU`"''"`UNIQ--pre-0000011A-QINU`"''"`UNIQ--pre-0000011B-QINU`"''"`UNIQ--pre-0000011C-QINU`"''"`UNIQ--pre-0000011D-QINU`"''"`UNIQ--pre-0000011E-QINU`"'
- Enable QEMU and KVM support:
- Prepare the kernel for module compilation:
(chroot) root #
make modules_prepare
- Compile the kernel:
(chroot) root #
make -j32
- Install the kernel modules:
(chroot) root #
make modules_install
- Modify
installkernel
to boot fromgrub
:(chroot) root #
echo "sys-kernel/installkernel grub -systemd" >> /etc/portage/package.use/installkernel
(chroot) root #
emerge --ask installkernel
- Install the kernel:
(chroot) root #
make install
- Install sys-fs/zfs and sys-fs/zfs-kmod:
(chroot) root #
emerge --ask sys-fs/zfs
- Rebuild the installed modules:
(chroot) root #
emerge --ask @module-rebuild
- Use genkernel to generate an initramfs:
(chroot) root #
genkernel initramfs --firmware --kernel-config=/usr/src/linux/.config --keymap --makeopts=-j32 --mountboot --no-clean --zfs
Note
Notice that native ZFS encryption is used for this system, rather than LUKS, and thus the lack of the--luks
option in the genkernel invacation.
Install Firmware
- Edit /usr/src/linux/.config, as explained above, to enable firmware loading support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the firmware:
(chroot) root #
emerge -auvDN sys-kernel/linux-firmware
- Add support for individual selection of firmware files to sys-kernel/linux-firmware:
(chroot) root #
echo "sys-kernel/linux-firmware savedconfig" >> /etc/portage/package.use/linux-firmware
- Comment everything in /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy except the actual firmware files needed by the system:
(chroot) root #
vim /etc/portage/savedconfig/sys-kernel/linux-firmware-ddmmyyyy
Note
Currently loaded firmware can be assessed byuser $
dmesg | grep -i firmware
- Re-emerge sys-kernel/linux-firmware:
(chroot) root #
emerge --ask sys-kernel/linux-firmware
Configure fstab
With the use of ZFS, modifying the fstab file is not strictly needed. However, by editing /etc/fstab, an easy way to mount /boot and /boot/efi will be provided (note the noauto
option.
- Edit /etc/fstab:
(chroot) root #
vim /etc/fstab
FILE/etc/fstab
Mounting rules for /boot and /boot/efi... /dev/nvme0n1p1 /boot/efi vfat noauto,noatime 1 2 bpool/BOOT/gentoo /boot zfs noauto,nodev,relatime 1 2 ...
Configure the Network
- Set the computer's name:
(chroot) root #
echo 'hostname="foo"' > /etc/conf.d/hostname
- Install a DHCP client:
(chroot) root #
emerge --ask net-misc/dhcpcd
- Install wireless networking tools:
(chroot) root #
emerge --ask net-wireless/iw net-wireless/wpa_supplicant
Install systemd
- Edit /usr/src/linux/.config, as explained above, to enable systemd support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable systemd support:
(chroot) root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for systemd support... USE="...systemd..." ...
Tip
A working make.conf for this system can be found here. - Update the system with systemd support:
(chroot) root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Create /etc/mtab as a symlink to /proc/self/mounts:
(chroot) root #
ln -sf /proc/self/mounts /etc/mtab
- Create a machine ID:
(chroot) root #
systemd-machine-id-setup
- Create a hostname:
(chroot) root #
hostnamectl set-hostname foo
- Enable the services needed to mount ZFS filesystems automatically:
(chroot) root #
systemctl enable zfs.target
(chroot) root #
systemctl enable zfs-import-cache
(chroot) root #
systemctl enable zfs-mount
(chroot) root #
systemctl enable zfs-import.target
(chroot) root #
systemctl enable zfs-import-scan
- Create a service to import /boot automatically and enable it:
(chroot) root #
vim /etc/systemd/system/zfs-import-bpool.service
FILE/etc/systemd/system/zfs-import-bpool.service
Systemd service to automatically import /boot[Unit] DefaultDependencies=no Before=zfs-import-scan.service Before=zfs-import-cache.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/zpool import -N -o cachefile=none bpool [Install] WantedBy=zfs-import.target
(chroot) root #
systemctl enable zfs-import-bpool.service
- Create a service to mount /home automatically and enable it:
(chroot) root #
vim /etc/systemd/system/zfskey-home.service
FILE/etc/systemd/system/zfskey-home.service
Systemd service to automatically import /home[Unit] Description=Load rpool/ROOT/home encryption keys Before=systemd-user-sessions.service Before=zfs-mount.service After=zfs-import.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/bin/bash -c 'systemd-ask-password "Encrypted ZFS password for rpool/ROOT/home" --no-tty
(chroot) root #
systemctl enable zfskey-home.service
Install GRUB
This guide uses GRUB as a boot loader.
- Edit make.conf to install GRUB2 for the
efi-64
platform:(chroot) root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the GRUB_PLATFORMS variable for EFI-64 platform... GRUB_PLATFORMS="efi-64" ...
Tip
A working make.conf for this system can be found here. - Mount the EFI System Partition partition:
(chroot) root #
mkdir /boot/efi
(chroot) root #
mount /boot/efi
- Emerge sys-boot/grub and sys-boot/os-prober to allow GRUB2 to detect Windows 10:
(chroot) root #
emerge -auvDN sys-boot/grub sys-boot/os-prober
- Get GRUB to probe the /boot partition: zfs
(chroot) root #
grub-probe /boot
Warning
The above command must returnZFS
, if not, something is wrong and the system will not boot. - Add parameters to the kernel command line in order to boot from a ZFS partition:
(chroot) root #
vim /etc/default/grub
FILE/etc/default/grub
Setting the GRUB_CMDLINE_LINUX variable to boot from ZFS... GRUB_CMDLINE_LINUX="dozfs keymap=es real_root=ZFS=rpool/ROOT/gentoo" ...
- Create the /boot/grub directory:
(chroot) root #
mkdir /boot/grub
- Generate the GRUB configuration file:
(chroot) root #
grub-mkconfig -o /boot/grub/grub.cfg
- Check that the configuration file includes instructions to load the ZFS module: insmod zfs
(chroot) root #
grep 'insmod zfs' /boot/grub/grub.cfg
- Install the bootloader:
(chroot) root #
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo --recheck --no-floppy
- Check if the ZFS module for GRUB has been installed: /boot/grub/x86_64-efi/zfs.mod
(chroot) root #
ls /boot/grub/*/zfs.mod
- Unmount the boot partitions:
(chroot) root #
umount /boot/efi
(chroot) root #
umount /boot
- Allow bpool/BOOT/gentoo to be managed by legacy tools, such as GRUB and the /etc/fstab:
(chroot) root #
zfs set mountpoint=legacy bpool/BOOT/gentoo
User Accounts
- Secure the root account with a strong password:
(chroot) root #
passwd
- Create a regular user:
(chroot) root #
useradd -m -G audio,cdrom,portage,usb,users,video,wheel -s /bin/bash foo
(chroot) root #
passwd foo
First ZFS snapshot
Create a first ZFS snapshot. If anythong goes wrong afterwards, it will serve as a backup of a the freshly installed system.
- Create a snapshot of the boot filesystem:
root #
zfs snapshot bpool/BOOT/gentoo@install
- Create a snapshot of the root filesystem:
root #
zfs snapshot rpool/ROOT/gentoo@install
- Create a snapshot of the home filesystem:
root #
zfs snapshot rpool/ROOT/home@install
Tip
The following commands can be used to manage snapshots:- Create:
root #
zfs snapshot bpool/BOOT/gentoo@install
- List:
root #
zfs list -t all
- Rollback:
root #
zfs rollback bpool/BOOT/gentoo@install
- Clone:
root #
zfs clone bpool/BOOT/gentoo@install bpool/BOOT/gentoo@install_backup
- Rename:
root #
zfs rename bpool/BOOT/gentoo@install_backup bpool/BOOT/gentoo@original_install
- Destroy:
root #
zfs destroy bpool/BOOT/gentoo@install
- Create:
Rebooting
- Exit the chroot environment:
(chroot) root #
exit
- Unmount all mounted partitions:
root #
cd
root #
umount -l /mnt/gentoo/{dev,sys,proc,run}
root #
umount -R /mnt/gentoo/home
root #
umount -R /mnt/gentoo
- Change the mountpoint of the ZFS filesystems:
root #
zfs set mountpoint=/ rpool/ROOT/gentoo
root #
zfs set mountpoint=/home rpool/ROOT/home
- Reboot into the Gentoo environment:
root #
reboot
- Remove the downloaded stage3 files:
root #
rm /stage3-amd64-systemd-20191223.tar.bz2
- If systemd gives errors regarding the locales, run:
root #
localectl set-locale LANG=en_US.UTF-8
FUSE
- Edit /usr/src/linux/.config, as explained above, to enable FUSE support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the userspace FUSE tools:
root #
emerge --ask sys-fs/fuse
Sudo
- Enable the
offensive
USE flag to get funny replies when typing in wrong passwords:root #
echo “app-admin/sudo offensive” >> /etc/portage/package.use/sudo
- Install sudo:
root #
emerge -auvDN app-admin/sudo
- Grant administrator privileges to all the users of the
wheel
group by editing the /etc/sudoers file:root #
visudo
FILE/etc/sudoers
Modify administrator privileges... %wheel ALL=(ALL) ALL ...
- Enable bash completion with sudo:
root #
echo "complete -cf sudo" >> $HOME/.bashrc
- Allow X applications to be run with sudo:
user $
xhost local:root
AMD Graphics
Note:
https://linux-hardware.org/?id=pci%3A1002-13c0-1043-8877
https://wiki.archlinux.org/title/AMDGPU
Configure the drivers for the AMD Graphics Chip.
- Edit /usr/src/linux/.config, as explained above, to enable the AMD graphics support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to globally enable AMD graphics support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the VIDEO_CARDS variable for AMDGPU support... VIDEO_CARDS="amdgpu radeonsi" ...
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with Intel graphics support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
Xorg
Configure the Xorg X server.
- Edit /usr/src/linux/.config, as explained above, to enable Xorg support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable Xorg support and set the drivers for input devices:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for X support and configure INPUT_DEVICES... USE="...X..." ... INPUT_DEVICES="libinput"...
Tip
A working make.conf for this system can be found here. - Install Xorg:
root #
emerge -auvDN x11-base/xorg-server
- Update the environment settings and source the profile:
root #
env-update && source /etc/profile
- Install packages to test if the X server is working:
root #
emerge --ask x11-wm/twm x11-terms/xterm
- Install package to test if the 3D acceleration is working:
root #
emerge --ask x11-apps/mesa-progs
- Test if the X server is working:
user $
startx
- Test if the 3D acceleration is working:
user $
glxinfo | grep rendering
direct rendering: Yes
user $
glxgears
- Exit the X environment:
user $
exit
- Remove the packages installed for testing:
root #
emerge -Cav x11-wm/twm x11-terms/xterm x11-apps/mesa-progs
- Update the system to reinstall packages with X support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
VAAPI
To use VAAPI:
- Edit make.conf to globally enable VAAPI:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for VAAPI support... USE="... vaapi ..." ...
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with VAAPI support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Install VAAPI-related utilities:
root #
emerge -auvDN media-video/libva-utils
- Run
vainfo
to check VAAPI support:root #
vainfo
Trying display: wayland
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Trying display: x11
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_22
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 25.0.5 for AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 19.1.7, DRM 3.61, 6.14.5-gentoo)
vainfo: Supported profile and entrypoints
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
VDPAU
To use VDPAU:
- Edit make.conf to globally enable VDPAU:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for VDPAU support... USE="... vdpau ..." ...
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with VDPAU support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Set the VDPAU_DRIVER environment variable: FILE
~/.bashrc
Logged in as a user who run graphical interface... export VDPAU_DRIVER=radeonsi ...
- Install VDPAU-related utilities:
root #
emerge -auvDN x11-misc/vdpauinfo
- Run
vdpauinfo
to check VDPAU support:user $
vdpauinfo
display: :0 screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0
Video surface:
name width height types
-------------------------------------------
420 16384 16384 NV12 YV12
422 16384 16384 UYVY YUYV
444 16384 16384 Y8U8V8A8 V8U8Y8A8
420_16 16384 16384 P010 P016
422_16 16384 16384
444_16 16384 16384
Decoder capabilities:
name level macbs width height
----------------------------------------------------
Wifi
Configure the Wifi adapter.
- Identify the Wifi adapter:
root #
dmesg | grep -i -E '3b:00.0|wlan|iwl|80211'
Detected Killer(R) Wi-Fi 6 AX1650x 160MHz Wireless Network Adapter (200NGW), REV=0x340
- According to this table[13]:
- The module required to control this adapter is iwlmvm.
- The lowest Linux kernel compatible is 5.1+ (current stable kernels, 4.19.*, are not compatible).
- Edit /usr/src/linux/.config, as explained above, to enable Wifi support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
NetworkManager
Configure NetworkManager support.
- Edit /usr/src/linux/.config, as explained above, to enable NetworkManager support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable NetworkManager support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for NetworkManager support... USE="...networkmanager..." ...
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with NetworkManager support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Enable NetworkManager to be started at boot time:
root #
systemctl enable NetworkManager
GNOME Light
Install the GNOME desktop environment.
- Edit make.conf to enable GNOME support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for GNOME support... USE="...gnome gtk gtk3 -kde -gt5 systemd wayland X..." ...
Tip
A working make.conf for this system can be found here. - Emerge GNOME Light:
root #
emerge -auvDN gnome-base/gnome-light
- Update the environment variables and reload the environment
root #
env-update && source /etc/profile
- Verify that the
plugdev
group exists and add each GNOME user to it:root #
getent group plugdev
plugdev:x:272:
root #
gpasswd -a foo plugdev
root #
gpasswd -a root plugdev
- Enable GDM on boot:
root #
systemctl enable gdm.service
- Install GNOME tweaks and shell extensions for GNOME 3 customization:
root #
emerge -auvDN gnome-extra/gnome-tweaks gnome-extra/gnome-shell-extensions
- Provide admin privileges in system dialogs to the users in the wheel group:
root #
vim /etc/polkit-1/rules.d/49-wheel.rules
FILE/etc/polkit-1/rules.d/49-wheel.rules
Administrator wheel grouppolkit.addAdminRule(function(action, subject) { return ["unix-group:wheel"]; });
- Allow the root user to launch X window applications:
user $
vim ~/.bashrc
FILE/home/foo/.bashrc
X windows as root# Allow root to launch x window applications: xhost local:root
GNOME
From the GNOME packages not installed by GNOME Light, install those that are really needed.
- Install gnome-extra/gnome-system-monitor:
root #
emerge -auvDN gnome-extra/gnome-system-monitor
- Install sys-block/gparted:
root #
echo "sys-block/gparted ~amd64" >> /etc/portage/package.accept_keywords/gparted
root #
emerge -auvDN sys-block/gparted
Chromium
Install the Chromium web browser.
- Unmask the latest Chromium ebuild:
root #
echo “www-client/chromium ~amd64” >> /etc/portage/package.accept_keywords/chromium
- Emerge Chromium:
root #
emerge -auvDN www-client/chromium
- Open Chromium in incognito mode by default:
root #
cp /usr/share/applications/chromium-browser-chromium.desktop ~/.local/share/applications/
root #
vim ~/.local/share/applications/chromium-browser-chromium.desktop
FILE/home/foo/.local/share/applications/chromium-browser-chromium.desktop
Launcher for Chromium in incognito mode... Exec=chromium-browser --incognito %U ...
- Enable click-to-install GNOME Shell Extensions through Chromium:
- Install the required browser add-on through the Chrome store.
- Emerge the backend:
root #
emerge -auvDN gnome-extra/gnome-browser-connector
Firefox
Install the Firefox web browser.
- Unmask the latest Firefox ebuild:
root #
echo “www-client/firefox ~amd64” >> /etc/portage/package.accept_keywords/firefox
- Emerge Firefox:
root #
emerge -auvDN www-client/firefox
- Open Firefox in incognito mode by default:
root #
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/
root #
vim ~/.local/share/applications/firefox.desktop
FILE/home/foo/.local/share/applications/firefox.desktop
Launcher for Firefox in incognito mode... Exec=firefox --private-window %u ...
- Enable click-to-install GNOME Shell Extensions through Firefox:
- Install the required browser add-on through Add-ons for Firefox.
- Emerge the backend:
root #
emerge -auvDN gnome-extra/gnome-browser-connector
Hardware Clock
Configure Hardware Clock support.
- Edit /usr/src/linux/.config, as explained above, to enable Hardware Clock support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Check that the Hardware Clock is in use:
user $
timedatectl | grep "RTC time"
- Configure GNOME automatically update the Hardware Clock from online servers: gnome-control-center > System > Date & Time > Automatic Date & Time (set on).
Localization
Change some language specific settings.
- Modify the keyboard layout for the console:
root #
localectl list-keymaps
root #
localectl set-keymap es
root #
localectl | grep "VC Keymap"
VC Keymap: es
- Modify the keyboard layout for the X server:
root #
localectl list-x11-keymap-layouts
root #
localectl set-x11-keymap es
root #
localectl | grep "X11 Layout"
X11 Layout: es
- Edit make.conf to enable systemwide localization:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the LINGUAS and L11N variables for systemwide localization... LINGUAS="en es es_ES" L10N="en es es-es" ...
Tip
A working make.conf for this system can be found here. - Update the system with with systemwide localization:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
Loading of CPU microcode
CPU microcode for the AMD CPU will be loaded by GRUB at boot time.
At the time of writing this, there is no microcode available for this CPU (
amd-ucode/microcode_amd_fam1ah.bin
) in sys-kernel/linux-firmware. The following steps show that we don't have an early loading of microcode.- Edit /usr/src/linux/.config, as explained above, to enable CPU microcode loading support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Install the microcode firmware package:
root #
emerge -auvDN sys-kernel/linux-firmware
- Mount the /boot and /boot/efi partitions:
root #
mount /boot
root #
mount /boot/efi
- Regenerate the GRUB configuration file:
root #
grub-mkconfig -o /boot/grub/grub.cfg
- After reboot, check that the microcode has been loaded:
root #
dmesg | grep microcode
[ 0.984536] microcode: Current revision: 0x0b404023
root #
grep microcode /proc/cpuinfo
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
microcode : 0xb404023
Selection of CPU CCD core selection bias
This CPU has cores with higher cache, and cores with higher frequency, in two CCDs. We can bias the selection of the cores towards the higher cache or the higher frequency.
- Edit /usr/src/linux/.config, as explained above, to enable CPU CCD selection bias support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Set the contents of the file
/sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode
tofrequency
orcache
, as needed:root #
echo frequency | sudo tee /sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode
root #
echo cache | sudo tee /sys/bus/platform/drivers/amd_x3d_vcache/AMDI0101:00/amd_x3d_mode
USB support
Configure support for USB devices.
- Edit /usr/src/linux/.config, as explained above, to enable USB support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to add USB support:
(chroot) root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for USB support... USE="... usb ..." ...
Tip
A working make.conf for this system can be found here. - Update the system with USB support:
(chroot) root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Install the usbutils to be able to query the USB interfaces:
root #
emerge -auvDN sys-apps/usbutils
NTFS support
Configure NTFS read and write support.
- Edit /usr/src/linux/.config, as explained above, to enable in-kernel NTFS read and FUSE write support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
tmpfs support
Configure tmpfs support.
- Edit /usr/src/linux/.config, as explained above, to enable tmpfs support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Systemd will automatically mount /tmp as tmpfs. Place portage's tmpdir inside /tmp:
root #
vim /mnt/gentoo/etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the PORTAGE_TMPDIR variable for tmpfs use... PORTAGE_TMPDIR="/tmp" ...
Tip
A working make.conf for this system can be found here. - Mount as tmpfs any other appropriate directory, by using /etc/fstab:
root #
vim /etc/fstab
FILE/etc/fstab
Mounting rules for tmpfs directories... tmpfs /var/lock tmpfs rw,nodev,nosuid,size=2G 0 0 ...
ALSA and PulseAudio support
Configure ALSA and PulseAudio support.
- Edit /usr/src/linux/.config, as explained above, to enable ALSA and PulseAudio support. Tip
Working kernel configuration files, for different kernel versions, can be found here. - Update the Kernel, as explained below.
- Edit make.conf to enable ALSA and PulseAudio support:
root #
vim /etc/portage/make.conf
FILE/etc/portage/make.conf
Setting the USE variable for ALSA and PulseAudio support'"`UNIQ--pre-000001CD-QINU`"''"`UNIQ--pre-000001CE-QINU`"''"`UNIQ--pre-000001CF-QINU`"'
Tip
A working make.conf for this system can be found here. - Update the system to reinstall packages with ALSA and PulseAudio support:
root #
emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Emerge media-sound/alsa-utils:
root #
emerge -auvDN media-sound/alsa-utils
- Add ffmpeg support to media-plugins/alsa-plugins and emerge it:
root #
echo "media-plugins/alsa-plugins ffmpeg" >> /etc/portage/package.use/alsa-plugins
root #
emerge -auvDN media-plugins/alsa-plugins
External Monitors
in GNOME Wayland, when using an external non-HiDPI monitor, it will be scaled, by default, as the laptop's screen, and this will make either the windows too big in the external monitor, or too small in the laptop's screen. In order to allow a different scaling in each screen:
- Open GNOME's dconf-editor.
- Go to
/org/gnome/mutter/experimental-features
. - Disable "Use default value".
- write custom value:
['scale-monitor-framebuffer', 'x11-randr-fractional-scaling']
.
QEMU/KVM
- Edit .conf.
- Edit USE
root #
emerge -auvDN app-emulation/qemu
root #
gpasswd -a foo kvm
root #
emerge -auvDN gnome-extra/gnome-boxes
- Apply patch or it will not compile.
ZFS automatic snapshots
sys-fs/zfs-auto-snapshot provides scripts used to rotate periodic snapshots through cron jobs.
- Install sys-process/cronie and sys-fs/zfs-auto-snapshot:
root #
emerge -auvDN sys-process/cronie sys-fs/zfs-auto-snapshot && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
- Disable the default cron job that would create a frequent snapshot each 15 minutes:
root #
rm /etc/cron.d/zfs-auto-snapshot
- Enable and start the cronie systemd service:
root #
systemctl enable cronie.service
root #
systemctl start cronie.service
root #
systemctl status cronie.service
- Set the
com.sun:auto-snapshot
property totrue
for each zpool of interest:root #
zfs set com.sun:auto-snapshot=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot=true rpool/ROOT/home
- Enable the desired periodic auto-snaphot jobs on each pool:
root #
zfs set com.sun:auto-snapshot:hourly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:daily=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:weekly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:monthly=true bpool/BOOT/gentoo
root #
zfs set com.sun:auto-snapshot:hourly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:daily=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:weekly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:monthly=true rpool/ROOT/gentoo
root #
zfs set com.sun:auto-snapshot:hourly=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:daily=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:weekly=true rpool/ROOT/home
root #
zfs set com.sun:auto-snapshot:monthly=true rpool/ROOT/home
- Modify the cron jobs as needed:
root #
vim /etc/cron.hourly/zfs-auto-snapshot
root #
vim /etc/cron.daily/zfs-auto-snapshot
root #
vim /etc/cron.weekly/zfs-auto-snapshot
root #
vim /etc/cron.monthly/zfs-auto-snapshot
To Do...
Check the firmware used by rtl8153
https://gist.github.com/Brainiarc7/aa43570f512906e882ad6cdd835efe57
Update the Linux kernel
root #
mount /boot
root #
mount /boot/efi
root #
emerge --sync
root #
emerge -auvDN sys-kernel/gentoo-sources
root #
emerge --depclean
root #
emerge @preserved-rebuild
root #
revdep-rebuild
root #
eselect kernel list
root #
eselect kernel set 2
root #
cd /usr/src/linux
root #
cp /usr/src/linux-`uname -r`/.config /usr/src/linux/
root #
make syncconfig
root #
make modules_prepare
root #
make -j16
root #
make modules_install
root #
make install
root #
emerge --ask @module-rebuild
root #
genkernel initramfs --firmware --kernel-config=/usr/src/linux/.config --keymap --makeopts=-j16 --mountboot --no-clean --zfs
root #
grub-mkconfig -o /boot/grub/grub.cfg
root #
eclean-kernel -pn 2
root #
eclean-kernel -n 2
Removal of old kernels
root #
mount /boot
root #
mount /boot/efi
root #
emerge -Cav =sys-kernel/gentoo-sources-X.Y.Z
root #
emerge --depclean
root #
emerge @preserved-rebuild
root #
revdep-rebuild
root #
rm -r /usr/src/linux-X.Y.Z
root #
rm -r /lib/modules/X.Y.Z
root #
rm /boot/config-X.Y.Z-gentoo
root #
rm /boot/initramfs-X.Y.Z-gentoo.img
root #
rm /boot/System.map-X.Y.Z-gentoo
root #
rm /boot/vmlinuz-X.Y.Z-gentoo
root #
grub-mkconfig -o /boot/grub/grub.cfg
Troubleshooting
Gparted reporting the whole disk as a single Zpool
At the time of writing this, GParted reports the whole disk as a single Zpool when any of its partitions is formatted with ZFS[14]. This is not happening in other disk utilities such as GNOME Disks, parted or fdisk. This is due to a bug of the blkid utility, in its stable version, which wrongly reports the disk type. Updating sys-apps/util-linux to its latest version fixes this problem:
root #
echo "=sys-apps/util-linux-2.35.1-r1 ~amd64" >> /etc/portage/package.accept_keywords/util-linux
root #
emerge -auvDN sys-apps/util-linux && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
See also
- Handbook:AMD64 — A handbook dedicated to installing and configuring Gentoo on the amd64 architecture., an effort to centralize documentation into a coherent handbook.
- UEFI_Dual_boot_with_Windows_7/8 — describes how to dual boot Microsoft Windows on a UEFI computer.
- Sakaki%27s_EFI_Install_Guide
- Dell_XPS_15_9560
- User:Monsieurp/Gentoo_Linux_on_ZFS
- ZFS — a next generation filesystem created by Matthew Ahrens and Jeff Bonwick.
External resources
- https://github.com/bugalo/gentoo_dell_xps_15_7590
- https://wiki.archlinux.org/index.php/Dell_XPS_15_7590
- https://github.com/zfsonlinux/zfs/wiki/Debian-Buster-Root-on-ZFS
- https://wiki.archlinux.org/index.php/ZFS#GRUB-compatible_pool_creation
- https://www.funtoo.org/ZFS_as_Root_Filesystem
- https://www.reddit.com/r/zfs/comments/bnvdco/zol_080_encryption_dont_encrypt_the_pool_root/
- https://wiki.archlinux.org/index.php/ZFS
- https://github.com/zfsonlinux/zfs/issues/8810
- https://github.com/HankB/Linux_ZFS_Root/tree/master/Debian
- https://wiki.archlinux.org/index.php/ZFS#Native_encryption
References
- ↑ Connect to a wireless network, Official Ubuntu Documentation. Retrieved on January 22nd, 2020.
- ↑ Connect to a wired (Ethernet) network, Official Ubuntu Documentation. Retrieved on January 22nd, 2020.
- ↑ ZFS: GRUB-compatible pool creation, ArchWiki. Retrieved on January 22nd, 2020.
- ↑ Richard Laager. Debian Buster Root on ZFS, GitHub, December 27th, 2019. Retrieved on January 23rd, 2020.
- ↑ numinit. ZoL 0.8.0 encryption: don't encrypt the pool root!, Reddit, May, 2019. Retrieved on January 23rd, 2020.
- ↑ Patrick Kennedy. The Case For Using ZFS Compression, Serve The Home, January 2nd, 2018. Retrieved on January 23rd, 2020.
- ↑ populationless. Cannot set 'bootfs' property when 'dnodesize' is set to anything but legacy #8538, GitHub, March 27th, 2019. Retrieved on January 23rd, 2020.
- ↑ Laplacian. How to choose between AES-CCM and AES-GCM for storage volume encryption, Cryptography Stack Exchange, October 2nd, 2014. Retrieved on January 23rd, 2020.
- ↑ Patrick Kennedy. [1], [2], November 5th, 2012. Retrieved on May 5th, 2025.
- ↑ x86 Options, GCC, the GNU Compiler Collection, October 2nd, 2014. Retrieved on January 24th, 2020.
- ↑ Thomas Deutschmann. ZFS: Change hostid handling, Gentoo Git Repositories, March 27th, 2019. Retrieved on January 24th, 2020.
- ↑ 12.0 12.1 Brian Behlendorf. zfs-0.8.0, GitHub, May 23rd, 2019. Retrieved on January 25th, 2020.
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namediwlwifi_firmware
- ↑ zfs partition wrongly shows occupying the whole disk, GNOME GitLab. Retrieved on April 7th, 2020.