This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Dell XPS 15 9560
Macbook Pro performance for half the cost.
Status
As of late January 2018 I have pretty much everything working as required. Latency on all operations even in X11 are noticeably lower and more pleasant than even typing in iTerm2 on a top end Macbook Pro, and root on ZFS is awesome :) Some annoyances remain:
- I am still tweaking the graphics setup as I have no need for high performance 3D but do require basic 3D acceleration and would like to have the Nvidia chip disabled. After trying the closed source Nvidia drivers I have switched back to the i915 kernel drive and firmware (not yet detailed in the kernel setup section) and this works well both in console and X11.
- The synaptics touchpad needs more work. If I am editing in a terminal in X11 it has a tendency to scroll which is irritating. Have tried to turn it off a few ways and yet to solve it to my satisfaction.
- I am still migrating from raw alsa to portaudio, which seems to be a requirement to get audio out of some applications (eg. love2d applications)
- ZFS root required submitting a pull request to genkernel which is yet to be accepted (but is working for me). It also for some reason (I suspect because the cachefile would be placed on the initramfs if it was honored) fails to persist the zpool cachefile settings which means every time I rebuild the kernel I need to re-set the zpool cachefile in order to have it cached on the initramfs otherwise the zpool import time blows out to 30 seconds or so while it searches all devices. (My patch fixed this but doesn't auto-generate the cachefile as mucking with low-level storage settings seems a bad thing to silently do)
- Machine seems to turn on sometimes when in transit without encouragement. There may be something about the ACPI shutdown that could be altered to make it less sensitive to apparent bumps and openings while being carried, or perhaps this is a hardware issue.
- Haven't yet tried the touchscreen or fingerprint reader or SDcard reader features, though the latter seems to be loaded in to the kernel fine.
History
This device was apparently released in late 2016. I bought it before Christmas 2017. At the time, the cost was about $1900 USD in Australia, versus $3500+ USD for an equivalently specified Macbook Pro with useless features like "touch bar".
When my second overpriced Macbook Pro in a row developed annoying hardware problems that required spending stupid money to resolve, I determined that I should switch away from OSX and return to the Linux desktop fold, as well as to reward Dell as the XPS series is widely considered to be quite Linux friendly.
Hardware
Standard
Device | Make/model | Status | Kernel driver(s) | Kernel version |
---|---|---|---|---|
CPU | Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | Works | 4.12.5 | |
Memory | 16GB DDR4-2400MHz | Works | ||
Hard disk | 512GB PCIe Solid State Drive | Works | nvme | |
Video card | NVIDIA Corporation GP107M GeForce GTX 1050 Mobile (4GB GDDR5) | Works | nvidia, fbsimple | 4.14.8 |
Video card | Intel Corporation Device 591b (rev 04) | Works | i915 | 4.13 |
Wireless | Killer 1535 802.11ac 2x2 WiFi (Qualcomm Atheros QCA6174) | Works | ath10k_core ath10k_pci linux-firmware | |
Touchscreen | ELAN Touchscreen | Works | usbhid hid_multitouch | 4.15.4 |
Touchpad | Synaptics TouchPad | Works | mouse_ps2_synaptics_smbus | 4.13.0 |
Bluetooth | Killer 1535 Bluetooth | Works | bluetooth btrtl btintel bnep btbcm rfcomm btusb linux-firmware | 4.15.4 |
USB 3.0 | Works | xhci_hcd | ||
Thunderbolt 3 | 2 lanes of PCI Express Gen 3. Supports: Power In / Charging, PowerShare, 40Gbps Bi-Directional, 3.1 USB Gen 2 (10Gbps), VGA, HDMI, Ethernet and USB-A via Dell Adapter (Sold Separately) | Untested | ? | |
SD Card Reader | SD, SDHC, SDXC | Works | ? | |
Webcam | Widescreen HD (720p) | Works | uvc | 4.14.8 |
Microphone | Dual array digital microphones | Works | ? | |
Fingerprint reader | 138a:0091 Validity Sensors, Inc. | No | None (see below) |
Regarding the unsupported fingerprint reader, according to arch wiki, "The fingerprint reader is a Validity/Synaptics model with USB id 138a:0090. There currently is no Linux driver but an open source Linux driver is being developed by reverse engineering the Windows driver.". This implies some or earlier versions have the 138a:0090 version, which a driver is now functional for, however mine has the 138a:0091 version, which is unsupported. See driver development github repository for further information.
Accessories
Some models have touch screens. Some models are 2-in-1 (break apart). I tested on a conventional (non break apart) model with touch screen, however the touch screen has not been tested. A dock exists however I have never seen it and wouldn't personally make use of it. Other reports have described docks in this series as functional, however.
Installation
Goals
A philosophical question would be: "Why buy new hardware if we aren't going to use the latest and greatest in software features?" Therefore, we are going to push the boundaries of the possible by setting up a ZFS root partition, because from past experience this will save time later.
ZFS on root setup is kind of obtuse owing to the need for an initial RAM filesystem initramfs which creates a bit of a hassle building and upgrading the kernel. The best documentation on this I could find was Funtoo's ZFS Install Guide so we will essentially attempt to follow that.
If you really want to maximize physical security you should invest the additional time in building a dm-crypt/LUKS-encrypted root partition.
There are partial notes towards achieving this added along the way, but it is not yet a fully tested configuration.
An alternative would be to use native ZFS encryption which is documented over here.
Booting Linux for the first time
All current data on the USB key will be lost!
- First, create a bootable USB with a ZFS enabled. The easiest way to do this is as follows.
- Install UNetbootin (from its homepage)
- Plug in any USB mass storage device (aka. "usb key") with a decent size (16GB+) that you don't mind wiping (all data current stored on the device will be lost!)
- Start UNetbootin
- Select the latest Ubuntu Live DVD image (I used Ubuntu 18.04)
- Let UNetbootin download and install it on to the USB mass storage device
- Now you have a bootable Linux mass storage device with ZFS support
- Enter BIOS. Turn on the Dell XPS 15 9560 laptop and press F2 repeatedly.
- Disable secure boot
- Enable legacy boot
- Switch the NVMe internal flash unit to AHCI mode
- Plug in your bootable Linux mass storage device with ZFS support
- Save changes and exit
- The system should now boot to the Ubuntu live DVD boot menu.
- Press the arrows to select the 'Try ubuntu' option
- Press tab in order to edit the options
- Before the final --- add one more option, nomodeset. This prevents crashing when starting the GUI.
- Press enter to boot.
- Open a terminal.
- Become root via
user $
sudo bash
Installation procedure
Remove Windows 10
First of all we want to wipe all the pre-installed Windows 10 junk and recovery partitions.
- The internal SSD drive will appear as /dev/nvme0n1, and it contains needless Windows 10 recovery partitions.
- Using a partition management tool such as fdisk or cfdisk delete all of the current partitions. For example, using cfdisk we would run then delete all partitions, write the new partition table and exit. The disk should only show "free space" when we are done.
root #
cfdisk /dev/nvme0n1
- Using a partition management tool such as fdisk or cfdisk delete all of the current partitions. For example, using cfdisk we would run
- ZFS will use the whole drive, so no partitions are required. Note that even though we use the whole drive (
/dev/nvme0n1
represents the whole drive and not a partition), ZFS has a smart design that means there is still space for a Master Boot Record (MBR), so we can install a boot loader on the disk without causing damage to the ZFS data.
Connect to the internet
Now we want to connect to the internet.
- Click the down arrow in the top right, and choose 'Select Network' beneath 'Wi-Fi Not Connected'.
- Enter your local wireless network information.
- Verify that the wireless network connected by clicking the down arrow in the top right again. If connected, it should now show the network name.
Install ZFS
Now we want to tell the Ubuntu Live DVD to get ZFS support.
root #
apt-add-repository universe
'universe' distribution component enabled for all sources.
We now tell it to fetch updated package information from the internet:
root #
apt update
This will take some time to download updates.
Finally, we install the ZFS support.
root #
apt install --yes zfs-initramfs
(...) update-initramfs is disabled since running on read-only media
Verify ZFS is loaded
root #
dmesg|grep -i zfs
[ 883.908387] ZFS: Loaded module v0.6.5.11-1ubuntu3, ZFS pool version 5000, ZFS filesystem version 5
Create the ZFS pool
root #
zpool create -f -o ashift=12 -o cachefile=/tmp/zpool.cache -O normalization=formD -O atime=off -m none -R /mnt/gentoo pool /dev/nvme0n1
root #
zpool status
pool: pool state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM pool nvme0n1 ONLINE 0 0 0 errors: No known data errors
Create ZFS root dataset
This is where the root filesystem will live.
root #
zfs create -o mountpoint=/ pool/root/gentoo
If you want to create zpool with ZFS encryption then you should add some arguments here, for example
-o encryption=on -o keysource=passphrase,prompt
Create additional ZFS datasets
Optional.
root #
zfs create -o mountpoint=/usr/portage -o compression=lz4 -o sync=disabled pool/gentoo-portage
root #
zfs create -o mountpoint=/home pool/home
Verify ZFS datasets
root #
zfs list -t all
NAME USED AVAIL REFER MOUNTPOINT pool 792K 461G 96K none pool/gentoo-portage 96K 461G 96K /mnt/gentoo/usr/portage pool/home 96K 461G 96K /mnt/gentoo/home pool/root 192K 461G 96K none pool/root/gentoo 96K 461G 96K /mnt/gentoo
Make the root filesystem bootable
To do this, we set the ZFS pool's bootfs property as follows.
root #
zpool set bootfs=pool/root/gentoo pool
We then verify the setting.
root #
zpool get bootfs pool
NAME PROPERTY VALUE SOURCE pool bootfs pool/root/gentoo local
Populate the root filesystem, create kernel + initrd (initial ramdisk)
First install links.
root #
apt install links
Now follow the standard installation procedure in the Gentoo AMD64 Handbook, until you reach the section titled Configuring the bootloader, then return to this guide.
If you are attempting to build with encrypted root support then you will want to run
echo "sys-kernel/genkernel cryptsetup" >>/etc/portage/package.use/genkernel && emerge -av genkernel
before continuing.
Note that when setting up the kernel:
- Not all kernel versions are supported by ZFS on Linux
- Because ZFS on Linux is therefore going to limit which kernel version you can install, the best way to select a kernel version is to install the very latest ZFS on Linux (and spl which is a Solaris porting layer) and work backwards from there, ie.
root #
echo "=sys-fs/zfs-9999 **" >>/etc/portage/package.accept_keywords
root #
echo "=sys-fs/zfs-kmod-9999 **" >>/etc/portage/package.accept_keywords
root #
echo "sys-kernel/spl-9999 **" >>/etc/portage/package.accept_keywords
- Some version of the kernel sources should now be present in /usr/src/linux and you can use that to configure your system.
- After you have built the kernel, run make install to place it in /boot. This will ensure naming conventions are followed which will later allow grub to detect the kernel.
- Once configuration is complete, feel free to use genkernel to generate an initial ramdisk (initrd) as follows:
root #
emerge genkernel
root #
genkernel initramfs --zfs --firmware
If you are attempting to build with encrypted root support then you will want to execute genkernel initramfs --zfs --firmware --luks instead!
- The ramdisk will be installed to /boot/ in such a way that grub can detect it.
Install grub2 bootloader
In order to boot from a ZFS filesystem we need to install a version of the grub boatloader with USE=libzfs enabled.
Let's just install the absolute latest version.
root #
echo "=sys-boot/grub-9999 **" >>/etc/portage/package.accept_keywords
root #
echo "=sys-boot/grub-9999 libzfs" >>/etc/portage/package.use/grub
root #
emerge -av grub
Once the grub program is installed on the system, we double-check that grub can see our ZFS volume.
root #
grub-probe /
zfs
If you run in to issues, try copying the `zfs` device file from the host to the chroot as follows:
root #
cp -a /dev/zfs /path/to/chroot/dev/zfs
Now we want to configure it to support ZFS.
/etc/default/grub
Configure grubGRUB_CMDLINE_LINUX="dozfs real_root=ZFS=pool/root/gentoo"
If you are attempting to build with LUKS-encrypted root support then you will want to set additional kernel arguments. First specify the encrypted device with
crypt_root=ZFS=pool/root/gentoo
then specify the unencrypted device created by LUKS via real_root=/path/to/unencrypted/device/after/LUKS/runs
.Now we generate a configuration file.
root #
grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.14.8-gentoo-r1 Found initrd image: /boot/initramfs-genkernel-x86_64-4.14.8-gentoo-r1 done
Double-check that the generated configuration file includes an instruction to load the ZFS module.
root #
grep 'insmod zfs' /boot/grub/grub.cfg
insmod zfs
Now double-check the ZFS module is in place.
root #
ls /boot/grub/*/zfs.mod
/boot/grub/i386-pc/zfs.mod
Finally, we can tell it to install at the beginning of the NVMe disk.
root #
grub-install /dev/nvme0n1
Installing for i386-pc platform. Installation finished. No error reported.
Preparing to reboot
First install networking stuff you may have forgotten.
root #
emerge wpa_supplicant dhcpcd
Don't forget to set a password!
root #
passwd
Exit the chroot environment.
root #
exit
Unmount the various filesystems.
root #
umount -l /mnt/gentoo/{dev,sys,proc}
root #
umount /mnt/gentoo/usr/portage
root #
umount /mnt/gentoo/home
root #
umount /mnt/gentoo
Double check the ZFS mountpoint property is correctly set for the root partition.
root #
zfs set mountpoint=/ pool/root/gentoo
Now reboot, being careful to remove the live USB once the machine resets to enable booting from the internal NVMe flash.
root #
reboot
Firmware
BIOS version on receipt was 1.3.4
with ePSA Build 4304.17 UEFI ROM
.
We need the sys-kernel/linux-firmware package to operate the wireless chipset and to provide firmware to upload to the Intel graphics controller to enable things like proper power management.
root #
emerge linux-firmware
make.conf
We want to enable a few things in /etc/portage/make.conf ...
/etc/portage/make.conf
Setting VIDEO_CARDS and INPUT_DEVICESVIDEO_CARDS="nvidia" INPUT_DEVICES="evdev wacom keyboard mouse libinput synaptics"
Kernel
CONFIG_INPUT_EVDEV=y
CONFIG_NVME_CORE=y CONFIG_NVME_=y
CONFIG_ATH10K=m=y CONFIG_ATH10K_PCI=m CONFIG_ATH10K_AHB=y CONFIG_ATH10K_USB=m
CONFIG_RTC_CLASS=y CONFIG_RTC_HCTOSYS=y CONFIG_RTC_SYSTOHC=y CONFIG_RTC_NVMEM=y CONFIG_RTC_INTF_SYSFS=y CONFIG_RTC_INTF_PROC=y CONFIG_RTC_INTF_DEV=y CONFIG_RTC_DRV_CMOS=y
CONFIG_DELL_SMBIOS=y CONFIG_DELL_WMI=y CONFIG_DELL_WMI_AIO=y CONFIG_DELL_WMI_LED=y CONFIG_DELL_SMO8800=y CONFIG_DELL_RBTN=y
Probably not all of these are needed, but I am too lazy to isolate the correct option. To test this is working, emerge acpid then run acpid && acpi_listen on the command-line. Pressing the various function keys such as F11/F12 for brightness up and down should show events like
BRTUP
and BRTDN
. If you don't have the correct kernel flags, these will simply shown zeroes and no named/registered ACPI events.For x86 and AMD64 processors, the in-kernel framebuffer driver conflicts with the binary driver provided by NVIDIA. When compiling the kernel for these CPUs, completely remove support for the in-kernel driver as shown:
Device Drivers ---> Graphics support ---> Frame buffer Devices ---> <*> Support for frame buffer devices ---> < > nVidia Framebuffer Support < > nVidia Riva support < > Userspace VESA VGA graphics support < > VESA VGA graphics support <*> Simple framebuffer support < > EFI-based Framebuffer Support
Now make sure the nouveau
driver is disabled:
Device Drivers ---> Graphics support ---> < > Nouveau (nVidia) cards
Ensure MTRR and kernel module support are enabled.
[*] Enable loadable module support ---> Processor type and features ---> [*] MTRR (Memory Type Range Register) support
CONFIG_FB=y CONFIG_FB_BACKLIGHT=y CONFIG_FB_NVIDIA=n CONFIG_FB_RIVA=n CONFIG_DRM_NOUVEAU=n CONFIG_FB_EFI=n CONFIG_FB_VGA16=n CONFIG_FB_UVESA=n CONFIG_FB_SIMPLE=y
Unsure whether in-kernel AGP or builtin nvAGP is better on this device. Apparently this varies by device. The switch is this option.
Device Drivers ---> Graphics support ---> -*- /dev/agpgart (AGP Support) --->
Configuration
Touchpad
Synaptics touch pad.
root #
emerge --ask xf86-input-synaptics
You can tune this with a tool, see the arch linux page on synaptics touchpad for more details.
Bumblebee / Primus
Hyrbid Graphics (GPU Switching) is available on the XPS 15 9560. Follow the Gentoo Bumblebee Wiki guide to installing it.
There is a known bug with Bumblebee whereupon the user cannot start an x server or make any PCI but calls while the GPU is switched off. Symptoms will be a complete system hang when running nvidia-smi
or lspci
or similar while Bumblebee is ON, bbswitch is enabled, and the discrete GPU is off.
The answer lies in [this Reddit thread] and [this Arch forums post]. Add GRUB_CMDLINE_LINUX_DEFAULT='acpi_rev_override=5 modprobe.blacklist=nvidia nvidia.modeset=0 pcie_port_pm=off acpi_osi="Windows 2009"'
to a grub config file then rebuild grub.
It was necessary on my system to configure Xorg to use the Intel iGPU by default and to have the
nvidia
module loaded in order to start an X server without the system hanging. See the Troubleshooting Section of the wiki.Troubleshooting
Slow 2D graphics
According to this page slow 2D performance attributed to a BIOS setting can be identified via:
root #
cat /proc/mtrr
reg00: base=0x00000000 ( 2048MB), size= 2048MB, count=1, uncachable ...
If any line contains the word "uncachable" apparently you need to reboot, enter BIOS, and change an MTRR setting from 'continuous' to 'discrete'. However, on my machine while this is certainly the case, I cannot find such an option in the BIOS.
Interrupted setup
If your setup is interrupted for whatever reason, you can re-mount the ZFS root dataset as follows.
root #
zfs set mountpoint=/mnt/gentoo pool/root/gentoo
root #
zfs mount pool/root/gentoo
You then want to ensure the other mounts have not been made in the host.
root #
zfs unmount pool/home
root #
zfs unmount pool/gentoo-portage
Then re-enter the environment.
root #
mount --rbind /proc /mnt/gentoo/proc
root #
mount --rbind /sys /mnt/gentoo/sys
root #
mount --rbind /dev /mnt/gentoo/dev
root #
mount --make-rslave /mnt/gentoo/proc
root #
mount --make-rslave /mnt/gentoo/sys
root #
mount --make-rslave /mnt/gentoo/dev
root #
chroot /mnt/gentoo /bin/bash
root #
env-update
root #
source /etc/profile
root #
export PS1="(chroot) $PS1"
Then re-mount the other datasets.
root #
zfs mount pool/home
root #
zfs mount pool/gentoo-portage
When you are done, before you reboot, be sure to set the mountpoint back to root.
root #
zfs set mountpoint=/ pool/root/gentoo
X11 fails to start with "No Screens Found"
This can be because you have enabled the efifb
EFI Framebuffer Driver in the kernel. Disable it. Only CONFIG_FB_SIMPLE=y
(Simple Framebuffer) is OK to leave enabled!
Crash on X11 startup
This can occur you have the nouveau
driver enabled. You can work around it by adding nomodeset to the kernel command line.
See also
- Closed source NVidia drivers and open source Nouveau drivers and how to switch between them.
- Qualcomm Atheros QCA6174 and Gentoo AMD64 Handbook Wireless Networking
- ZFS
- ZFS/root
External resources
- https://www.anandtech.com/print/11670/the-dell-xps-15-9560-review-infinity-edge-part-two
- https://wiki.archlinux.org/index.php/Dell_XPS_15_9560
- https://www.funtoo.org/index.php?title=ZFS_Install_Guide
- https://github.com/strelec/dell-xps-15-kernel-config
- https://browser.geekbench.com/geekbench3/8250863
- https://forums.gentoo.org/viewtopic-p-8114160.html
- https://grahamc.com/blog/nixos-on-dell-9560