You are not logged in.

#1 2025-05-01 12:52:27

kustodian
Member
Registered: 2020-06-26
Posts: 7

USB not working in initramfs on X1 Carbon Gen11 on Thunderbolt dock

I have an X1 Carbon Gen 11 that is connected to the ThinkPad Thunderbolt 3 Dock Gen 2. An external monitor and many USB devices (keyboard, mouse, USB storage, etc.) are connected to the dock, and everything works when Arch boots. I use rEFInd as the boot loader, and both the monitor and the USB devices work in it as well. The problem is that when the initramfs is loaded, the monitor works, but none of the USB devices work. This worked before without any issues, but after a few months, after an Arch upgrade, they stopped working. I know this because I configured disk encryption, which reads the decryption key from a USB storage device that is attached to the dock, and the fallback is the keyboard. Since none of the USB devices work while in the initramfs phase, and my keyboard is also attached to the dock via USB, it also doesn't work, so I have to type the password on the laptop's keyboard. The monitor that is attached to the dock works without any issues.

My mkinitcpio.conf looks like this (excluding the comments and empty lines):

$ grep -vE '#|^$' /etc/mkinitcpio.conf
MODULES=(i915 usb_storage thunderbolt)
BINARIES=(setfont)
FILES=()
HOOKS=(base udev autodetect consolefont keymap modconf keyboard block encrypt filesystems fsck)

If I plug the USB storage device that contains the decryption key directly into the laptop as well as the keyboard, everything works correctly. Also, this configuration worked for years with the same dock, so I don't know what changed at some point during one Arch update a few months ago (I forgot when it was because I didn't have the time to investigate further why it stopped working).

I also tried loading the fallback initramfs that contains all the modules, but it also didn't work.

Does anyone have an idea what the issue could be, and/or how I can debug this?

Last edited by kustodian (2025-05-01 13:07:06)

Offline

#2 2025-05-02 06:31:13

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,577

Re: USB not working in initramfs on X1 Carbon Gen11 on Thunderbolt dock

I'd want to plug in another keyboard or use the laptop itself temporarily to check the dmesg and lspci/lsusb/tblist/boltctl list inside the initramfs and check how everything's being seen.

I'm not too familiar with Thunderbolt. The thunderbolt module's parameters don't look too helpful.

This Thunderbolt NVMe issue seems similar to yours.

Last edited by Ranguvar (2025-05-03 16:53:31)

Offline

#3 2025-05-02 21:06:41

kustodian
Member
Registered: 2020-06-26
Posts: 7

Re: USB not working in initramfs on X1 Carbon Gen11 on Thunderbolt dock

I never debugged initramfs, so I'm not sure how to make it drop into a shell, but from the first few Google searches adding a "break" parameter to the boot line should do the trick. If you have any suggestions what would be the best way to debug, I'm all ears smile

Last edited by kustodian (2025-05-02 21:07:14)

Offline

#4 2025-06-27 12:34:51

kustodian
Member
Registered: 2020-06-26
Posts: 7

Re: USB not working in initramfs on X1 Carbon Gen11 on Thunderbolt dock

I managed to debug this by removing `quiet` (to be able to see all debug messages) and by adding `break=premount` to the kernel line in my boot manager to open a busybox shell before mounting disks (I've mostly followed this guide on how to debug initramfs). At first, I didn't have any of the utilities like `lspci`, `botlctl`, and `tblist`, so I edited `/etc/mkinitcpio.conf` and `BINARIES` and `FILES` to look like this (I had `setfont` before here):

BINARIES=(setfont tblist lsusb)
# ..
FILES=(/usr/bin/lspci /usr/lib/libpci.so.3)

After this, I rebuilt initramfs with:

sudo mkinitcpio -p linux

If you're not using the default kernel, you should replace `linux` with the kernel you're using, e.g. `linux-ltx`, `linux-zen`, etc, or rebuild initramfs for all kernels with:

sudo mkinitcpio -P

I didn't include `boltctl` because it requires dbus, which isn't loaded in initramfs, so it didn't work.


What I found out when I ran `tblist` while I'm regularly booted it reported that my dock is authorized:

# tblist -v
Domain 0 Route 0: 8087:463e INTEL Gen12
  Type: Router
  UUID: f0028780-602e-20a6-ffff-ffffffffffff
  Generation: USB4

Domain 1 Route 0: 8087:463e INTEL Gen12
  Type: Router
  UUID: 539d8780-f130-3f79-ffff-ffffffffffff
  Generation: USB4

Domain 1 Route 1: 0108:1720 Lenovo ThinkPad Thunderbolt 3 Dock
  Type: Router
  Speed (Rx/Tx): 40/40 Gb/s
  Authorized: Yes
  UUID: c9030000-0080-840e-83d7-26140271a121
  Generation: Thunderbolt 3
  NVM version: 56.0

But when I ran the same command in initramfs it reported `Authorized: no` (I didn't have a copy-paste), which means that the kernel won't be able to read from USB and other input devices from the doc. I found a few other discussions about this issue, and the most important is this one. Basically, the problem is with Thunderbolts BootAccessControlList (BootACL) not being available during initramfs, I don't know why, but what's important is that if the `thunderbolt` module is not loaded in initramfs USB devices work, but thunderbolt functions don't (which I don't need during boot).

What I ended up doing in the end is from /etc/mkinitcpio.conf I just removed the `thunderbolt` from MODULES:

# Before:
MODULES=(i915 usb_storage thunderbolt)

# After:
MODULES=(i915 usb_storage)

and rebuilt initramfs (same as before):

sudo mkinitcpio -p linux

Now all works as before smile

Offline

Board footer

Powered by FluxBB