OlegMikheev.com

Upgrading Laptop, the Gentoo Way

My plans to wait for Linux ARM (Snapdragon X Elite) support to stabilize before upgrading my 4 year old HP Spectre got derailed by its failed USB-C, making me upgrade now, and do a quick review of what’s going on in the world of laptops, CPUs and Linux. To avoid extra effort learning new platform I chose the same but the most current HP Spectre, which has been around long enough to get Linux support to stabilize.

CPU

The old laptop had an i7-1165G7, of September 2020, 10 nm 4 cores and 8 threads. My basic benchmark is time to compile a vanilla kernel, with make -j`nproc`. It was taking about 15 minutes.

The new laptop has Ultra 7 155H, of December 2023, 7 nm, 16 cores and 22 threads. It takes about 7 minutes to build a kernel with the same config. While that’s less than half the old time, it seems low given the CPU has four times more cores. However out of 16 just 6 are performance cores, other 8 are “effective” cores and there are two more AI cores. I feel sorry for CPU scheduler developers.

I wish I could try the ARM Snapdragon X1E-80-100, which reportedly performs on par with 155H, but consuming half the energy.

Partitioning

I used legacy BIOS mode feature on old laptop to dual boot, but there’s no such thing any more, everything is UEFI now. The way GParted resizes EFI partition (need space for grub and some images), and the way it moves Windows partitions can allegedly make Windows fail to boot (but I didn’t try).

Fortunately there’s a tool called AOMEI Partition Assistant. It’s got an interesting licensing model with two different versions – Free and Demo. Demo doesn’t do anything, but the Free one does the job. It resized the EFI, resized Windows partition (had to disable encryption manually) and moved it (and others) to the right.

After that proceed to creating partitions, not forgetting to add encryption. Unfortunately Linux / LUKS still not able to encrypt existing partitions in-place, they need to born encrypted.

Gentoo Install

Nothing in particular, no surprises. It’s my first laptop that has fingerprint reader working out of the box, and sudo fingerprint integration is manure and handy. Display Managers support fingerprints as well, but when Fscrypt is configured to use password as the encryption key, logging in with a fingerprint obviously doesn’t work (encrypted folders stay unlocked.)

The only device that didn’t work out of the box was video camera, it takes quite some effort to get enabled.

Wifi fails to suspend, or rather fails to resume after suspend. Had to add a script to remove the driver before suspend and add it back after resume. I don’t have systemd, so sleep events are captured by elogind:

$ cat /etc/elogind/system-sleep/wifi.sh 
#!/bin/sh
case "$1" in
  pre)
    echo "Suspending, removing wifi" | logger
    modprobe -r iwlmld iwlwifi
    ;;
  post)
    echo "Resumed, adding wifi" | logger
    modprobe -a iwlmld iwlwifi
    ;;
esac

Display Server / Desktop Environment / Window Manager / Compositor / Display Manager

Display Server. This is where is gets interesting, and where I had to say good-bye to Xorg. My old laptop was happily running the lightweight Xfce4, and it was possible because laptop screen DPI was matching (more or less) the external monitors. The new laptop has a Hi-DPI screen, and combined with external monitors it results in unreadable scaling: tiny fonts / GUI elements on the laptop screen and gigantic fonts on the monitors.

Xorg is not capable of setting DPI per monitor. It never will, was not designed for that. So it has to go and get replaced with Wayland, which is fortunately is mature enough by now.

Desktop Environment: Xfce4 has only experimental Wayland support, so had to replace it with the next lightest option, which is LXQt.

Window Manager. KDE currently has the most mature Wayland support. But I don’t want a full KDE as it’s a pretty heavy creature. Kwin is its window manager, that is distributed as a module and can work outside of KDE. So I chose this one and it worked right away, Gentoo has a nice KWin ebuild designed specifically for this modular use case. It was painless except that in order for KDE settings to work I had to emerge qtquickcontrols2 and qqc2-desktop-style.

Compositor. KWin has a built-in Wayland compositor that brings transparency and wobbliness to GUI. This is the most exciting part of the setup, as since I first experienced the original Compiz almost 20 years ago I can’t imagine a GUI without effects. Unfortunately many classic X11 effects like 3D cube haven’t been ported to Wayland yet.

Display Manager: I failed to make LightDM start Wayland sessions not matter what I did, so had to switch to SDDM.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *