Skip to content

Wait for snd-soc-macaudio before starting speakersafetyd - #214

Merged
maralcbr merged 1 commit into
mainfrom
fix/speakersafetyd-macaudio-wait
Nov 29, 2026
Merged

maralcbr merged 1 commit into
mainfrom
fix/speakersafetyd-macaudio-wait

Conversation

@maralcbr

Copy link
Copy Markdown
Member

Problem

80-omarchy-mac-audio.preset enables speakersafetyd.service for multi-user.target, which starts the daemon before snd-soc-macaudio finishes probing the built-in Apple Silicon sound card (even sound.target is reached ~2.4 s earlier by DisplayPort/HDMI audio).

On m2-max (J416), every cold boot logged two Rust panics (hw:AppleJ416: Could not open sound card! No such device (19), status=101) before succeeding on restart attempt #3, risking StartLimitBurst=10 leaving the speakers muted on slower probes.

Fix

Following the existing sddm.service.d/10-omarchy-mac-wait-for-display.conf pattern:

  • Add omarchy-mac/vendor/systemd/system/speakersafetyd.service.d/40-omarchy-mac-wait-for-macaudio.conf running ExecStartPre=-/usr/lib/omarchy-mac/wait-for-macaudio.
  • Add omarchy-mac/lib/wait-for-macaudio, which polls up to 10 s (every 50 ms) for /sys/bus/platform/devices/sound/sound/card[0-9]* and its matching /dev/snd/controlC<N> device, and always exits 0 on timeout or when no platform sound node is present so speakersafetyd is never blocked.
  • On J700, 50-j700-guard.conf's ExecCondition runs before ExecStartPre, so speakerguardd boards skip it.
  • Add red-capable regression tests in omarchy-mac/test/systemd-test.sh verifying wait-while-absent, wait-while-control-missing, immediate return once ready, and immediate skip without a platform sound node.

Evidence

Ran in Arch container (omarchy-pkg-builder:latest-aarch64-edge):

  • bash omarchy-mac/test/systemd-test.sh — all tests pass
  • bash test/integration/speaker-owner-test.sh — all tests pass

Because 80-omarchy-mac-audio.preset enables speakersafetyd.service under
multi-user.target, systemd starts speakersafetyd as soon as
multi-user.target runs — often 2+ seconds before snd-soc-macaudio
registers AppleJ* (even after sound.target is reached by DisplayPort/HDMI
audio). On M2 Max (J416), speakersafetyd panicked twice with 'No such
device (19)' on every boot before succeeding on retry #3, risking
StartLimitBurst=10 leaving speakers muted.

Ship a systemd drop-in (40-omarchy-mac-wait-for-macaudio.conf) and
bounded ExecStartPre helper (/usr/lib/omarchy-mac/wait-for-macaudio),
following the same pattern as sddm's wait-for-display, to wait up to
10 s for /sys/bus/platform/devices/sound/sound/cardN and its
/dev/snd/controlCN node before starting speakersafetyd. On J700,
50-j700-guard.conf's ExecCondition still runs before ExecStartPre so
speakerguardd machines skip it.
@maralcbr
maralcbr requested a review from scottjones as a code owner November 29, 2026 07:25
@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds a bounded wait before speakersafetyd starts.

  • Speakersafetyd waits briefly for the built-in sound control device before starting.

Reviews (1) · Last reviewed commit: "Wait for snd-soc-macaudio before startin..." · Reviewed by Greptile

@maralcbr
maralcbr merged commit 2bbe893 into main Nov 29, 2026
5 checks passed
omarchy-pkgs-merge Bot pushed a commit to omacom/omarchy-pkgs that referenced this pull request Nov 29, 2026
Pin omarchy-mac to 0.2.10-1 (commit 518550ca2d96449abbeac6e233e63db0655e01b3, tag omarchy-mac-v0.2.10), shipping omacom/omarchy-mac-pkgs#214 (bounded wait-for-macaudio ExecStartPre drop-in for speakersafetyd so it no longer panics twice at boot before snd-soc-macaudio probes).

Signed-off-by: Marcelo Alcantara <maralc@gmail.com>
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.

1 participant