Skip to content

fix(quickemu): detect audio backends via sockets, not pidof#1839

Merged
flexiondotorg merged 1 commit intomasterfrom
pipewire-fix
Jan 25, 2026
Merged

fix(quickemu): detect audio backends via sockets, not pidof#1839
flexiondotorg merged 1 commit intomasterfrom
pipewire-fix

Conversation

@flexiondotorg
Copy link
Member

  • Replace process checks (pidof pipewire / pidof pulseaudio) with socket existence checks to determine functional audio services.
  • PipeWire detection checks $PIPEWIRE_REMOTE or $XDG_RUNTIME_DIR/pipewire-0.
  • PulseAudio detection checks $PULSE_SERVER or $XDG_RUNTIME_DIR/pulse/native.
  • Change default audio driver from pa to alsa as a safer fallback on headless hosts.
  • Set detection priority: PipeWire (if QEMU >= 8.1) → PulseAudio → ALSA.
  • Reason: a listening socket indicates a working service; pidof can be misleading on headless servers and caused QEMU "Failed to initialize PW context" errors.

Fixes #1838

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my code

- Replace process checks (pidof pipewire / pidof pulseaudio) with socket
  existence checks to determine functional audio services.
- PipeWire detection checks $PIPEWIRE_REMOTE or
  $XDG_RUNTIME_DIR/pipewire-0.
- PulseAudio detection checks $PULSE_SERVER or
  $XDG_RUNTIME_DIR/pulse/native.
- Change default audio driver from pa to alsa as a safer fallback on
  headless hosts.
- Set detection priority: PipeWire (if QEMU >= 8.1) → PulseAudio → ALSA.
- Reason: a listening socket indicates a working service; pidof can be
  misleading on headless servers and caused QEMU "Failed to initialize
PW context" errors.

Fixes #1838

Signed-off-by: Martin Wimpress <martin@wimpress.org>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • This PR looks safe to merge overall; the main concern is a single medium‑severity check around PulseAudio configuration handling.
  • In quickemu, the -S check can reject valid PULSE_SERVER values (e.g., unix:/path or tcp:host:port), which may cause an unnecessary ALSA fallback for users relying on custom PulseAudio servers.
  • Pay close attention to quickemu - ensure PULSE_SERVER string values are honored even when they are not filesystem sockets.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="quickemu">

<violation number="1" location="quickemu:1278">
P2: `PULSE_SERVER` can be a server string (e.g., `unix:/path` or `tcp:host:port`), so the `-S` check will fail for valid PulseAudio configurations and force an ALSA fallback. Consider honoring `PULSE_SERVER` when set and only socket-checking the `unix:` variant.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

elif ! pidof pulseaudio >/dev/null 2>&1; then
AUDIO_DRIVER="alsa"
AUDIO_DRIVER="pipewire"
elif [ -S "${pa_socket}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: PULSE_SERVER can be a server string (e.g., unix:/path or tcp:host:port), so the -S check will fail for valid PulseAudio configurations and force an ALSA fallback. Consider honoring PULSE_SERVER when set and only socket-checking the unix: variant.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At quickemu, line 1278:

<comment>`PULSE_SERVER` can be a server string (e.g., `unix:/path` or `tcp:host:port`), so the `-S` check will fail for valid PulseAudio configurations and force an ALSA fallback. Consider honoring `PULSE_SERVER` when set and only socket-checking the `unix:` variant.</comment>

<file context>
@@ -1266,15 +1266,17 @@ function check_cocoa_gl_es_support() {
-    elif ! pidof pulseaudio >/dev/null 2>&1; then
-        AUDIO_DRIVER="alsa"
+        AUDIO_DRIVER="pipewire"
+    elif [ -S "${pa_socket}" ]; then
+        AUDIO_DRIVER="pa"
     fi
</file context>

@flexiondotorg flexiondotorg merged commit 3c785eb into master Jan 25, 2026
4 of 5 checks passed
@flexiondotorg flexiondotorg deleted the pipewire-fix branch January 25, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: PipeWire Bus Down Error after updated v4.9.8 from v4.9.7

1 participant