Home
Got Linux ?

Blah blah blah... Mostly technical thoughts, rants and gibberish


Running Debian on the “New” Dell XPS 13 (9380)

[UPDATED 2023.07.10] This page has been updated for Debian 12 (Bookworm).

[UPDATED 2021.10.01] This page has been updated for Debian 11 (Bullseye).

[ORIGINAL 2019.05.22] This page was first written for Debian 10 (Buster).

The “New” Dell XPS 13 (9380) - released early 2019 - is allegedly one of the best ultrabook money can buy, short of selling one’s soul out to Apple.

Dell XPS 13 (9380)

Especially more so when your company’s paying for it - after 10 years of faithful services - and you cram all the options there are to cram in the little beast:

W-O-W-!-!-!

But now, given my close-to-petrified-wood sysadmin nature and my willingness to ditch the Canonical’s blasphemy in favor of sanctified - but potentially too arcane - Debian, all of that might well have been for naught.

In the end, the experience turned out to be quite (very) pleasing! Bear with me!

Accessing and Swapping the NVMe SSD

Since I wasn’t sure this endeavor might turn to my advantage and I had a 512GB Samsung 970 PRO handy - who doesn’t ?! - my first task has been to open my little cuty and swap the NVMe SSD chip (and keep the pristine Ubuntu install handy, just in case).

To be honest, after removing the obvious screws, I did break a sweat. How the hell was I supposed to get the thing to show me its entrails?!? It turned out one needs to gently - but firmly - pry the thing open, using a plastic tool inserted between the aluminium base and the plastic case to unclip the plastic clips holding the base and case together. The most hard-holding and bigger clips are the ones at the rear, which one shall defeat by skewing the aluminium base forward (relative to the plastic case) once the other sides (left, front, right) freed.

Therefrom, piece of cake. Unscrew the original SSD chip, screw the new one in, skew the aluminium base back onto the plastic case and clip all sides tight, put all screws back in place. Et voilĂ !

Initial Installation

I installed Debian (10) Buster using the 5th alpha release of the netinst installer, with a CD-ROM hooked to the Dell DA300 USB-C hub:

Debian Installer

Dell DA300 UBS-C Hub

A no brainer, except for two things worth noting:

Kudos to Debian for shipping an installer - even its alpha flavor - that just worked (incl. preseeding, encryption, LVM, etc.).

Post Scriptum: at this stage, I just got me a minimalistic console-based system since I do not rely on Debian taskset to perform the full system installation but by own Custom Configuration Framework:

custom-conf

And, in particular, my custom XFCE meta-packaging:

custom-pack-xfce4

4K, HiDPI and… Linux

Ok. Squeezing 8M (3840x2160) pixels into a 13.3" display - that’s 330 DPI for you - certainly makes for an eye-pleasing experience. In theory. Until you are abruptly confronted to practicalities and find out you might need some enhanced cybernetic eyes to cope with the default fonts used by GRUB, the kernel and eventually X.

Geeh! Those characters are small! Can’t even make one pixel from another! So cool! Well… Still. Let’s start by accomodating regular human eyes.

There are two way to do so: change the fonts used by each subsystem or change the resolution of the screen for that subsystem. Believe me, as far as GRUB and the kernel are concerned, the latter is far more easy! (and acceptable; I might be close to fossilized but I do spend most of my time in X rather than tty1-6)

GRUB

Update your /etc/default/grub with:

GRUB_GFXMODE="1280x1024x32"
GRUB_GFXPAYLOAD_LINUX="keep"
GRUB_TERMINAL="gfxterm"

And enforce the changes by running:

update-grub

(unfortunately, 1920x1080 resolution is not available as a VESA mode for GRUB)

Kernel and text console

Reconfigure the consule-setup package to use a VGA, 16x32 font:

dpkg-reconfigure console-setup

[UPDATED 2023.07.10] Alternatively (up until Debian 11)

Set the video kernel option:

GRUB_CMDLINE_LINUX="video=1920x1080"

And enforce the changes by running:

update-grub

LightDM greeter

Start by making your /etc/lightdm/lightdm.conf a little more friendly to wicked sysadmins:

[Seat:*]
display-setup-script=run-parts --exit-on-error --verbose /etc/lightdm/display-setup.d
greeter-wrapper=/etc/lightdm/Xsession-greeter

Then use the GDK_SCALE environment variable to scale all elements by a factor of 2; in /etc/lightdm/Xsession-greeter:

export GDK_SCALE='2'
exec $@

[UPDATED 2023.07.10] Alternatively (up until Debian 11)

And use a /etc/lighttdm/display-setup.d/10xrandr script:

xrandr --output eDP-1 --mode 1920x1080

XFCE desktop

Once logged in, just use XFCE Menu > Settings > Display dialog to make sure you get the full UHD (4K) resolution back into play.

And then boost your XFCE Menu > Settings > Appearance > Fonts > DPI to something closer to what your screen actually sports (I set mine at 240).

Mozilla Thunderbird

For most applications, setting the Appearance DPI adequately is enough to have fonts enlarged as needed.

Unfortunalely, Thunderbird needs a little more tweaking. You will have to go to Edit > Preferences > Display > Formatting > Advanced and set your preferred fonts and size - especially the Minimum font size - for both the Latin and Other Writing Systems (Fonts for). The latter in particular will be used for plain text messages (which are the only kind of message you send/receive, ain’t they?!).

Hardware Support

Careful! Here be dragons! Or at least I thought… Sorry Linux/Debian/Dell for this lack of faith! Eventually, everything just works!

Secure Boot

Starting with Debian (10) Buster and kernel package 4.19.0-4, Secure Boot is supported seamlessly once the ad-hoc packages are installed:

grub-efi-amd64-signed
shim-signed
linux-image-amd64 (>= 4.19+104)
# (depending on linux-image-4.19.0-4-amd64 or above)

(and reportedly as seamlessly with the installer’s 1st release candidate)

Then, once Secure Boot enabled in the System Setup (UEFI), your machine should just… boot! No more bells and whistles than that.

To verify Secure Boot is properly enabled:

mokutil --sb-state
# => "Secure Boot enabled"

WARNING: Hibernation does not work along Secure Boot (by design):

Hibernate vs Secure Boot

(which is a pity, knowing if you have Secure Boot enable, your laptop is most likely encrypted, swap partition included)

Intel Corporation UHD Graphics 620 (Whiskey Lake)

Make sure to install the following packages:

firmware-misc-nonfree
xserver-xorg-video-intel
(custom-conf-xorg-intel)

VAAPI/VDPAU acceleration

Make sure to install the following packages:

i965-va-driver
libvdpau-va-gl1

Qualcomm Atheros QCA6174 802.11ac wireless network adapter

Make sure to install the following packages:

firmware-atheros

Dell WD15 docking station ethernet network adapter

Make sure to install the following packages:

firmware-realtek

Synaptics touchpad

Make sure to install the following packages:

xserver-xorg-input-synaptics

PS/2 Mouse

Well, actually, there ain’t any PS/2 mouse on the XPS 13. But the driver/module will complain noisily and unesthetically at boot. So better disable it, for the sake of your maniac-compulsive disorder; in /etc/modprobe.d/psmouse-disable.conf:

blacklist psmouse

And make sure to update the boot image:

update-initramfs -u

Firmware Updates

The Dell XPS 13 (9380) is fully supported by the Linux Vendor Firmware Service LVFS initiative.

First make sure the Security > UEFI Capsule Firmware Updates setting is enabled in the UEFI settings and then:

apt-get install fwupd-amd64-signed

fwupdmgr get-devices
# => make sure the "XPS 9380 Firmware" is listed

fwupdmgr get-updates
# => fetch the list of updates (network required)

fwupdmgr update
# => system will be rebooted and updates applied

Power Consumption and Autonomy

Some fine-tuning allows to obtain autonomy figures that are close to 12 hours for a standard bureautic usage - like typing this document (less than 5W average power consumption) - down to 5 hours while entertaining one’s self - watching 4K videos (with an average power consumption peaking around 12W).

Deep sleep (Suspend-to-RAM)

[UPDATED 2021.10.01]

Make sure to switch the Intel “disk” controller from RAID to AHCI in UEFI and verify deep sleep is enabled:

cat /sys/power/mem_sleep
# => s2idle [deep]

Then add the following stanza in your GRUB configuration (for some reason, the default sleep mode might remain set to s2idle; ACPI bug ?); in /etc/default/grub:

GRUB_CMDLINE_LINUX="mem_sleep_default=deep"

Power management fine-tuning

Of course, there are excellent sources of insight on the subject, like Arch Linux Power Management page:

Arch Linux Power Management

But in the end, it might just be simpler to install PowerTOP:

apt-get install powertop

And let it auto-tune your system at boot time, using systemd; in /etc/systemd/system/powertop-autotune.service:

## PowerTOP auto-tuning (at boot)
#  (run 'systemctl daemon-reload' to enforce changes, 'systemctl enable powertop-autotune' to enable)
[Unit]
Description=PowerTOP auto-tuning
Documentation=man:powertop(8)

[Service]
Type=oneshot
ExecStart=/usr/sbin/powertop --auto-tune
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

(PowerTOP auto-tuning kind of encompasses all the recommendations you might find out there on enhancing your Linux power saving experience)

XFCE Power Manager integration

In order for XFCE Power Manager to work as expected, make sure to tweak systemd’s login daemon configuration; in /etc/systemd/logind.conf:

# Ignore those keys/actions (and let XFCE Power Manager do its job)
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
# BUG: https://bugzilla.xfce.org/show_bug.cgi?id=12756
# QRK: xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -s false
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore

CPU, PCIe and subsystems (Bluetooth, WLAN) power saving

Grab the /etc/scripts/xps13-9380-control script from GitHub:

XPS 13 (9380) control script

And grant yourself the proper sudo privileges to run that script:

%users ALL=NOPASSWD: /etc/scripts/xps13-9380-control

You can now use it in any bash aliases, keyboard shortcut or script you deem necessary.

Bugs and Quirks

Although we might blessed on the hardware side, things aren’t as shiny on the software - Debian/Buster - side.

Given my personal requirements, I stumbled on two major issues.

Network Manager Applet and hidden SSIDs

[UPDATED 2021.10.01] This issue has been solved as per Debian 11 (Bullseye)

Ok. Don’t start. I know. Hiding one’s SSIDs achieves no security purpose per se. But still, I see of no reason to advertise to my entire neighborhood - people that don’t even know what a SSID is but do know how to misconfigure their smartphones - that I run both a guest WiFi network (which they might be welcome to) and another one reserved for my personal usage (which they ought to f**** off from!).

So, back to our purpose. The version of the Network Manager Applet that ships with Debian Buster has a known bug (and patch) that makes the applet crash when you attempt to connect to a hidden WiFi network:

Network Manager Applet Bug/Patch

I incorporated the patch into my own rebuilt network-manager-gnome package, which does fix the problem.

I was willing to report the bug and its solution to Debian, but when I found the poor state in which the Bug Reports page for that package is, I just gave up:

network-manager-gnome Bug Reports

GNOME Keyring integration

[UPDATED 2020.05.21] Forget about the GNOME Keyring integration! This thing is dead…

Well, say what you want, but having passwords scattered all around my filesystem - as encrypted as they may be - just doesn’t bid well for the quality of my sleep.

The GNOME people very kindly provided us the Keyring - an architecturally sound approach to credentials management, which blends in nicely with the rest of the system thanks to PAM - and I see of no reason why I should cope with software that reinvent their own wheel (and ask me for N master passwords, for N separate password databases).

So, given I personally prefer(red) using Mozilla Thunderbird and Firefox for my connectivity endeavors, I used to install the GNOME Keyring integration extension:

GNOME Keyring integration extension

Catch is this extension relies on the libgnome-keyring0 package, which unfortunately doesn’t ship with Debian/Buster anylonger:

libgnome-keyring deprecated

I ended-up forward porting the bastard from Debian Stretch, praying and hoping GNOME Keyring integration might just be considered seriously - one day - by Mozilla, though signs are currently pointing in quite the opposite direction:

GNOME Keyring in Firefox

[UPDATED 2020.05.21]

And now Thunderbird also dumped support for the GNOME Keyring… While Google and its Corporate America arrogance kept pissing me further out…

Secret Service integration

[UPDATED 2020.05.21]

GNOME Keyring per se being out of the picture, I went on looking for a decent, open source (well, I said decent, so this is a pleonasm) and multi-platform password manager and set down on KeepassXC, which works a breeze with Firefox (on Linux), more-or-less OK with Firefox on Android and unfortunately not-at-all with Thunderbird. Oh well…

KeepassXC

[UPDATED 2021.10.01]

The nice things about KeepassXC is its integration with the FreeDesktop (DBUS) Secret Service and its ability to be easily accessed via libsecret (and tools).

FreeDesktop Secret Service

libsecret

KeepassXC integration

And There You Go!

Enjoy your new, shiny, Debian-backed XPS 13 (9380) laptop and go showing off around what a really antique sysadmin you are!