I'm facing an issue with Thunderbolt on a Lenovo Yoga X1 Gen8 in conjunction with the Lenovo Thunderbolt 3 Dock (40AN, Gen 2) when using Ubuntu 24.
On my older HP ProBook 450 G6 (with only USB 3.2 support, no Thunderbolt), the dock works fine in initramfs/plymouth while entering the LUKS passphrase. However, on the Lenovo Yoga X1 Gen8 it does not - which hinders me to use the 1-cable docking solution as I can not type in my password without modifying the setup, f.e. connecting the Keyboard directly to the laptop. -> Side note: I just swapped the SSD of my old machine into the new machine yesterday, so it is the exact same installation that is starting and causing this behavior.
During initramfs boot, Thunderbolt is recognized, but devices connected to the dock (monitors, keyboard) "fail" to work. The keyboard's backlight even turns off at this stage, which is why I assume they are turned off on purpose by some policy.
Pre-boot environments (UEFI and GRUB) recognize the dock as a USB device, initializing all USB devices connected to it successfully, which is why I know everything does work fine. But once Thunderbolt module is loaded during initramfs, the USB devices seemingly shut down.
My Findings: Thunderbolt is being recognized, as evident by on-screen text logs in plymouth/text console like:
thunderbolt 1-0:1.1: new retimer found, vendor ...
thunderbolt 1-1: new device found, vendor ...
thunderbolt 1-1: Lenovo ThinkPad Thunderbolt 3 Dock
I assume the problem lies in how initramfs handles Thunderbolt in general or in this Lenovo Laptop/Dock Combination. My guess is that this could be related to security policies and the module loads fine. Other users considered the thunderbolt module is not loaded or loaded faulty. See: Lenovo docks not recognized in initramfs after upgrading to Ubuntu 24.04
Workaround: Disabling Thunderbolt 4 "PCIe" Passthrough in the UEFI makes the dock work as a USB4 , which again makes it work during initramfs. The keyboard and other devices connected to the dock are functional again. However, this disables Thunderbolt functionality entirely, which isn't ideal as the systems properly uses the authorized (boltctl displays Authorized Connection) device post-encryption.
I was considering to exclude the Thunderbolt module during initramfs to enforce USB recognition, and later allow to load the thunderbolt module (post-LUKS decryption) again.
1. via GRUB Parameter: Using a GRUB boot parameter to disable Thunderbolt during initramfs.
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="thunderbolt.no_pcie=1"
This solution was proposed to me by ChatGPT 4o, but I suspect this parameter doesn't exist or would globally disable Thunderbolt, which defeats the purpose.
2. Modify Initramfs Configuration:
Tinkering with initramfs.conf to change MODULES parameter, like
sudo nano /etc/initramfs-tools/initramfs.conf
MODULES=list or MODULES=dep
The idea to manually exclude Thunderbolt modules by creating a curated list of allowed modules sounds appealing, but this approach could become messy, especially with kernel updates or dependencies, requiring constant manual adjustments of the list.
3. "Blacklist" Thunderbolt Modules in Initramfs:
The ideal approach to me would involve blacklisting Thunderbolt module only during initramfs creation, allowing USB devices to initialize normally: Writing a hook script to exclude Thunderbolt modules during initramfs generation as described in Debian's initramfs-tools documentation suggests this is feasible: https://manpages.debian.org/buster/initramfs-tools-core/initramfs-tools.7.en.html
But I am concerned if adding a hook script for Thunderbolt exclusion would be a reliable and clean solution - something I feel reluctant to experiment with on my production system without actual advice as I am not experienced in coding working hook scripts and afraid to brick initramfs.
In addition, I ask myself what would be the cleanest solution to later load thunderbolt, like via modprobe or with some user configs that are loaded anyway.
Q: Are there better ways to selectively control module loading during initramfs, and loading them in some later stage again?
Thanks for your help