Hybrid GPU toggle: Integrated-mode transition deadlocks in snd_card_free because supergfxd unbinds the dGPU's HDA audio function while PipeWire holds it open
System details
HP Victus 16-e0xxx, AMD Cezanne iGPU + NVIDIA GA106M (RTX 3060 Mobile / Max-Q), Omarchy 4.0.2-1, Linux 7.1.9-arch1-2, supergfxctl 5.2.7-2, nvidia-open-dkms 610.57.04-1.
(omarchy debug does not exist in 4.0.2, so the diagnostics below are gathered by hand.)
What's wrong?
omarchy toggle hybrid gpu → Integrated → reboot leaves supergfxd permanently wedged:
supergfxctl -g hangs, and the toggle reports "supergfxd is not responding".
This looks like #8551, but it is a different mechanism and needs a different fix.
In #8551 rmmod nvidia fails with "Module nvidia is in use". Here every module
unloads cleanly and the daemon hangs one step later — unbinding the dGPU's
HDA audio function (0000:01:00.1, 10DE:228E), which supergfxd removes alongside
the GPU:
supergfxd[1022]: Did rmmod for driver nvidia_drm
supergfxd[1022]: Did rmmod for driver nvidia_modeset
supergfxd[1022]: Did rmmod for driver nvidia_uvm
supergfxd[1022]: Did rmmod for driver nvidia <- all fine, no error
<no further output — ever>
The main thread is in uninterruptible sleep (D) forever:
INFO: task supergfxd:1022 blocked for more than 122 seconds.
task:supergfxd state:D stack:0 pid:1022 tgid:1022 ppid:1
Call Trace:
__schedule+0x459/0x1870
schedule+0x27/0xa0
schedule_timeout+0xdc/0x120
wait_for_completion+0x9a/0x180
snd_card_free+0x7a/0xa0 [snd]
pci_device_remove+0x4a/0xc0
device_release_driver_internal+0x19e/0x200
unbind_store+0xa4/0xb0
kernfs_fop_write_iter+0x16b/0x210
vfs_write+0x281/0x570
ksys_write+0x7b/0x110
do_syscall_64+0xaa/0x660
snd_card_free waits for the last reference to the ALSA card to drop. PipeWire/WirePlumber
had just opened it — the two events are 200µs apart in the journal:
[29.682470] supergfxd: Did rmmod for driver nvidia
[29.682670] wireplumber: spa.alsa: poll fd error/hangup (card removed?), removing poll sources
Because the daemon blocks while still owning org.supergfxctl.Daemon, clients hang rather
than error, which is why the Omarchy toggle reports "not responding" instead of failing.
Why it happens: the unit reports "started" too early
supergfxd.service is Type=dbus, so systemd considers it started the moment it acquires the
bus name — but the mode transition runs asynchronously after that. graphical.target is
already ordered After=supergfxd.service, so it is waiting for the wrong thing:
[28.768] Started SUPERGFX <- bus name acquired
[28.918] Reached target Graphical <- 0.15s later
[29.678] uwsm: Selected compositor ID: hyprland.desktop
[29.682] supergfxd: Did rmmod ... <- transition runs DURING session startup
delay-start.conf cannot fix this, and makes it worse. Its ExecStartPre=/bin/sleep 5
delays the bus-name acquisition, and because the session start is chained to it, it delays the
session by the same 5s. The two stay adjacent and still collide — the sleep just moves the
collision later. (zc0rp10 observes the same thing in #8551 for the SDDM case.)
Effects
- dGPU is never powered down — the transition abandons before
set_runtime_pm. Displays are already gone, so the machine loses HDMI (bothHDMI-A-1andDP-1are wired to the dGPU here) and keeps the battery drain. Worst of both. nvidiagets reloaded a second later, sofastfetchstill lists the GPU — and inconsistently between boots, since it is a race.- The menu entry stays visible but is dead:
omarchy-hw-hybrid-gpufalls back to counting GPUs whensupergfxctl -stimes out, then the toggle fails onsupergfxctl -g. - The
D-state task is unkillable, sosystemctl rebootcan hang too.
Steps to reproduce
- Hybrid laptop whose dGPU exposes an HDA audio function (any NVIDIA dGPU with HDMI audio).
omarchy toggle hybrid gpu→ confirm Integrated → reboot.timeout 5 supergfxctl -g→ exits 124;journalctl -k -b | grep "blocked for more than".
Reproduced on 2 of 2 boots before the fix; 0 of 2 after.
Confirming the cause
Releasing the ALSA card unblocks it immediately:
$ systemctl --user stop wireplumber pipewire pipewire-pulse
supergfxd goes D → S, logs reload: Reloaded gfx mode: Integrated, and removes both
01:00.0 and 01:00.1. That is the proof the audio reference is what it was waiting on.
Suggested fix
Don't let the graphical session start until the transition has actually finished. Since
graphical.target is already After=supergfxd.service, holding the unit in starting until the
dGPU is off the bus is enough — no session means no PipeWire, so nothing can hold the audio card.
Replacing delay-start.conf with this fixed it here:
# /etc/systemd/system/supergfxd.service.d/wait-for-dgpu.conf
[Service]
ExecStartPost=-/usr/bin/timeout 60 /usr/local/bin/supergfxd-wait-dgpu
#!/bin/bash
# Block until the Integrated-mode transition has removed the dGPU from the PCI bus.
grep -qE '"mode"[[:space:]]*:[[:space:]]*"Integrated"' /etc/supergfxd.conf 2>/dev/null || exit 0
dgpu=$(lspci -Dn 2>/dev/null | awk '$2 ~ /^030[02]:/ && $3 ~ /^10de:/ {print $1; exit}')
[[ -n $dgpu ]] || exit 0
while [[ -e /sys/bus/pci/devices/$dgpu ]]; do sleep 0.2; done
The leading - keeps a timeout from failing the unit into a restart loop. Result over two reboots:
[18.394] Starting SUPERGFX...
[19.205] Did rmmod for driver nvidia
[19.256] reload: Reloaded gfx mode: Integrated <- transition complete
[19.435] Started SUPERGFX <- only now is the unit "started"
[19.541] Reached target Graphical
[20.018] uwsm: Selected compositor ID: hyprland.desktop
No hung tasks, supergfxctl -g answers instantly, both PCI functions removed, and WirePlumber
logs no ALSA hangup at all. The unit's own start also drops from 5.04s to 1.04s, since the 5s
sleep is replaced by the ~1s the transition actually takes.
This is a general fix for the ordering flaw, so it should also help the other failure modes in #8551 — they are all the transition racing session startup, differing only in what it trips over.
Related
- #8551 — same symptom, different mechanism (
rmmodfails vs. clean unload then audio unbind) - #8352 —
MODULES+=(nvidia ...)in/etc/mkinitcpio.conf.d/nvidia.confis present here too, so the stack loads from initramfs despite supergfxd's blacklist and must be torn down at runtime - #9512 —
/usr/lib/systemd/system-sleep/force-igpuis mode 644 here, so it never executes
Filed by Claude Opus 5 via Claude Code.
Same snd_card_free deadlock on a second machine, plus a runtime trigger that the boot-ordering fix proposed above can't cover: the force-igpu system-sleep hook. On this machine, a lid-closed suspend retry loop then ran for two hours, until the battery died.
System
Alienware m16 R1 (Intel iGPU + NVIDIA AD106M, HDA function 0000:01:00.1 = 10DE:22BD), Omarchy 4.0.4-1, linux-omarchy 7.2.5-3, supergfxctl 5.2.7-2, nvidia-open-dkms 610.57.04-1, pipewire 1.6.8-1, wireplumber 0.5.17-1. Integrated mode set via omarchy toggle hybrid gpu, with force-igpu installed as 0755 (so it does run here, unlike in #9512).
1. Boot race: same as this issue
On one boot, supergfxd was set up for Integrated mode 1s after WirePlumber started. It got stuck exactly as described above:
18:15:13 wireplumber/pipewire start
18:15:14 supergfxd: Did rmmod for driver nvidia
18:15:14 wireplumber: spa.alsa: poll fd error/hangup (card removed?), removing poll sources
18:18:58 kernel: task:supergfxd state:D ... snd_card_free+0x7a/0xa0 [snd]
2. New: the force-igpu hibernate path hits the same deadlock with the session running
On a later boot, supergfxd started cleanly in Integrated mode. Then, from the running session, I chose Hibernate from the Omarchy menu (systemctl hibernate). The pre branch of /usr/lib/systemd/system-sleep/force-igpu calls switch_mode Vfio, which puts the dGPU back on the bus and unbinds it again. PipeWire is running by then, so supergfxd goes into D state in the same place:
08:05:18 logind: hibernate requested from client PID 77175 ('systemctl') (unit [email protected])
08:05:22 systemd-sleep: Could not request the GPU transition to Vfio mode
08:05:22 (system-sleep): '/usr/lib/systemd/system-sleep/force-igpu' failed with exit status 1.
08:05:22 systemd-sleep: Performing sleep operation 'hibernate'...
08:05:42 kernel: Freezing user space processes failed after 20.008 seconds (1 tasks refusing to freeze, wq_busy=0):
08:05:42 kernel: task:supergfxd state:D pid:1400 ...
snd_card_free+0x7a/0xa0 [snd]
pci_device_remove+0x4a/0xb0
device_release_driver_internal+0x1a6/0x210
unbind_store+0xac/0xc0
08:05:43 systemd-sleep: Failed to put system to sleep. System resumed again: Device or resource busy
The fix proposed in this issue holds supergfxd.service in starting until the dGPU is gone at boot. That cannot help here, because PipeWire is already running whenever a sleep hook calls supergfxctl -m Vfio. The post branch makes the same Integrated -> Vfio -> Integrated round trip after every resume, so it carries the same risk.
3. Consequence: the hook failure doesn't stop sleep, and a closed lid turns it into a battery-draining loop
force-igpugives up after its 3stimeout, but systemd-sleep ignores hook failures and goes ahead with the sleep anyway.- Once supergfxd is in
Dstate, every later suspend fails at the freezer. Only a reboot clears it. - The lid was closed 3s after the hibernate request, so logind retried suspend every ~50s for as long as the lid stayed closed: 290
PM: suspend entryevents between 08:05 and 10:05. - Each retry also re-ran
omarchy-sleep-lock.service(restart counter > 370), and each lock started a1password --lockhelper, two of which crashed with SIGTRAP. - At 10:04:31 upower reported critical battery and requested
poweroff. The journal ends at 10:05:49 and the next boot is a week later. In practice, the laptop sat in a bag running the loop until the battery was flat.
Suggestions (beyond the boot-ordering fix above)
- Before
force-igpu(or anything else) asks supergfxd to drop the dGPU, release the dGPU's HDA card. A WirePlumber rule that disables the NVIDIA HDA ALSA card while in Integrated mode would remove the open reference in every path: boot, sleep hooks, and manual toggles. - Consider making
force-igpureturn early on hibernate ifsupergfxctl -gdoesn't answer quickly. A wedged daemon is already a sign the next transition will hang too. - A sleep path that can't freeze shouldn't loop silently with the lid closed. At minimum, surface a notification the first time
Freezing user space processes failednames supergfxd.
Filed by Claude Opus 5.5 via Claude Code.
Same snd_card_free deadlock on a third machine, at plain boot (no toggle, no suspend), plus a data point on what releases it.
System
HP Victus 15-fb1xxx (AMD Rembrandt / Radeon 680M iGPU + NVIDIA GA107 RTX 2050, HDA function 0000:01:00.1 = 10DE:2291), Omarchy 4.0.4-1, linux-omarchy 7.2.5-3, supergfxctl 5.2.7-2 (mode Integrated, vfio_enable: true), nvidia-open-dkms 610.57.04-1, pipewire 1.6.8-1, wireplumber 0.5.17-1.
Timeline (single boot)
18:31:43 supergfxd: do_mode_setup_tasks(mode:Integrated, vfio_enable:true, ...)
18:31:44 supergfxd: Did rmmod for driver nvidia <- all four modules unload fine
18:35:20 kernel: INFO: task supergfxd:1062 blocked for more than 122 seconds.
... snd_card_free+0x7a / pci_device_remove / unbind_store ... (same stack as above)
18:53:46 kernel: INFO: task supergfxd:1062 blocked for more than 1228 seconds. (10 reports total)
20:30:22 user runs Omarchy menu → Restart audio (omarchy-restart-audio)
20:30:23 systemd: Stopping Multimedia Service Session Manager / PipeWire PulseAudio
20:30:23 supergfxd: Unbound "/sys/devices/pci0000:00/0000:00:01.1/0000:01:00.1"
So the unbind sat in D for ~2 hours and completed within one second of PipeWire/WirePlumber being stopped. That confirms the last ALSA card reference was held by the user's PipeWire session, and gives a (non-root) workaround that releases the kernel side: restart the user's audio stack.
But the daemon stays wedged afterwards
Even after the unbind returned, supergfxd logs nothing further and does not answer D-Bus:
$ timeout 8 supergfxctl -g; echo $?
124
All supergfxd threads are now S (none in D), so it is no longer blocked in the kernel. It just never recovers. Restarting audio unblocks the kernel but not the daemon, so keeping PipeWire off the dGPU HDA card alone may not be enough. supergfxd itself also seems not to recover once the unbind has stalled.
Follow-up to my comment above (HP Victus 15-fb1xxx, Radeon 680M + RTX 2050, Omarchy 4.0.4-1, linux-omarchy 7.2.5-3). I now have a workaround that survives reboots, sleep and hibernate. Here's what failed along the way, so nobody repeats it.
It is not only PipeWire
After keeping PipeWire off the card, supergfxd still wedged, this time spinning in nv_pci_remove_helper (NVRM: Attempting to remove device 0000:01:00.0 with non-zero usage count!). The nvidia module had been reloaded after supergfxd rmmod'ed it, because quickshell and Firefox's RDD process opened /dev/nvidia* through GLVND (libEGL_nvidia, libvdpau_nvidia, libcuda). Omarchy already sets __GLX_VENDOR_LIBRARY_NAME=mesa and LIBVA_DRIVER_NAME=radeonsi on this setup, but not EGL or VDPAU. Adding these to ~/.config/hypr/hyprland.lua fixed that part:
hl.env("__EGL_VENDOR_LIBRARY_FILENAMES", "/usr/share/glvnd/egl_vendor.d/50_mesa.json")
hl.env("VDPAU_DRIVER", "radeonsi") -- Mesa 26 ships no VDPAU driver, so this just disables VDPAU
A wedged supergfxd in this state ignores SIGKILL, so it needs a forced power-off. It also blocks suspend: Freezing user space processes failed ... task:supergfxd state:R ... nv_pci_remove_helper, and the session bounces back to the lock screen.
What did NOT keep PipeWire off the HDA card
- WirePlumber rule
device.disabled = trueforalsa_card.pci-0000_01_00.1: the device disappears fromwpctl status, but wireplumber still holds/dev/snd/controlC1open (shows as(deleted)after the unbind starts), sosnd_card_freestill blocks. - udev
ENV{ACP_IGNORE}="1"on the card: same result. wireplumber opens every card's control device regardless. - Removing the 5 s
ExecStartPre=/bin/sleep 5insupergfxd.service.d/delay-start.confwould avoid the race, but that drop-in exists to prevent a boot freeze, so I left it.
What works: detach the HDA function as soon as it binds
A udev bind rule unbinds snd_hda_intel from the dGPU's audio function at boot, seconds before the user session (and wireplumber) exists. It does this only in Integrated/Vfio mode, so Hybrid keeps HDMI audio:
# /etc/udev/rules.d/90-ignore-nvidia-hdmi-audio.rules
ACTION=="bind", SUBSYSTEM=="pci", KERNEL=="0000:01:00.1", DRIVER=="snd_hda_intel", RUN+="/usr/local/bin/detach-nvidia-hdmi-audio"
#!/bin/sh
# /usr/local/bin/detach-nvidia-hdmi-audio
grep -Eq '"mode"[[:space:]]*:[[:space:]]*"(Integrated|Vfio)"' /etc/supergfxd.conf || exit 0
echo 0000:01:00.1 > /sys/bus/pci/drivers/snd_hda_intel/unbind
Vfio has to be included because force-igpu's post step goes Vfio → Integrated after a hibernate resume, and the PCI rescan re-binds the HDA function mid-session.
Result on the next boot, with no manual intervention:
22:03:21 supergfxd: Did rmmod for driver nvidia
22:03:21 supergfxd: Unbound ".../0000:01:00.1"
22:03:21 supergfxd: Unbound ".../0000:01:00.0"
22:03:21 supergfxd: reload: Reloaded gfx mode: Integrated
No hung-task reports, supergfxctl -g answers immediately, and suspend works. A hibernate → resume cycle afterwards (with the #8352 initramfs workaround also applied) came back with force-igpu restoring Integrated and supergfxd still healthy.
The PCI address 0000:01:00.1 is machine-specific. A packaged fix would want to resolve it from supergfxd's detected HDA function instead.
Thanks for the detailed report, and to @dalbqrq and @staruxian for the reports from two more machines. I read it against quattro at bef30c1c5. I did not reproduce it: it needs a hybrid laptop whose NVIDIA dGPU has an HDA audio function, and our test machines are VMs without one.
What the code shows. Nothing in Omarchy keeps the session's audio stack off the dGPU's audio function before supergfxd unbinds it, in any of the paths that ask it to:
- Boot in Integrated mode.
omarchy toggle hybrid gpuinstallsdefault/systemd/system/supergfxd.service.d/delay-start.conf, which only addsExecStartPre=/bin/sleep 5. Nothing waits for the transition to finish, so, as you describe, the sleep moves the collision later instead of removing it. - Hibernate. The
prebranch ofdefault/systemd/system-sleep/force-igpucallsswitch_mode Vfio(line 49) without releasing the card first. Its 3stimeoutlimits how longsupergfxctlwaits, not supergfxd's unbind in the kernel. systemd-sleep ignores a hook that fails, so the machine goes on to sleep with supergfxd stuck inD. That fits the freezer failure and the suspend loop in the second report. - Resume. Whenever the cycle started in Integrated mode,
postgoes Vfio then Integrated (lines 59–62), which is the same unbind again.
The toggle's timeouts and omarchy-hw-hybrid-gpu only stop the hang from spreading to callers. They do not bring a wedged supergfxd back.
Not a duplicate of #8551. The symptom is the same, but there rmmod nvidia fails because the module is in use. Here every module unloads and the unbind of a separate PCI function blocks. The resource and the fix are different, so both stay open.
Why there is no fix PR yet. The three fixes in this thread cover different paths. Waiting in ExecStartPost until the dGPU is off the bus fixes boot ordering only: it never runs for a sleep-hook mode request, and a timeout there decides how the machine boots when the transition stalls. The udev bind-time unbind covers boot and the resume rebind, but it has to find the dGPU's audio function generically rather than by a fixed address or .1. It also has to leave Hybrid mode's HDMI audio alone and do nothing on a dGPU without an audio function. The third report's EGL/VDPAU point is a separate NVIDIA consumer: default/hypr/nvidia.lua limits the GLX and VA-API overrides but sets no Mesa-only EGL or VDPAU policy. Choosing among these changes how the machine boots and sleeps, and none of it can be tested here, so that call is the maintainer's.
Second opinion. I (Claude Opus 5.5) reviewed this, and Codex at medium effort reviewed it separately. It agreed on the mechanism and on keeping it apart from #8551. Its independence from my reading is not guaranteed. It added two points. A bind event does not prove nothing has opened the card yet, so a udev unbind that runs after WirePlumber has opened the card would block in the same place. And systemd normally freezes the user session during sleep hooks, but freezing does not close the descriptors that keep the card busy.
Next step: this waits on the maintainer to choose an approach. If one is chosen, whoever has the hardware would need to test it across boot, hibernate and resume, and check HDMI audio in Hybrid mode.
Additional reproduction: HP Victus 15, Intel iGPU + RTX 4050
I can reproduce the same snd_card_free() deadlock on a different HP Victus configuration, with an Intel iGPU and an NVIDIA RTX 4050.
System
- Laptop: HP Victus by HP Gaming Laptop 15-fa2xxx
- CPU: Intel Core i5-13420H
- iGPU: Intel UHD Graphics (Raptor Lake-P)
- dGPU: NVIDIA GeForce RTX 4050 Laptop GPU (AD107)
- NVIDIA HDMI Audio function:
0000:01:00.1(10de:22be) - BIOS: F.07
- Omarchy: 4.5.0-3 (originally installed 4.0, then upgraded)
- Kernel:
7.2.15-1-omarchy - supergfxctl:
5.2.7-4 - NVIDIA driver:
615.78.08 - PipeWire:
1.6.9 - WirePlumber:
0.5.18
Reproduction
- Run
omarchy toggle hybrid gpu. - Select Integrated mode and reboot.
- During startup,
supergfxdunloads the NVIDIA driver modules successfully, then hangs while unbinding the NVIDIA HDMI audio PCI function (0000:01:00.1). supergfxdremains in uninterruptible sleep (Dstate), andsupergfxctl -gstops responding. The Omarchy toggle reports thatsupergfxdis not responding.
This happened on more than one boot.
Kernel stack
The blocked supergfxd process had this stack in /proc/<PID>/stack:
snd_card_free+0x7a/0xa0 [snd]
pci_device_remove+0x4a/0xb0
__device_release_driver+0x182/0x300
device_driver_detach+0x46/0xd0
unbind_store+0x356/0x380
kernfs_fop_write_iter+0x179/0x230
vfs_write+0x40c/0x630
__x64_sys_write+0x7e/0x110
do_syscall_64+0xaa/0x630
entry_SYSCALL_64_after_hwframe+0x76/0x7e
The NVIDIA modules had already been removed successfully. The hang occurred later, during the PCI audio-device unbind, matching the failure described in this issue.
Recovery / confirmation
While supergfxd was stuck in D state, I ran:
systemctl --user stop wireplumber pipewire pipewire-pulse
Immediately afterwards, the supergfxd process left D state and the transition completed.
The journal then showed successful unbinding and removal of both NVIDIA PCI functions:
Unbound ".../0000:01:00.1"
Unbound ".../0000:01:00.0"
Removed ".../0000:01:00.1"
Removed ".../0000:01:00.0"
reload: Reloaded gfx mode: Integrated
supergfxctl -g then returned Integrated successfully.
This strongly supports the same ALSA/PipeWire-related deadlock described here. Stopping the audio services releases the operation blocked in snd_card_free() on my system as well.
Additional detail
I already have the supergfxd.service drop-in with ExecStartPre=/bin/sleep 5 installed (delay-start.conf). It does not prevent the problem on this machine.
I can provide additional logs or test a proposed fix on this Intel + RTX 4050 laptop, including boot and suspend/resume scenarios.
@Sanekek, your 4.5.0-3 report supports the audio-card reference diagnosis: the NVIDIA modules unload, the task blocks in snd_card_free(), and stopping the audio services releases it. Your daemon then completes the transition, whereas an earlier report described it remaining unresponsive after the kernel wait ended. Releasing the card therefore does not establish a reliable recovery procedure for every affected machine.
I checked quattro at 419a5a7095d118a218d5f84548dbd83ce90067e6. The startup drop-in and force-igpu hook are unchanged since the previous review: boot still uses a five-second delay, and the sleep hook still requests GPU transitions without releasing the audio card. No candidate fix has been verified on the affected hardware. I did not reproduce the failure or run tests; a VM cannot exercise this laptop GPU/HDA path.
Codex High reviewed the source and reports, with second opinions from Opus 5.5 High and muse-wonder via pi at high thinking. Both agreed that this still waits on the maintainer choosing an approach; independence from the supplied findings is not guaranteed. Your offer to test gives that work an Intel + RTX 4050 machine once there is a candidate. It will need boot, suspend, hibernate/resume and Hybrid-mode HDMI-audio checks.