Skip to content

Sunshine: canonical unit enable and security-floor bump - #12271

Open
chessing234 wants to merge 4 commits into
omacom:quattrofrom
chessing234:fold/sunshine-unit-security
Open

chessing234 wants to merge 4 commits into
omacom:quattrofrom
chessing234:fold/sunshine-unit-security

Conversation

@chessing234

@chessing234 chessing234 commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Same changes as #8136 #11760, folded so review is one place. Install enables the canonical unit name and upgrades past the security floor when stable lags.

Test plan

  • Spot-check each folded PR's test plan still applies

@llstrk

llstrk commented Sep 25, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

The review found three behavior issues and one test defect:

  1. Now that the install completes, Sunshine is started twice at login.
  2. The security-floor helper handles failures in ways that either silently skip the upgrade or block later steps.
  3. The helper is pinned to an edge build that the edge index no longer lists.
  4. sunshine-install-test.sh fails outside a machine that already has the helper on PATH.

Verified: Enabling Sunshine by its real unit name is the right fix for the fresh-install Unit sunshine.service does not exist failure, and the remove script's disable order is correct.

Verified (systemd, pacman and Omarchy source, plus repository data fetched 2026-09-25):

  • systemctl --user enable looks up a file with the requested name, so sunshine only resolves after the packaged app-dev.lizardbyte.app.Sunshine.service has been enabled. After that, is-enabled sunshine.service reports the alias as enabled.
  • pacman -U <url> uses the global SigLevel = Required from default/pacman/pacman-stable.conf (no RemoteFileSigLevel is set), so the edge package must carry a valid signature. The pinned x86_64 file has a .sig issued by the Omarchy key.
  • The dependencies the edge build adds (gtk3, hicolor-icon-theme, qt6-base, qt6-svg) are available on stable. A later omarchy update (-Syu) only warns "local is newer" and does not downgrade.
  • omarchy-migrate runs the new migration on existing installs even though 1789400200 sorts before already-shipped migrations.

Two start paths are now active on every fresh install

Before this PR, the enable step failed on a fresh install, so set -e stopped the script before it wrote the Hyprland autostart line. With the enable fixed, the script reaches enable_hyprland_autostart, and both start paths are configured:

login
├─ systemd user unit (WantedBy=graphical-session.target, enabled by this PR)
│    └─ /usr/bin/sunshine   Restart=on-failure, StartLimitBurst=5
└─ ~/.config/hypr/autostart.lua: o.launch_on_start("sunshine")
     └─ uwsm-app -- sunshine   (separate process, not the unit)

Sunshine v2026.906.222525 rtsp.cpp: bind failure on port 48010 → fatal log, shutdown

The second instance cannot bind the RTSP port and shuts down. If that instance is the systemd one, Restart=on-failure retries it until the start limit is hit. This matches open issue #7218. That issue notes the problem was masked while the installer aborted at the enable step. The new test asserts both the canonical enable and the autostart line.

Impact: Every fresh install gets a failing or restarting Sunshine instance at each login. Streaming still works through whichever instance wins. Which instance wins, and the exact crash pattern, come from #7218's reported observations, not from a reproduction here.

Suggested change: Keep exactly one start path. For example, keep the enabled unit and drop enable_hyprland_autostart (the remove script already cleans that line), then change the test to assert that only one start path is configured.

Security-floor helper: failure outcomes

omarchy-pkg-upgrade-sunshine-security runs under set -euo pipefail and is called unguarded from both the install script and the migration. The outcomes below were observed in sandboxed runs with synthetic pacman/curl/sudo stubs inside the real omarchy-migrate and install script. The provider row comes from pacman source reading only.

Situation Helper Migration Install script
HEAD probe fails (offline, outage, file pruned, aarch64 404) exits 0 marked done, never retried; Sunshine stays below the floor continues with the old version
pacman -U fails (sudo cancelled, download/signature error, lock) exits 1 no marker; stops every later migration until it succeeds aborts before unit enable, firewall, webapp and autostart
Installed package is an AUR provider below the floor (sunshine-git: provides/conflicts=sunshine) pacman -Q sunshine matches the provider; pacman -U --noconfirm answers the conflict prompt "no" and fails fails on every retry aborts as above

Impact: A transient network problem permanently skips the security upgrade. A deterministic failure blocks the rest of the migration queue. The Sunshine install, which this PR otherwise fixes, can again stop halfway.

Suggested change: Keep a failed probe from recording the migration as complete. For example, exit non-zero so the migration retries, and keep deliberate skips (package absent, already new enough, unsupported architecture) at exit 0. In the install script, warn and continue if the helper fails (omarchy-pkg-upgrade-sunshine-security || echo "..." >&2). Consider skipping when pacman -Q sunshine reports a package name other than sunshine.

Pinned edge build is no longer listed

As of 2026-09-25, the edge x86_64 database lists sunshine 2026.914.233613-1. The pinned 2026.906.222525-1.1 file still downloads with its signature, but it is no longer in the index. Edge aarch64 is still at 2026.516.143833-4.1, and the pinned aarch64 URL returns 404, although the case treats aarch64 as published. Stable and rc x86_64 still list 2026.516.143833-4.1.

Impact: Once edge prunes the pinned file, the helper and migration print "not available yet" and, combined with the probe-failure outcome above, record the upgrade as done without installing anything.

Suggested change: Publishing a fixed build to stable and rc on the package-repository side would reach every channel without client code. If a client-side stopgap stays, read the current Sunshine entry from the edge database instead of hard-coding a file name, and compare against the upstream version (2026.906.222525) rather than an Omarchy pkgrel.

sunshine-install-test.sh depends on the host

  • The test runs the install script with PATH="$mock_bin:$PATH", but neither mocks omarchy-pkg-upgrade-sunshine-security nor adds $ROOT/bin to PATH. With PATH=/usr/bin:/bin it exits 127 (omarchy-pkg-upgrade-sunshine-security: command not found) before any assertion. On a host where the helper resolves, it runs the real pacman, vercmp and curl.
  • The install script checks the fixed host path /usr/lib/systemd/user/app-dev.lizardbyte.app.Sunshine.service. With that file present, as on any machine with Sunshine installed, the script correctly takes the canonical branch on the second run. Scenario 2 then fails with not ok - already-enabled sunshine.service is reused via its alias. Without the file, neither scenario exercises the canonical branch that real installs use.

Impact: Test-only. Depending on the host, the test exits 127, runs real package tools, or fails scenario 2. On hosts without Sunshine installed, it does not exercise the canonical branch that real installs take.

Suggested change: Add a mock omarchy-pkg-upgrade-sunshine-security to mock_bin and assert that it runs before the enable. Make the unit-file check injectable, or drop the fallback branches, since both published packages ship only the canonical unit and re-enabling it is idempotent.

Optional test improvement: sunshine-security-upgrade-test.sh only greps for strings, so none of the failure outcomes in the table above are caught. A small table test with stubbed pacman/curl/sudo could cover the below/at/above-floor comparisons, probe failure and pacman -U failure.

Repository conventions: The new migration is mode 755, while agents/skills/migrations.md requires 0644 (all other migrations are 0644). The helper calls sudo without # omarchy:requires-sudo=true metadata. Suggested change: set the migration to 0644 and add the requires-sudo metadata line to the helper.


Review information

Test scope: Source review of head 08f91b7 against merge-base 9c5482c. Source review covered systemd install.c, pacman 7.1 (conf.c, upgrade.c, dload.c, query.c, sync.c) and Sunshine v2026.906.222525 (rtsp.cpp). Omarchy stable, rc and edge package databases and the pinned and stable Sunshine packages were fetched and inspected as data on 2026-09-25. Sandboxed runs without network covered both new tests, the helper, the migration and omarchy-migrate, using synthetic pacman, curl, sudo and uname stubs. No real login session, systemd instance, pacman transaction or aarch64 system was used. The double start and the AUR provider conflict are conclusions from source and issue reports, not runtime reproductions.

AI process: Opus 5.5 Medium coordination and synthesis, independent Opus 5.5 Xhigh and GPT 6 Sol Xhigh technical assessments with targeted cross-checks of single-sourced claims, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

Drop the Hyprland autostart path that raced a second instance onto RTSP.
Probe/pacman failures no longer soft-skip the migration, and install keeps
going if the floor upgrade cannot complete.
@chessing234
chessing234 force-pushed the fold/sunshine-unit-security branch from 08f91b7 to d1edce3 Compare September 25, 2026 15:38
@chessing234

Copy link
Copy Markdown
Contributor Author

addressed the review: systemd-only start (no hypr autostart), probe failures retry the migration, install continues if the floor upgrade fails, and the floor pin is bumped to the current edge build.

@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Follow-up to the earlier review and the author's reply, checked at head d1edce3.

Outcome: Verified on d1edce3: the new revision fixes the double start for new installs, the helper's failure handling and the stale pin. Four points remain: installs that already have both start paths are not repaired, the hard-coded pin can now block later migrations if the file disappears, switching to stable or rc reverts the upgrade, and the install test still depends on the host.

Earlier finding Status on d1edce3
1. Two start paths at login Resolved for new installs and reinstalls. Existing installs keep the old line (see below).
2. Helper failure outcomes Resolved on x86_64. aarch64 still records the migration as done when the probe fails.
3. Pinned edge build unlisted Resolved for now. The file name is still hard-coded (see below).
4. Install test depends on the host Partly resolved. The helper is mocked, but the fixed unit path remains.
Optional: grep-only security test Unchanged.
Repository conventions (mode, requires-sudo) Resolved.

Verified (source, plus sandboxed runs of the real helper, install script and omarchy-migrate with stubbed pacman, curl, sudo and uname):

  • The installer no longer writes o.launch_on_start("sunshine"), and the new test checks for its absence after both install runs.
  • A failed x86_64 probe (404, DNS failure, timeout) now exits 1, as a failed pacman -U already did. omarchy-migrate writes no marker, stops the queue as agents/skills/migrations.md requires, and a later run in which the file is available completes normally.
  • When the helper fails, the installer prints a warning and still enables the unit, opens the firewall ports and installs the web app.
  • An AUR provider such as sunshine-git is skipped. pacman -Qq sunshine prints the provider's name (pacman 7.1 query.c falls back to alpm_find_satisfier), so the != sunshine check works.
  • The new floor 2026.914.233613-1 is the build the edge x86_64 database lists as of 2026-09-27. Its .sig names the Omarchy key as issuer, and its added dependencies are available on the stable mirror. Upstream advisory GHSA-fp6g-27w5-489j lists v2026.914.233613 as the patched version.
  • The migration is now mode 0644, and the helper declares # omarchy:requires-sudo=true.

Author reply: All four stated changes are confirmed. Two limits apply: "systemd-only start" covers new installs and reinstalls only, and "probe failures retry the migration" holds on x86_64 only. On aarch64 a failed probe is still a deliberate soft skip. The edge aarch64 database lists 2026.516.143833-4.1, and the pinned aarch64 URL returns 404. The stable and rc Omarchy repositories list no aarch64 Sunshine package, so this mainly affects edge users.

Existing installs keep the second start path

The earlier installer ran systemctl --user enable --now sunshine under set -e and only then appended the Hyprland line. So every install where the earlier installer wrote the line had the unit enabled at that point, which is the setup reported in #7218. This PR stops writing the line, but nothing removes it:

existing install, after this PR
├─ systemd user unit (enabled earlier)        → starts Sunshine
└─ ~/.config/hypr/autostart.lua line (kept)   → starts a second Sunshine
   ├─ migration 1789400200: upgrades the package only
   └─ re-running the installer: line still present (sandboxed run)

The double start follows from #7218's reports and the earlier installer's source; it was not reproduced here. The line surviving a reinstall was observed in a sandboxed run.

Impact: Users who already hit #7218 keep the competing second process after updating. No update or migration removes it. Only the remove script strips that single line (a full omarchy-refresh-hyprland resets the whole file).

Suggested change: Strip the exact line in the installer (reuse the remove script's sed), and add a migration that strips it for existing installs, for example only when the canonical unit is enabled. Open PR #12358 contains such a migration (1789703649.sh, which strips the line unconditionally). Its new test also fails against this PR's remove script, because it rejects the retained systemctl --user disable --now sunshine line. The two PRs need a coordinated resolution.

The pinned file name can now block the migration queue

The helper still builds the URL from the pinned version, and a failed probe on x86_64 now exits 1. If edge stops serving sunshine-2026.914.233613-1-x86_64.pkg.tar.zst before stable and rc carry a fixed build, this migration fails on every run for x86_64 users below the floor. omarchy-migrate then stops there. Inside omarchy update, the error aborts everything after omarchy-migrate: orphan cleanup, status, service restarts, AUR updates, hooks and the reboot prompt.

This has not happened yet: as of 2026-09-27, edge still serves the older 2026.906.222525-1.1 and 2026.516.143833-4.1 files. But a failure that was a silent skip in the earlier revision is now a blocking one.

Impact: The fix depends on one edge file staying available. If it disappears first, every omarchy update on affected x86_64 installs stops at this migration.

Suggested change: Publishing 2026.914.233613 or newer to stable and rc removes the dependency without client code. If the client-side helper stays, read the current file name from the edge omarchy.db entry and require it to be at or above the floor, instead of building the URL from a fixed name.

Switching to stable or rc reverts the upgrade

omarchy-channel-set and omarchy-reinstall-pkgs go through omarchy-refresh-pacman, which runs pacman -Syyuu. In pacman 7.1 source, -uu downgrades a package whose local version is newer than the repository's. On stable or rc, Sunshine would then return to 2026.516.143833-4.1 while the migration marker stays in place. This is a conclusion from pacman source, not an observed transaction.

Impact: Switching to or re-selecting stable or rc undoes the security upgrade, and nothing re-applies it. Until stable or rc ship the fix, only re-running the installer applies the floor again.

Suggested change: The same stable and rc publication fixes this.

Optional: The migration upgrades the package but does not restart the running user unit, so the old binary keeps running until the next login. Other migrations restart a running user service after a change (for example 1789130779.sh uses systemctl --user try-restart wireplumber.service).

Optional test improvement: Two changes would make the tests catch real regressions:

  • sunshine-install-test.sh still depends on the fixed host path /usr/lib/systemd/user/app-dev.lizardbyte.app.Sunshine.service. In a sandboxed copy with that path made injectable and the unit present, scenario 2 fails with not ok - already-enabled sunshine.service is reused via its alias. The helper mock always succeeds, so the test would still pass if the installer went back to aborting when the helper fails. Make the unit path injectable and add a failing-helper case.
  • sunshine-security-upgrade-test.sh only greps source strings. A helper that exits 0 before checking anything would still pass, because the checked strings stay in the file. A small table test with stubbed pacman/curl/sudo/uname could cover the provider skip, the x86_64 and aarch64 probe failures, and a failed pacman -U.

Stale text: migrations/1789400200.sh still prints "past the 2026.516 security floor" and says edge has 2026.906.222525. The floor is now 2026.914.233613.


Review information

Test scope: Follow-up source review of head d1edce3 (base d201fb9), compared with the earlier reviewed PR diff on 08f91b7. Pacman 7.1 source was read for query, sync and downgrade behavior. Omarchy stable, rc and edge package databases, the pinned package and its signature, and the stable mirror databases were fetched as data on 2026-09-27. Sandboxed runs without network covered the helper, the migration under omarchy-migrate, the install script and both PR tests, using synthetic pacman, curl, sudo and uname stubs. No real login session, systemd instance, pacman transaction or aarch64 system was used. The double start on existing installs is based on #7218's reports and the earlier installer's source, not on a reproduction. The -Syyuu downgrade is a conclusion from pacman source. Edge retention was checked once, and the Omarchy repository documents no retention policy.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@jandrusk

Copy link
Copy Markdown

Canonical unit enable (not Alias=sunshine) is the right fix for #13877/#12499/#12537, and the security-floor helper is a nice fold of #11956.

Lots of open siblings (#14412, #13925, #12505, #12358, #13230). Please pick one unit-enable approach and close the rest; this PR's extra value is the floor upgrade — happy to trim to that if another unit PR lands first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants