User:Bugalo/Dell XPS 15 7590

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 Handbook:AMD64/Installation/Disks with Handbook:AMD64/Installation/Disks 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.

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

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  and firmware:
 * 2) * Open and update as needed.
 * 3) * Open and update the, firmware and controllers as needed.
 * 4) Create a recovery USB . This drive can be used to restore the laptop's factory settings in case of need.
 * 5) Turn off  and/or the  . It can be turned on again after install.
 * 6) Turn off UEFI_Dual_boot_with_Windows_7/8.
 * 7) Configure Windows to use  rather than System_time.
 * 8) Switch Windows 10 from RAID to AHCI operation, and disable  and  in the.
 * 9) * Open as administrator.
 * 10) * Run the command.
 * 11) * Restart the computer and enter the by pressing  during boot.
 * 12) * Under System Configuration, change the SATA operation mode from RAID to AHCI.
 * 13) * Under Secure Boot, disable secure boot.
 * 14) * Under POST Behaviour, change Fastboot to Thorough.
 * 15) * Under Security, Absolute, choose Permanently Disabled to remove the Absolute Persistence Module tracking backdoor.
 * 16) * Save changes and exit.
 * 17) * Boot Windows. It will start in Safe Mode.
 * 18) * Open as administrator.
 * 19) * Run the command.
 * 20) * Reboot.
 * 21) Reduce the size of the Windows install.
 * 22) * Disable Windows' hibernation . This will free a space in the hard drive as big as the computer's.
 * 23) * Enable NTFS compression in C:.
 * 24) * Run Compact OS.
 * 25) * Disable Virtual Memory.
 * 26) * Remove pre-installed bloatware.
 * 27) * Shrink the C: partition to leave space to.
 * 28) 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.
 * 29) * Removing Wineretools.
 * 30) * 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.
 * 31) * 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.

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  by pressing.
 * 4) Choose the appropriate entry to boot from the live USB.
 * 5) In the  menu, choose Try Ubuntu without installing.
 * 6) Connect to the internet, through either a wireless or wired network with an USB-C to ethernet adapter.
 * 7) Upgrade Ubuntu to use the latest  modules availabe.
 * 8) Verify that  is loaded
 * 9) Create a folder for the Gentoo install.
 * 10) Install the text editor of your choice, e.g. Vim.

Create the ZFS layout
All the partitions of the system will use the Filesystem except the EFI_System_Partition, formatted in FAT, the aforementioned Microsoft Reserved Partition, and the Windows partition, formatted in NTFS. 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, and we would create different 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 needs to be created in a partition, not in the whole disk. Furthermore, cannot currently reside in a  with advanced features activated, such as encryption. In order to satisfy both requirements of using as a  and having the system residing in  with native encryption, we need to create yet another  compatible with.


 * 1) Open.
 * 2) Create an unformatted partition, , in the unallocated space, named Gentoo-Boot, of around 1GB.
 * 3) Create an unformatted partition, , in the unallocated space, named Gentoo-Root, occupying the remaining space.
 * 4) Apply all operations and exit.
 * 5) Create a, with all 's unsupported features disabled, in.
 * 6) Create a, for the Gentoo system, in.
 * 7) The status and properties of the pools created above can be checked with the following commands:
 * 8) Create the  where  will reside:
 * 9) Create the  where  will reside:
 * 10) Create the  where  will reside:
 * 11) Mount all the :
 * 12) Check that the  layout is correct:
 * 13) Set the  used for booting:  Check that the   property has been properly set:

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:
 * 2) Choose a stage tarball:.
 * 3) Move to the root installation directory:
 * 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:
 * 5) Unpack the stage3 tarball:
 * 6) Edit make.conf to configure:
 * 7) * The compile options to optimize compiled code, including the CPU_FLAGS_X86.
 * 8) * The global Handbook:Parts/Working/USE variable to specify system-wide package support.
 * 9) * The Handbook:AMD64/Installation/Base variable to select the license group automatically accepted.
 * 10) Configure the Gentoo ebuild repository:
 * 11) Copy the DNS info:
 * 12) Mount the necessary filesystems:
 * 13) Copy the  to the installation directory:
 * 14) Copy, Genkernel will later complain if it does not exist :
 * 15) Chroot into the new environment:
 * 16) Update the Gentoo Ebuild_repository:
 * 17) Choose the appropriate Profile_(Portage):
 * 18) Select fast mirrors available for source code download, by using mirrorselect:
 * 19) Emerge Vim to be used as a text editor:
 * 20) Set the timezone and reconfigure the :
 * 21) Configure the locales to use, at leaset, one UTF-8 locale:
 * 22) * Edit : and uncomment the line referencing  :
 * 23) * Generate the locales:
 * 24) * Reload the environment:
 * 25) Unmask the latest versions of  and :
 * 26) Unmask the latest versions of  and add  support:
 * 27) Update the World_set_(Portage):

Configuring, building and installing the Linux kernel

 * 1) Unmask a suitable Kernel version:
 * 2) Install the Kernel and Genkernel:
 * 3) Add compression support to  in order to be able to load compressed modules:
 * 4) Configure the :
 * 5) * Enable Linux_firmware loading support:
 * 6) * Architecture specific kernel configuration:
 * 7) * Enable support:
 * 8) * Enable support, needed if using a  hard drive;, needed for  devices,  external hard drives and optical drives, etc.:
 * 9) * Enable NVMe device support:
 * 10) * Enable compressed kernel modules:
 * 11) * Enable Device_file support:
 * 12) * Enable support for the Filesystem used:
 * 13) * Enable support for Filesystem_in_Userspace:
 * 14) * Enable support:
 * 15) * Enable support:
 * 16) * Configure USB support:
 * 17) * Configure USB support for input devices:
 * 18) * Enable and  support:
 * 19) * Enable audio:
 * 20) * Enable Systemd support:
 * 21) * Configure the Intel graphics:
 * 22) * Configure the Xorg support:
 * 23) * Configure the Wifi support:
 * 24) * Enable NetworkManager support:


 * 1) * Enable QEMU support:


 * 1) Prepare the kernel for module compilation:
 * 2) Compile the kernel:
 * 3) Install the kernel modules:
 * 4) Install the kernel:
 * 5) Rebuild the installed Kernel_Modules:
 * 6) Use Genkernel to generate an Initramfs:

Install Firmware and CPU Microcode

 * 1) Edit, as explained above, to enable  loading support.
 * 2) Install the Linux_firmware:
 * 3) Add support for individual selection of firmware files to :
 * 4) Comment everything in  except the actual firmware files needed by the system:
 * 5) Re-emerge :

Configure fstab
With the use of, modifying the fstab file is not strictly needed. However, by editing, an easy way to mount and  will be provided (note the   option.
 * 1) Edit :

Configure the Network

 * 1) Set the computer's name:
 * 2) Install a  client:
 * 3) Install wireless networking tools:

Install systemd

 * 1) Edit, as explained above, to enable  support.
 * 2) Edit make.conf to enable  support:
 * 3) Update the system with  support:
 * 4) Create  as a symlink to :
 * 5) Create a machine ID:
 * 6) Create a hostname:
 * 7) Enable the services needed to mount  filesystems automatically:
 * 8) Create a service to import  automatically and enable it:
 * 9) Create a service to mount  automatically and enable it:

Install GRUB
This guide uses GRUB2 as a boot loader.


 * 1) Edit make.conf to install  for the   platform:
 * 2) Mount the EFI_System_Partition partition:
 * 3) Emerge  and  to allow  to detect Windows 10:
 * 4) Get  to probe the  partition:
 * 5) Add parameters to the kernel command line in order to boot from a  partition:
 * 6) Create the  directory:
 * 7) Generate the  configuration file:
 * 8) Check that the configuration file includes instructions to load the  module:
 * 9) Install the bootloader:
 * 10) Check if the  module for  has been installed:
 * 11) Unmount the boot partitions:
 * 12) Allow  to be managed by legacy tools, such as  and the :

User Accounts

 * 1) Secure the  account with a strong password:
 * 2) Create a regular user:

First ZFS snapshot
Create a first. 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:
 * 2) Create a snapshot of the root filesystem:
 * 3) Create a snapshot of the home filesystem:

Rebooting

 * 1) Exit the  environment:
 * 2) Unmount all mounted partitions:
 * 3) Change the mountpoint of the :
 * 4) Reboot into the Gentoo environment:
 * 5) Remove the downloaded  files:
 * 6) If  gives errors regarding the locales, run:

FUSE

 * 1) Edit, as explained above, to enable  support.
 * 2) Install the userspace  tools:

Sudo

 * 1) Enable the    flag to get funny replies when typing in wrong passwords:
 * 2) Install Sudo:
 * 3) Grant administrator privileges to all the users of the   group by editing the  file:
 * 4) Enable bash completion with sudo:
 * 5) Allow X applications to be run with sudo:

Intel Graphics
Configure the drivers for the Intel Graphics Chip.


 * 1) Edit, as explained above, to enable the Intel graphics support.
 * 2) Edit make.conf to globally enable Intel graphics support:
 * 3) Update the system to reinstall packages with Intel graphics support:
 * 4) If needed, force  to load the modesetting driver:
 * 5) Install the Intel userland GPU tools:

Xorg
Configure the Xorg X server.


 * 1) Edit, as explained above, to enable  support.
 * 2) Edit make.conf to enable  support and set the drivers for input devices:
 * 3) Install :
 * 4) Update the environment settings and source the profile:
 * 5) Install packages to test if the  is working:
 * 6) Install package to test if the 3D acceleration is working:
 * 7) Test if the  is working:
 * 8) Test if the 3D acceleration is working:
 * 9) Exit the X environment:
 * 10) Remove the packages installed for testing:
 * 11) Update the system to reinstall packages with  support:

Wifi
Configure the Wifi adapter.


 * 1) Identify the  adapter:
 * 2) According to this table :
 * 3) * The module required to control this adapter is iwlmvm.
 * 4) * The lowest Linux kernel compatible is 5.1+ (current stable kernels, 4.19.*, are not compatible).
 * 5) Edit, as explained above, to enable  support.

NetworkManager
Configure NetworkManager support.


 * 1) Edit, as explained above, to enable  support.
 * 2) Edit make.conf to enable  support:
 * 3) Update the system to reinstall packages with  support:

GNOME
Install the GNOME/Guide Desktop_environment.


 * 1) Edit make.conf to enable  support:
 * 2) Emege :
 * 3) Update the environment variables and reload the environment
 * 4) Verify that the   group exists and add each  user to it:
 * 5) Enable GNOME/GDM on boot:
 * 6) Install GNOME tweaks and shell extensions for  customization:
 * 7) Provide admin privileges in system dialogs to the users in the wheel group:
 * 8) Allow the  user to launch X window applications:

Chromium
Install the Chromium web browser.


 * 1) Unmask the latest Chromium ebuild:
 * 2) Emerge Chromium:
 * 3) Open Chromium in incognito mode by default:
 * 4) Enable click-to-install  Shell Extensions through Chromium:
 * 5) * Install the required browser add-on through the Chrome store.
 * 6) * Emerge the backend:

Firefox
Install the Firefox web browser.


 * 1) Unmask the latest Firefox ebuild:
 * 2) Emerge Firefox:
 * 3) Open Firefox in incognito mode by default:
 * 4) Enable click-to-install  Shell Extensions through Firefox:
 * 5) * Install the required browser add-on through Add-ons for Firefox.
 * 6) * Emerge the backend:

Flash Player
Install the Adobe_Flash player.


 * 1) Emerge Flash:

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

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.

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