User:Bugalo/Dell XPS 15 7590

From Gentoo Wiki
Jump to: navigation, search
Warning
This page is a work in progress by Bugalo (talk | contribs). Treat its contents with caution.
Resources

The Dell XPS 15 7590 is the 2019 model of Dell's slim 15 inch laptop. It is fully functional with the latest Linux kernel versions.

Summary

This document will serve as a guide on how to install Gentoo on the Dell XPS 15 7590 with the following configuration:

  • Dual boot with Windows 10, in UEFI with GPT mode, using GRUB2 as a boot loader.
  • ZFS on all non-Windows partitions, including root, with native transparent compression and encryption. Deduplication will not be configured.
  • GNOME with systemd profile.

Hardware

Standard

Device Make/model Status Vendor ID / Product ID Kernel driver(s) Firmware Kernel version Notes
CPU Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz Works N/A N/A N/A 4.19.86 Different CPU options are available for this laptop.
GPU Intel(R) UHD Graphics 630 Works 8086:3e9b i915 kbl_dmc 4.19.86 N/A
RAM 32GB DDR4-2666MHz

Hynix HMA82GS6DJR8N-VK

Works N/A N/A N/A 4.19.86 Different RAM options are available for this laptop.

Two RAM slots. Up to 64GB.

Hard Disk Intel(R) SSD 760p 1.024TB Works 8086:f1a6 NVMe N/A 4.19.86 Different disk options are available for this laptop.

One NVMe slot.

Wifi Intel(R) Wi-Fi 6 AX200 Works 8086:2723 iwlwifi iwlwifi 5.1.4[1] Requires 5.1+ kernel to work.
Sound Realtek ALC3266 Works N/A snd_hda_intel snd_hda_codec_realtek N/A 4.19.86 N/A
Sound Intel(R) Cannon Lake PCH cAVS Works 8086:a348 snd_hda_intel snd_hda_codec_hdmi N/A 4.19.86 N/A

Accessories

(Optional section. Describe any accessories that may be possible in this section. Anything from external plug-and-play LCD screens to computer docks.)

Device Make/model Status Bus ID Kernel driver(s) Kernel version Notes
Dock ThinkPad Pro Dock Not tested N/A N/A 3.18.9 Note example.

Installation

Dual boot with Windows 10

Dual booting with Windows 10 requires some special steps that need to be performed both within Windows and the laptop's BIOS. All the steps of this section need to be performed within Windows 10 unless stated otherwise.

  1. Update Windows and the laptop's BIOS and firmware:
    • Open Windows Update and update as needed.
    • Open Dell Update and update the BIOS, firmware and controllers as needed.
  2. Create a recovery USB[2]. This drive can be used to restore the laptop's factory settings in case of need.
  3. Turn off Device Encryption and/or the Bitlocker Encryption[3]. It can be turned on again after install.
    Important
    The steps presented in the link above show how to turn on encryption. Modify appropriately to turn it off.
  4. Turn off Fast Startup[4].
  5. Configure Windows to use UTC[5] rather than localtime.
  6. Switch Windows 10 from RAID to AHCI operation[6], and disable Secure Boot and Fastboot in the BIOS[7].
    • Open cmd as administrator.
    • Run the command bcdedit /set {current} safeboot minimal.
    • Restart the computer and enter the BIOS by pressing F12 during boot.
    • Under System Configuration, change the SATA operation mode from RAID to AHCI.
    • Under Secure Boot, disable secure boot.
    • Under POST Behaviour, change Fastboot to Thorough.
    • Under Security, Absolute, choose Permanently Disabled to remove the Absolute Persistence Module tracking backdoor.
      Important
      This laptop comes with, at least, one tracking backdoor activated in the BIOS, autonomous with respect to the operating system, called Absolute Persistence Module. In principle, it might be permanently disabled by following the step above.
    • Save changes and exit.
    • Boot Windows. It will start in Safe Mode.
    • Open cmd as administrator.
    • Run the command bcdedit /deletevalue {current} safeboot.
    • Reboot.
  7. Reduce the size of the Windows install.
    • Disable Windows' hibernation[8]. This will free a space in the hard drive as big as the computer's RAM.
    • Enable NTFS compression in C:[9].
    • Run Compact OS[10].
    • Disable Virtual Memory[11].
    • Remove pre-installed bloatware[12].
    • Shrink the C: partition to leave space to Gentoo[13].
  8. Remove unneeded partitions created during Windows 10 install, i.e. Wineretools, Image, Dellsupport. Anything needed from those partitions should be already in the recovery USB created above.
    • Removing Wineretools[14].
      Important
      The file winre.wim mentioned in the link is not locatd in the Wineretools partition but in the recovery USB at D:\sources\OEM\winre.wim.
    • The partitions Image and Dellsupport can be deleted, their content should be already in the recovery USB. Their content might be copied, again, in the USB before deletion.
    • Microsoft Reserved Partition: there is a hidden partition of around 128mb. It will not appear in Windows' Disk Manager, but it will be shown by Gentoo's tools. Deleting this partition will render Windows 10 unbootable.
      Warning
      Removing the Microsoft Reserved Partition will render Windows 10 unbootable.

Preparing the Ubuntu Live Environment

  1. Create an Ubuntu bootable USB using, for example using UNetbootin.
  2. Plug the USB and boot the laptop.
  3. Access the One-time boot menu of the BIOS by pressing F2.
  4. Choose the appropriate entry to boot from the live USB.
  5. In the GRUB menu, choose Try Ubuntu without installing.
  6. Connect to the internet, through either a wireless[15] or wired network[16] with an USB-C to ethernet adapter.
  7. Upgrade Ubuntu to use the latest ZFS modules availabe.
    root #apt-get update
    root #apt-get upgrade
  8. 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 
  9. Create a folder for the Gentoo install.
    root #mkdir /mnt/gentoo
  10. 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 except the EFI System Partition (ESP), formatted in FAT, the aforementioned Microsoft Reserved Partition, and the Windows partition, formatted in NTFS. 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 presence of Windows on the drive requires partitioning the disk. Thus, a ZFS pool needs to be created in a partition, not in the whole disk. Furthermore, GRUB2 cannot currently reside in a ZFS pool with advanced features activated, such as encryption[17]. 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 yet another ZFS pool compatible with GRUB2.

  1. Open GParted.
  2. Create an unformatted partition, /dev/nvme0n1p4, in the unallocated space, named Gentoo-Boot, of around 1GB.
  3. Create an unformatted partition, /dev/nvme0n1p5, in the unallocated space, named Gentoo-Root, occupying the remaining space.
  4. Apply all operations and exit.
  5. Create a ZFS pool, with all GRUB2's unsupported features disabled, in /dev/nvme0n1p4.
    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 /dev/nvme0n1p4
  6. Create a ZFS pool, for the Gentoo system, in /dev/nvme0n1p5.
    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 /dev/nvme0n1p5
    Important
    Note that most native encryption ZFS guides encrypt the root ZFS pool[18]. However, this forces all its child pools and datasets to be encrypted and with the same algorithm[19]. Thus, here rpool will be left unencrypted, while encryption will be applied to its children.
  7. 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
  8. 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=/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[20]. However, this guide uses gzip-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
    Setting here the parameter dnodesize to anything other than legacy will result in the following error[21]:
    cannot set property for 'bpool': operation not supported on this type of pool
  9. Create the ZFS dataset where root will reside:
    root #zfs create -o canmount=off -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=none rpool/ROOT
    root #zfs create -o canmount=noauto -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o keylocation=prompt -o mountpoint=/ rpool/ROOT/gentoo
    Important
    The default mode of operation of ZFS native encryption is aes-256-ccm. However, aes-256-gcm is generally preferred[22].
  10. Create the ZFS dataset where home will reside:
    root #zfs create -o compression=gzip-9 -o encryption=aes-256-gcm -o keyformat=passphrase -o mountpoint=/home rpool/ROOT/home
  11. Mount all the ZFS datasets :
    root #zfs mount rpool/ROOT/gentoo
    root #zfs mount bpool/BOOT/gentoo
  12. Check that the ZFS layout is correct:
    root #zfs list -t all
  13. Set the ZFS dataset used for booting:
    root #zpool set bootfs=bpool/BOOT/gentoo bpool
    Check that the 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.

  1. 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
  2. Choose a stage tarball: multilib 64-bit stage tarball.
  3. Move to the root installation directory:
    root #cd /mnt/gentoo/
  4. 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.
  5. Unpack the stage3 tarball:
    root #tar xpvf stage3-*.tar.bz2 --xattrs-include='*.*' --numeric-owner
  6. Edit make.conf to configure:
    • The compile options to optimize compiled code, including the CPU_FLAGS_X86[23].
    • 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.confSetting the CPU_FLAGS_X86, USE and ACCEPT_LICENSE variables for systemwide support
      ...
      USE="..."
      CPU_FAGS_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.
  7. 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
  8. Copy the DNS info:
    root #cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
  9. 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
  10. 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
  11. Copy /etc/hostid, genkernel will later complain if it does not exist[24]:
    root #cp /etc/hostid /mnt/gentoo/etc/hostid
  12. Chroot into the new environment:
    root #chroot /mnt/gentoo /bin/bash
    root #source /etc/profile
    root #export PS1="(chroot) ${PS1}"
  13. 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
  14. Choose the appropriate portage profile:
    (chroot) root #eselect profile list
    (chroot) root #eselect profile set default/linux/amd64/17.1/desktop/gnome/systemd
  15. Select fast mirrors available for source code download, by using mirrorselect:
    (chroot) root #emerge --ask app-portage/mirrorselect
    (chroot) root #mirrorselect -s4 -b10 -D
  16. 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
  17. 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
  18. Configure the locales to use, at leaset, one UTF-8 locale:
    • Edit /etc/locale.gen:
      (chroot) root #vim /etc/locale.gen
      and uncomment the line referencing en_US.UTF-8 UTF-8:
      FILE /etc/locale.genAdding 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}"
  19. 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[25].
    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.[25].
  20. 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
  21. Update the world set:
    (chroot) root #emerge -auvDN @world

Configuring, building and installing the Linux kernel

Warning
This laptop has an Intel® Wi-Fi 6 AX200 160MHz wireless chip, which use the iwlwifi driver. According to this table, it requires kernel version 5.1 or above to work, higher than the latest stable kernel version at the time of writing this.
Tip
Working kernel configuration files, for different kernel versions, can be found here.
  1. Unmask a suitable kernel version:
    (chroot) root #echo "sys-kernel/gentoo-sources ~amd64" >> /etc/portage/package.accept_keywords/gentoo-sources
  2. Install the kernel and genkernel:
    (chroot) root #emerge -auvDN sys-kernel/gentoo-sources sys-kernel/genkernel
  3. 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
  4. 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
                  (i915/kbl_dmc_ver1_04.bin) Build named firmware blobs into the kernel binary
                  (/lib/firmware) Firmware blobs root directory
    • Architecture specific kernel configuration:
      KERNEL Selecting processor types and features
          Processor type and features  --->
          [*] Machine Check / overheating reporting
          [*]   Intel MCE Features
          [ ]   AMD MCE Features
              Processor family (Core 2/newer Xeon)  --->
              ( ) Opteron/Athlon64/Hammer/K8
              ( ) Intel P4 / older Netburst based Xeon
              (X) Core 2/newer Xeon
              ( ) Intel Atom
              ( ) Generic-x86-64

          Binary Emulations  --->
          [*] IA32 Emulation
    • 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
          [*] CPU core priorities scheduler support
      KERNEL Power management for multi-processor systems
          Power management and ACPI options  --->
          [*] ACPI (Advanced Configuration and Power Interface) Support
    • 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)  --->
    • Enable NVMe device support:
      KERNEL Configuration for NVMe support
          Device Drivers  --->
              NVME Support  --->
              <*> NVM Express block device
    • 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
              <*> NTFS file system support
              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 CDROM 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
    • 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
              -*- Enable bpf() system call

          Processor type and features  --->
              -*- Enable seccomp to safely compute untrusted bytecode

          Firmware Drivers  --->
              -*- Export DMI identification via sysfs to userspace

      -*- Enable the block layer  --->
          --- Enable the block layer
          -*-   Block layer SG support v4

      -*- Networking support  --->
          --- Networking support
              Networking options  --->
                  -*-   The IPv6 protocol  --->

          Device Drivers  --->
              Generic Driver Options  --->
              ()    path to uevent helper
              -*- Maintain a devtmpfs filesystem to mount at /dev
                  Firmware loader  --->
                  -*-   Enable the firmware sysfs fallback mechanism

          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
      Important
      Because of Device Drivers >> X86 Platform Specific Device Drivers >> BIOS update support for DELL systems via sysfs (DELL_RBU), need to activate Device Drivers >> Generic Driver Options >> Firmware loader >> -*- Enable the firmware sysfs fallback mechanism (CONFIG_FW_LOADER_USER_HELPER)
    • Configure the Intel graphics:
      KERNEL Configuration for Intel graphics
          Device Drivers  --->
              Generic Driver Options  --->
                  Firmware loader --->
                  -*- Firmware loading facility
                  (i915/kbl_dmc_ver1_04.bin) Build named firmware blobs into the kernel binary
                  (/lib/firmware) Firmware blobs root directory
              Graphics support  --->
              <*> /dev/agpgart (AGP Support)  --->
                  --- /dev/agpgart (AGP Support)
                  < >   AMD Opteron/Athlon64 on-CPU GART support
                  <*>   Intel 440LX/BX/GX, I8xx and E7x05 chipset support
                  < >   SiS chipset support
                  < >   VIA chipset support
              [ ] VGA Arbitration
              [ ] Laptop Hybrid Graphics - GPU switching support
              <*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
                  --- Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
                  [*]   Enable legacy fbdev support for your modesetting driver
                  [ ] Allow to specify an EDID data set instead of probing for it
                  I2C encoder or helper chips  --->
                  < > Chrontel ch7006 TV encoder
                  < > Silicon Image sil164 TMDS transmitter
                  < > NXP Semiconductors TDA998X HDMI encoder
                  < > NXP Semiconductors TDA9950/TDA998X HDMI CEC 
                  ARM devices  ----
              < > ATI Radeon
              < > AMD GPU
              < > Nouveau (NVIDIA) cards
              <*> Intel 8xx/9xx/G3x/G4x/HD Graphics
              [ ]   Enable alpha quality support for new Intel hardware by default
              < > Virtual GEM provider
              < > Virtual KMS (EXPERIMENTAL)
              < > DRM driver for VMware Virtual GPU
              < > Intel GMA5/600 KMS Framebuffer
              < > DisplayLink
              < > AST server chips
              < > Kernel modesetting driver for MGA G200 server engines
              < > Cirrus driver for QEMU emulated device
              < > QXL virtual GPU
              < > DRM Support for bochs dispi vga interface (qemu stdvga)
                  Display Panels  ---->
                  < > Raspberry Pi 7-inch touchscreen pane
                  Display Interface Bridges  ---->
                  < > Analogix ANX78XX bridge
              < > ETNAVIV (DRM support for Vivante GPU IP cores)
              [ ] Enable legacy drivers (DANGEROUS)  ---->
                  --- Enable legacy drivers (DANGEROUS)
                  < > 3dfx Banshee/Voodoo3+
                  < > ATI Rage 128
                  < > Intel I810
                  < > Matrox g200/g400
                  < > SiS video cards
                  < > Via unichrome video cards
                  < > Savage video cards
                  Frame buffer Devices  --->
                      -*- Support for frame buffer devices  --->
                          --- Support for frame buffer devices
                                *** Frame buffer hardware drivers ***
                          [*]   Simple framebuffer support
                  Backlight & LCD device support  --->
                  Console display driver support  --->
              [*] Bootup logo  --->
    • 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 support
          Device 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
                  Console display driver support --->
                  [*]  Framebuffer Console Support
    • Configure the Wifi support:
      KERNEL Enabling IEEE 802.11 support
      -*- Networking support  --->
          --- Networking support
          -*- Wireless  --->
              --- Wireless
              <*>   cfg80211 - wireless configuration API
              [ ]     nl80211 testmode command
              [ ]     enable developer warnings
              [ ]     cfg80211 certification onus
              [*]     enable powersave by default
              [ ]     cfg80211 DebugFS entries
              [ ]     support CRDA
              [ ]     cfg80211 wireless extensions compatibility
              <*>   Generic IEEE 802.11 Networking Stack (mac80211)
              [*]   Minstrel
                    Default rate control algorithm (Minstrel)  --->
                  (X) Minstrel
              [ ]   Enable mac80211 mesh networking (pre-802.11s) support
              -*-   Enable LED triggers
              [ ]   Export mac80211 internals in DebugFS
              [ ]   Trace all mac80211 debug messages
              [ ]   Select mac80211 debugging features  ----
      KERNEL Configure the iwlwifi module
          Device Drivers  --->
          [*] Network device support  --->
              --- Network device support
              [*]   Wireless LAN  --->
                  --- Wireless LAN
                  [ ]   mac80211-based legacy WDS support
                  [ ]   ADMtek devices
                  [ ]   Atheros/Qualcomm devices
                  [ ]   Atmel devices
                  [ ]   Broadcom devices
                  [ ]   Cisco devices
                  [*]   Intel devices
                  < >     Intel PRO/Wireless 2100 Network Connection
                  < >     Intel PRO/Wireless 2200BG and 2915ABG Network Connection
                  < >     Intel Wireless WiFi 4965AGN (iwl4965)
                  < >     Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)
                  <M>     Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi)
                  < >       Intel Wireless WiFi DVM Firmware support
                  <M>       Intel Wireless WiFi MVM Firmware support
                  [ ]       Enable broadcast filtering
                            Debugging Options  --->
                      [ ] Enable full debugging output in the iwlwifi driver
                      [*] iwlwifi device access tracing
                  [ ]   Intersil devices
                  [ ]   Marvell devices
                  [ ]   MediaTek devices
                  [ ]   Ralink devices
                  [ ]   Realtek devices
                  [ ]   Redpine Signals Inc devices
                  [ ]   STMicroelectronics devices
                  [ ]   Texas Instrument devices
                  [ ]   ZyDAS devices
                  [ ]   Quantenna wireless cards support
                  < >   Aviator/Raytheon 2.4GHz wireless support
                  < >   Planet WL3501 PCMCIA cards
                  < >   Simulated radio testing tool for mac80211
                  < >   Wireless RNDIS USB support
                  < >   Wifi wrapper for ethernet drivers
      -*- Cryptographic API  --->
          --- Cryptographic API
                *** Ciphers ***
          -*-   AES cipher algorithms
          <*>   AES cipher algorithms (AES-NI)
    • 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 rtc0)
              [*]   /dev/rtcN (character devices)
                    *** I2C RTC drivers ***
              <*>   PC-style 'CMOS'
      KERNEL Letting the kernel sync the system clock
          Device 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 rtc0)
              [*]   /dev/rtcN (character devices)
                    *** I2C RTC drivers ***
              <*>   PC-style 'CMOS'
    • Enable CPU microcode for the Intel CPU loading support:
      KERNEL Configuring the kernel to support Intel microcode loading
          General setup  --->
          [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

          Processor type and features --->
          [*] CPU microcode loading support
          [*]   Intel microcode loading support
          [ ]   AMD microcode loading support
          [ ]   Ancient loading interface (DEPRECATED)
    • Enable NTFS read and write support:
      KERNEL Enable built-in NTFS filesystem reading support
          File systems  --->
              DOS/FAT/NT Filesystems  --->
              <*> NTFS file system support
              [ ]   NTFS write support
      KERNEL Enabling NTFS over FUSE using NTFS-3G
          File systems  --->
          <*> FUSE (Filesystem in Userspace) 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
          General setup --->
          -*- System V IPC

          Device Drivers --->
          <*> Sound card support
              --- Sound card support
              <*> Advanced Linux Sound Architecture --->
                  --- Advanced Linux Sound Architecture
                  [*]   PCI sound devices  --->
                        HD-Audio  --->
                      <*> HD Audio PCI
                      <*> Build Realtek HD-audio codec support
                      <*> Build HDMI/DisplayPort HD-audio codec support
                      -*- Enable generic HD-audio codec parser
      KERNEL Enable PulseAudio support
          General setup  --->
              Timers subsystem  --->
                  [*] High Resolution Timer Support

          Device Drivers  --->
          <*> Sound card support  --->
              --- Sound card support
              <*> Advanced Linux Sound Architecture --->
                  (2048) Pre-allocated buffer size for HD-audio driver

          File systems  --->
              Pseudo filesystems  --->
              -*- Tmpfs virtual memory file system support (former shm fs)
              -*-   Tmpfs POSIX Access Control Lists


    • Enable QEMU and KVM support:
      KERNEL Enabling QEMU and KVM support
      [*] Virtualization  --->
          --- Virtualization  --->
          <*>   Kernel-based Virtual Machine (KVM) support
          <*>     KVM for Intel processors support
          < >     KVM for AMD processors support
          <*>   Host kernel accelerator for virtio net
      -*- Networking support  --->
          --- Networking support
                Networking options  --->
                  -*-   The IPv6 protocol  --->
                  <*> 802.1d Ethernet Bridging
          Device Drivers  --->
          [*] Network device support  --->
              --- Network device support
              [*]   Network core driver support
              <*>     Universal TUN/TAP device driver support
          Kernel hacking  --->
              Compile-time checks and compiler options  --->
              -*- Debug Filesystem


  1. Prepare the kernel for module compilation:
    (chroot) root #make modules_prepare
  2. Compile the kernel:
    (chroot) root #make -j16
  3. Install the kernel modules:
    (chroot) root #make modules_install
  4. Install the kernel:
    (chroot) root #make install
  5. Rebuild the installed modules:
    (chroot) root #emerge --ask @module-rebuild
  6. Use genkernel to generate an initramfs:
    (chroot) root #genkernel initramfs --firmware --kernel-config=/usr/src/linux/.config --keymap --makeopts=-j16 --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

  1. 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.
  2. Update the Kernel, as explained below.
  3. Install the firmware:
    (chroot) root #emerge -auvDN sys-kernel/linux-firmware
  4. 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
  5. 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 by
    user $dmesg | grep -i firmware
    Tip
    A working linux-firmware-ddmmyyyy for this system can be found here.
  6. 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.

  1. Edit /etc/fstab:
    (chroot) root #vim /etc/fstab
    FILE /etc/fstabMounting 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
    ...
    Tip
    A working fstab for this system can be found here.

Configure the Network

  1. Set the computer's name:
    (chroot) root #echo 'hostname="foo"' > /etc/conf.d/hostname
  2. Install a DHCP client:
    (chroot) root #emerge --ask net-misc/dhcpcd
  3. Install wireless networking tools:
    (chroot) root #emerge --ask met-wireless/iw net-wireless/wpa_supplicant

Install systemd

  1. 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.
  2. Update the Kernel, as explained below.
  3. Edit make.conf to enable systemd support:
    (chroot) root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting the USE variable for systemd support
    ...
    USE="...systemd..."
    ...
    Tip
    A working make.conf for this system can be found here.
  4. Update the system with systemd support:
    (chroot) root #emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
  5. Create /etc/mtab as a symlink to /proc/self/mounts:
    (chroot) root #ln -sf /proc/self/mounts /etc/mtab
  6. Create a machine ID:
    (chroot) root #systemd-machine-id-setup
  7. Create a hostname:
    (chroot) root #hostnamectl set-hostname foo
  8. 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
  9. 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.serviceSystemd 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
    Tip
    A working zfs-import-bpool.service for this system can be found here.
    (chroot) root #systemctl enable zfs-import-bpool.service
  10. Create a service to mount /home automatically and enable it:
    (chroot) root #vvim /etc/systemd/system/zfskey-home.service
    FILE /etc/systemd/system/zfskey-home.serviceSystemd 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  | zfs load-key rpool/ROOT/home'

    [Install]
    WantedBy=zfs-mount.service
    Tip
    A working zfskey-home.service for this system can be found here.
    (chroot) root #systemctl enable zfskey-home.service

Install GRUB

This guide uses GRUB2 as a boot loader.

  1. Edit make.conf to install GRUB2 for the efi-64 platform:
    (chroot) root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting the GRUB_PLATFORMS variable for EFI-64 platform
    ...
    GRUB_PLATFORMS="efi-64"
    ...
    Tip
    A working make.conf for this system can be found here.
  2. Mount the EFI System Partition partition:
    (chroot) root #mkdir /boot/efi
    (chroot) root #mount /boot/efi
  3. 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
  4. Get GRUB to probe the /boot partition:
    (chroot) root #grub-probe /boot
    zfs
    Warning
    The above command must return ZFS, if not, something is wrong and the system will not boot.
  5. Add parameters to the kernel command line in order to boot from a ZFS partition:
    (chroot) root #vim /etc/default/grub
    FILE /etc/default/grubSetting the GRUB_CMDLINE_LINUX variable to boot from ZFS
    ...
    GRUB_CMDLINE_LINUX="dozfs real_root=ZFS=rpool/ROOT/gentoo"
    ...
    Tip
    A working /etc/default/grub for this system can be found here.
  6. Create the /boot/grub directory:
    (chroot) root #mkdir /boot/grub
  7. Generate the GRUB configuration file:
    (chroot) root #grub-mkconfig -o /boot/grub/grub.cfg
  8. Check that the configuration file includes instructions to load the ZFS module:
    (chroot) root #grep 'insmod zfs' /boot/grub/grub.cfg
    insmod zfs
  9. Install the bootloader:
    (chroot) root #grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo --recheck --no-floppy
  10. Check if the ZFS module for GRUB has been installed:
    (chroot) root #ls /boot/grub/*/zfs.mod
    /boot/grub/x86_64-efi/zfs.mod
  11. Unmount the boot partitions:
    (chroot) root #umount /boot/efi
    (chroot) root #umount /boot
  12. 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

  1. Secure the root account with a strong password:
    (chroot) root #passwd
  2. 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.

  1. Create a snapshot of the boot filesystem:
    root #zfs snapshot bpool/BOOT/gentoo@install
  2. Create a snapshot of the root filesystem:
    root #zfs snapshot rpool/ROOT/gentoo@install
  3. 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

Rebooting

  1. Exit the chroot environment:
    (chroot) root #exit
  2. Unmount all mounted partitions:
    root #cd
    root #umount -l /mnt/gentoo/{dev,sys,proc}
    root #umount -R /mnt/gentoo
  3. Change the mountpoint of the ZFS filesystems:
    root #zfs set mountpoint=/ rpool/ROOT/gentoo
    root #zfs set mountpoint=/home rpool/ROOT/home
  4. Reboot into the Gentoo environment:
    root #reboot
  5. Remove the downloaded stage3 files:
    root #rm /stage3-amd64-systemd-20191223.tar.bz2
  6. If systemd gives errors regarding the locales, run:
    root #localectl set-locale LANG=en_US.UTF-8

FUSE

  1. 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.
  2. Update the Kernel, as explained below.
  3. Install the userspace FUSE tools:
    root #emerge --ask sys-fs/fuse

Sudo

  1. 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
  2. Install sudo:
    root #emerge -auvDN app-admin/sudo
  3. Grant administrator privileges to all the users of the wheel group by editing the /etc/sudoers file:
    root #visudo
    FILE /etc/sudoersModify administrator privileges
    ...
    wheel ALL=(ALL) ALL
    ...
  4. Enable bash completion with sudo:
    root #echo "complete -cf sudo" >> $HOME/.bashrc
  5. Allow X applications to be run with sudo:
    user $xhost local:root

Intel Graphics

Configure the drivers for the Intel Graphics Chip.

  1. Edit /usr/src/linux/.config, as explained above, to enable the Intel graphics support.
    Tip
    Working kernel configuration files, for different kernel versions, can be found here.
  2. Update the Kernel, as explained below.
  3. Edit make.conf to globally enable Intel graphics support:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting the VIDEO_CARDS variable for Intel support
    ...
    VIDEO_CARDS="intel i965"
    ...
    Tip
    A working make.conf for this system can be found here.
  4. Update the system to reinstall packages with Intel graphics support:
    root #emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
  5. If needed, force Xorg to load the modesetting driver:
    root #/etc/X11/xorg.conf.d/20-modesetting.conf
    FILE /etc/X11/xorg.conf.d/20-modesetting.confForce modesetting DDX
    Section "Device"
        Identifier  "Intel Graphics"
        Driver      "modesetting"
        Option      "AccelMethod"    "glamor"
        Option      "DRI"            "3"
    EndSection
  6. Install the Intel userland GPU tools:
    root #echo "x11-apps/igt-gpu-tools ~amd64" >> /etc/portage/package.accept_keywords/igt-gpu-tools

Xorg

Configure the Xorg X server.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Edit make.conf to enable Xorg support and set the drivers for input devices:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting 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.
  4. Install Xorg:
    root #emerge -auvDN x11-base/xorg-server
  5. Update the environment settings and source the profile:
    root #env-update && source /etc/profile
  6. Install packages to test if the X server is working:
    root #emerge --ask x11-wm/twm x11-terms/xterm
  7. Install package to test if the 3D acceleration is working:
    root #emerge --ask x11-apps/mesa-progs
  8. Test if the X server is working:
    user $startx
  9. Test if the 3D acceleration is working:
    user $glxinfo | grep rendering
    direct rendering: Yes
    user $glxgears
  10. Exit the X environment:
    user $exit
  11. Remove the packages installed for testing:
  12. Update the system to reinstall packages with X support:
    root #emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild

Wifi

Configure the Wifi adapter.

  1. 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
  2. According to this table[1]:
    • 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).
  3. 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.
  4. Update the Kernel, as explained below.

NetworkManager

Configure NetworkManager support.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Edit make.conf to enable NetworkManager support:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting the USE variable for NetworkManager support
    ...
    USE="...networkmanager..."
    ...
    Tip
    A working make.conf for this system can be found here.
  4. Update the system to reinstall packages with NetworkManager support:
    root #emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild

GNOME

Install the GNOME desktop environment.

  1. Edit make.conf to enable GNOME support:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting 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.
  2. Emege GNOME:
    root #emege -auvDN gnome-base/gnome
  3. Update the environment variables and reload the environment
    root #env-update && source /etc/profile
  4. 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
  5. Enable GDM on boot:
    root #systemctl enable gdm.service
  6. Install GNOME tweaks and shell extensions for GNOME 3 customization:
  7. 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.rulesAdministrator wheel group
    polkit.addAdminRule(function(action, subject) {
        return ["unix-group:wheel"];
    });
  8. Allow the root user to launch X window applications:
    user $vim ~/.bashrc
    FILE /home/foo/.bashrcX windows as root
    # Allow root to launch x window applications:
    xhost local:root
  9. Enable tap to click in GDM:
    user $xhost +SI:localuser:gdm
    user $sudo -u gdm gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true

Chromium

Install the Chromium web browser.

  1. Unmask the latest Chromium ebuild:
    root #echo “www-client/chromium ~amd64” >> /etc/portage/package.accept_keywords/chromium
  2. Emerge Chromium:
    root #emerge -auvDN www-client/chromium
  3. 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.desktopLauncher for Chromium in incognito mode
    ...
    Exec=chromium-browser --incognito %U
    ...
  4. Enable click-to-install GNOME Shell Extensions through Chromium:

Firefox

Install the Firefox web browser.

  1. Unmask the latest Firefox ebuild:
    root #echo “www-client/firefox ~amd64” >> /etc/portage/package.accept_keywords/firefox
  2. Emerge Firefox:
    root #emerge -auvDN www-client/firefox
  3. 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.desktopLauncher for Firefox in incognito mode
    ...
    Exec=firefox --private-window %u
    ...
  4. Enable click-to-install GNOME Shell Extensions through Firefox:

Flash Player

Install the Adobe Flash player.

  1. Emerge Flash:
    root #emerge -auvDN www-plugins/adobe-flash

Hardware Clock

Configure Hardware Clock support.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Check that the Hardware Clock is in use:
    user $timedatectl
    user $ grep @RTC time"
  4. Configure GNOME automatically update the Hardware Clock from online servers: gnome-control-center > Details > Date & Time > Automatic Date & Time (set on).

Localization

Change some language specific settings.

  1. Modify the keyboard layout for the console:
    root #localectl list-keymaps
    root #localectl set-keymap es
    root #localectl | grep "VC Keymap"
           VC Keymap: es
  2. 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
  3. Edit make.conf to enable systemwide localization:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting 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.
  4. 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 Intel CPU will be loaded by GRUB at boot time.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Install the microcode firmware package and the manipulation tool:
  4. Mount the /boot and /boot/efi partitions:
    root #mount /boot
    root #mount /boot/efi
  5. Manually generate the microcode cpio archive:
    root #iucode_tool -S --write-earlyfw=/boot/early_ucode.cpio /lib/firmware/intel-ucode/*
    iucode_tool: system has processor(s) with signature 0x000906ed
    iucode_tool: Writing selected microcodes to: /boot/early_ucode.cpio
    Note
    GRUB2 will automatically try to load any file named /boot/early_ucode.cpio.
  6. Regenerate the GRUB configuration file:
    root #grub-mkconfig -o /boot/grub/grub.cfg
  7. After reboot, check that the microcode has been loaded:
    root #dmesg | grep microcode
    [    0.000000] microcode: microcode updated early to revision 0xca, date = 2019-10-03
    [    2.623235] microcode: sig=0x906ed, pf=0x20, revision=0xca
    [    2.623592] microcode: Microcode Update Driver: v2.2.
    root #grep microcode /proc/cpuinfo
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca
    microcode	: 0xca

USB support

Configure support for USB devices.

  1. 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.
  2. Update the Kernel, as explained below.
  3. 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.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Enable USE flags as needed:
    root #echo "sys-fs/ntfs3g ntfsdecrypt suid" >> /etc/portage/package.use/ntfs3g
  4. Emerge sys-fs/ntfs3g:
    root #emerge -auvDN sys-fs/ntfs3g

tmpfs support

Configure tmpfs support.

  1. 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.
  2. Update the Kernel, as explained below.
  3. 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.confSetting the PORTAGE_TMPDIR variable for tmpfs use
    ...
    PORTAGE_TMPDIR="/tmp"
    ...
    Tip
    A working make.conf for this system can be found here.
  4. Mount as tmpfs any other appropriate directory, by using /etc/fstab:
    root #vim /etc/fstab
    FILE /etc/fstabMounting rules for tmpfs directories
    ...
    tmpfs                   /var/lock               tmpfs           rw,nodev,nosuid,size=2G                                 0 0
    ...
    Tip
    A working fstab for this system can be found here.

ALSA and PulseAudio support

Configure ALSA and PulseAudio support.

  1. 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.
  2. Update the Kernel, as explained below.
  3. Edit make.conf to enable ALSA and PulseAudio support:
    root #vim /etc/portage/make.conf
    FILE /etc/portage/make.confSetting the USE variable for ALSA and PulseAudio support
    ...
    USE="...alsa...pulseaudio..."
    ...
    Tip
    A working make.conf for this system can be found here.
  4. Update the system to reinstall packages with ALSA and PulseAudio support:
    root #emerge -auvDN @world && emerge --depclean && emerge @preserved-rebuild && revdep-rebuild
  5. Emerge media-sound/alsa-utils:
    root #emerge -auvDN media-sound/alsa-utils
  6. 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

QEMU/KVM

QEMU and KVM.

  1. Edit .conf.
  2. Edit USE
  3. root #emerge -auvDN app-emulation/QEMU
  4. root #gpasswd -a foo kvm
  5. root #emerge -auvDN gnome-extra/gnome-boxes
    • Apply patch or it will not compile.

To Do...

Check the firmware used by rtl8153

https://wiki.gentoo.org/wiki/Linux_firmware

https://wiki.archlinux.org/index.php/Intel_graphics#Enable_GuC_/_HuC_firmware_loading

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

Troubleshooting

(Optional section.)

(Troubleshoot issues in this section. Separate issues by best describing the error with a new section name. Remove this section and subsections if no issues are known.)

Issue 1

When X happens, Y is how you fix it.

See also

External resources

References

  1. 1.0 1.1 iwlwifi Firmware, The official Linux Wireless wiki, October 9th, 2019. Retrieved on February 4th, 2020.
  2. Create a recovery drive, Microsoft Support, July 8th, 2019. Retrieved on January 21st, 2020.
  3. Turn on device encryption, Microsoft Support, July 31st, 2019. Retrieved on January 21st, 2020.
  4. Patrick Barker. Fast Startup - How to disable if it's causing problems, Microsoft Community, June 15th, 2014. Retrieved on January 21st, 2020.
  5. UTC in Windows, ArchWiki. Retrieved on January 21st, 2020.
  6. Steve Schardein. SOLUTION: Switch Windows 10 from RAID/IDE to AHCI operation, Tripe-S Computers Blog, June 16th, 2016. Retrieved on January 21st, 2020.
  7. Armin Coralic. Dual boot Arch on Dell XPS 7590, GitHub, August 18th, 2019. Retrieved on January 21st, 2020.
  8. How to disable and re-enable hibernation on a computer that is running Windows, Microsoft Support, November 12th, 2019. Retrieved on January 21st, 2020.
  9. Mauro Huculak.How to use NTFS compression on Windows 10, Windows Central, March 20th, 2019. Retrieved on January 21st, 2020.
  10. Compact OS, single-instancing, and image optimization, Microsoft Docs, May 2nd, 2017. Retrieved on January 21st, 2020.
  11. Trisha. How to Disable Virtual Memory in Windows 10, TrishTech, November 26th, 2014. Retrieved on January 21st, 2020.
  12. Vamsi Krishna. How to Uninstall Pre-Installed Apps in Windows 10 Using Powershell, Make Tech Easier, October 20th, 2018. Retrieved on January 21st, 2020.
  13. Microsoft Support: How to re-partition without destroying the data?, Microsoft Support, May 27th, 2014. Retrieved on January 21st, 2020.
  14. Removing the Windows 10 Recovery (WinRE) Partition, TeraByte. Retrieved on January 21st, 2020.
  15. Connect to a wireless network, Official Ubuntu Documentation. Retrieved on January 22nd, 2020.
  16. Connect to a wired (Ethernet) network, Official Ubuntu Documentation. Retrieved on January 22nd, 2020.
  17. ZFS: GRUB-compatible pool creation, ArchWiki. Retrieved on January 22nd, 2020.
  18. Richard Laager. Debian Buster Root on ZFS, GitHub, December 27th, 2019. Retrieved on January 23rd, 2020.
  19. numinit. ZoL 0.8.0 encryption: don't encrypt the pool root!, Reddit, May, 2019. Retrieved on January 23rd, 2020.
  20. Patrick Kennedy. The Case For Using ZFS Compression, Serve The Home, January 2nd, 2018. Retrieved on January 23rd, 2020.
  21. populationless. Cannot set 'bootfs' property when 'dnodesize' is set to anything but legacy #8538, GitHub, March 27th, 2019. Retrieved on January 23rd, 2020.
  22. 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.
  23. x86 Options, GCC, the GNU Compiler Collection, October 2nd, 2014. Retrieved on January 24th, 2020.
  24. Thomas Deutschmann. ZFS: Change hostid handling, Gentoo Git Repositories, March 27th, 2019. Retrieved on January 24th, 2020.
  25. 25.0 25.1 Brian Behlendorf. zfs-0.8.0, GitHub, May 23rd, 2019. Retrieved on January 25th, 2020.