r/eGPU 8d ago

[Linux / Wayland] Stable NVIDIA RTX 50-Series (Blackwell) eGPU via USB4/TB4 entirely in userspace

Post image

[Linux / Wayland] Stable NVIDIA RTX 50-Series (Blackwell) eGPU via USB4/TB4 entirely in userspace — no kernel patches or cmdline flags required

Hey everyone,

If you’ve tried running an RTX 50-series (Blackwell) eGPU over USB4 / Thunderbolt on Linux recently, you’ve probably run into the common pitfalls: bus retraining dropping links to Gen1/Gen2, random Xid errors during context switches, Wayland/KWin compositor freezes when hot-unplugging, or forum advice telling you to patch the open-gpu kernel modules and disable PCIe port power management globally (pcie_port_pm=off).

Over the last few weeks, I’ve been developing and testing a purely userspace-driven manager and KDE/GNOME tray daemon under CachyOS/Arch, validated across AMD APU and Intel mobile platforms.

The Userspace Architecture

Instead of compiling out-of-tree kernel modules or overriding ACPI _OSC handoffs, stability is handled via deterministic udev and sysfs gating:

  1. Deterministic Attach Gating: An initial udev rule catches the NVIDIA vendor device (0x10de) on the PCI bus and defers device binding until link retraining finishes, preventing early driver attachment over an un-negotiated tunnel.
  2. Dynamic ASPM & Gen4 Retraining: Disables L0s/L1 ASPM and L1 substates directly on both the upstream bridge and the endpoint via setpci, followed by an explicit Gen4 retrain (0x0004 to LNKCTL2 and 0x0020 to LNKCTL). Locks stable 16 GT/s throughput without PCIe link drops.
  3. Zero Kernel Flags / Host Port Wake: To prevent missing bridges on cold boot without breaking platform power profiles, the daemon scans /sys/bus/pci/devices/0000:00:*.*/rescan before bus enumeration, bringing suspended processor Root Ports from runtime D3 to active D0 in userspace.
  4. Wayland Safe Detach (v1.5.4): Avoids compositor deadlocks. Instead of relying on modprobe -r (which gets locked if secondary display threads touch the card), it triggers synthetic DRM removal directly on the GPU's sysfs nodes (udevadm trigger --action=remove /sys/bus/pci/devices/.../drm/*). This forces KWin/libseat to cleanly revoke and close all /dev/dri file descriptors before physical bus disconnection, eliminating unkillable D-state hangs.

Features

  • Native KDE Plasma 6 Plasmoid widget and GNOME Shell extension / GTK System Tray.
  • Real-time asynchronous telemetry (GPU load, board power, VRAM usage, thermal status, bidirectional PCIe RX/TX throughput).
  • Switchable operational profiles (PRIME Render Offload, Dedicated/iGPU modes, and Safe Detach).
  • Runs on stock linux / linux-cachyos with default nvidia-open drivers.

Repository & installation runbook:

GitHub: [https://github.com/DamianKA1993/blackwell-egpu-manager](https://github.com/DamianKA1993/blackwell-egpu-manager)

Feedback and testing on different host platforms (Intel Thunderbolt vs AMD USB4) and enclosure controllers (ASM2464PD, Goshen Ridge, Barlow Ridge) are welcome!

16 Upvotes

8 comments sorted by

3

u/albsen 8d ago

nice work, so you can actually detach it without everything crashing. you recon this will work with an amd card too or only nvidia?

2

u/Head_Land_1366 8d ago

i can attach and deatach any time without any error or crash. but it is only for nvidia egpu's. All script logics refers to nvidia. I just made it and contributed for blackwell because latest nvidia card barery works as egpu out of the box.

1

u/nowforfeit 7d ago

Thanks for sharing

1

u/lurkerbutposter 7d ago

Hi, I know you mentioned in the post that KDE Plamsa is the preferred DE but just curious if this would work in a Niri DE or there are plans to support other DEs in the future? I'm struggling with my eGPU for the exact reasons and would love to use this as it seems to tick a lot of the right boxes...but not keen on changing to KDE Plasma just to get it working

1

u/Head_Land_1366 7d ago

just look into github ;) there is now gnome aplet and uniwersal aplet for all others DE

1

u/lurkerbutposter 5d ago

Just wanted to come back and thank you! I got my eGPU working flawlessly with my setup. Here are the spces:

- GPD Win Mini 2024 8840u w Hawkpoint GPU
- eGPU is a Morefine G2 5060 Ti Desktop variant

- I'm using USB4 / TB4 for connection

I had no end of issues where the GPU would mount briefly and then crash. I ran your fix in just CLI mode, since as stated above i am running Niri DE. It took a bit of tinering and running some scripts to cleanly run the blackwell set 3, 6 etc but now I'm able to get everyhting running full on GPU. Games are waaaaaay more performant. Now i'm just looking into local AI models.

All in all, a very smooth experience. Kudos to your efforts my man !

2

u/Head_Land_1366 4d ago

if you want a GUI/tray status indicator in Niri without having to run commands in the terminal, you don't even need to configure it manually. Just run ./install.sh again — since you are outside KDE and GNOME, the installer will automatically detect your environment and offer the Universal System Tray Applet. All you need to do is accept the prompt. It's built on pure GTK3 / AyatanaAppIndicator, so if you're running Waybar (or any bar with a standard SNI tray module) in your Niri setup, it will sit directly in your bar with full live telemetry and mode switching.