Repository navigation
Guard trixie-next on Bullseye/Bookworm and return to compatible Release - #4341
Open
kevinwieland wants to merge 3 commits into
Open
kevinwieland wants to merge 3 commits into
kevinwieland wants to merge 3 commits into
Conversation
Recover old updaters to a stable pre-2.5 release before startup migrations. Publish a bounded MQTT warning before the release reboot. Add sandbox tests.
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="runs/atreboot.sh" line_range="10" />
<code_context>
+requiresSystemUpdate
+guardStatus=$?
+case "$guardStatus" in
+ 0) exec bash "$OPENWBBASEDIR/runs/update_self.sh" "trixie-next" ;;
+ 1) ;;
+ *) echo "Cannot read OS identity; refusing startup changes." >&2; exit 1 ;;
</code_context>
<issue_to_address>
**Incompatible application starts after failed recovery**
When recovery or OS-identity checks fail, `openwb2.service` ignores the nonzero `ExecStartPre` status because of its `-` prefix and runs `ExecStart` anyway, starting the incompatible checkout instead of blocking startup.
Remove the `-` prefix from `ExecStartPre` so a failed recovery prevents `ExecStart` from running.
Also at `runs/atreboot.sh:12`, `runs/update_self.sh:79`.
</issue_to_address>
### Comment 2
<location path="runs/atreboot.sh" line_range="7-10" />
<code_context>
+# Old updaters may already have checked out trixie-next. Recover before any
+# virtualenv, package, service, network or boot-configuration migration runs.
+source "$OPENWBBASEDIR/runs/os_update_guard.sh" || exit 1
+requiresSystemUpdate
+guardStatus=$?
+case "$guardStatus" in
+ 0) exec bash "$OPENWBBASEDIR/runs/update_self.sh" "trixie-next" ;;
+ 1) ;;
+ *) echo "Cannot read OS identity; refusing startup changes." >&2; exit 1 ;;
</code_context>
<issue_to_address>
**Bullseye and Bookworm reboot indefinitely**
When the service starts on Bullseye or Bookworm, including after a compatible Release is checked out, `atreboot.sh` checks only the OS codename and always calls `update_self.sh trixie-next`; `update_self.sh` selects and applies a compatible Release and reboots, so the next boot repeats the same path instead of starting the application.
Check the current checkout before invoking recovery, and skip recovery once a compatible Release is installed.
</issue_to_address>
### Comment 3
<location path="runs/os_update_guard.sh" line_range="11" />
<code_context>
+ source /etc/os-release || return 2
+ case "$VERSION_CODENAME" in
+ bullseye|bookworm) return 0 ;;
+ *) return 1 ;;
+ esac
+}
</code_context>
<issue_to_address>
**Unclassifiable OS proceeds as safe**
When `/etc/os-release` is readable and sourceable but `VERSION_CODENAME` is missing or empty, `requiresSystemUpdate` returns 1 for an empty `VERSION_CODENAME`, the same status used for a recognized non-target OS, so `atreboot.sh` continues startup migrations on an unclassifiable system still running `trixie-next`.
Return an error status for a missing or empty `VERSION_CODENAME` instead of treating it as a recognized non-target OS.
</issue_to_address>
### Comment 4
<location path="runs/atreboot.sh" line_range="12" />
<code_context>
+case "$guardStatus" in
+ 0) exec bash "$OPENWBBASEDIR/runs/update_self.sh" "trixie-next" ;;
+ 1) ;;
+ *) echo "Cannot read OS identity; refusing startup changes." >&2; exit 1 ;;
+esac
+
</code_context>
<issue_to_address>
**Failed guard leaves update status set**
When a user-triggered update runs while `/etc/os-release` is unreadable or lacks a usable identity, `System.perform_update` publishes `update_in_progress=true` before invoking `atreboot.sh`; on this error path the script exits before its normal status reset. The update indicator therefore remains set after OS identity cannot be read.
Reset `openWB/system/update_in_progress` on this early-exit path, or install cleanup that covers the guard check.
</issue_to_address>Block application imports despite ignored ExecStartPre failures. Handle empty OS identities, clear early update flags, deduplicate bounded MQTT errors and throttle automatic recovery retries. Allow 30 seconds for the reboot notice. Runtime files match laboratory candidate 906d7be5e8cdb6d57468a669233eb09185d81199.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Only Debian Bullseye and Bookworm trigger this fallback. Trixie and future nonempty codenames are not rejected by this specific guard; missing, empty or unreadable OS identity aborts safely.
trixie-nextrequest before checkout to the latest stable pre-2.5 Release tag (2.0–2.4, including-Patch.N; excluding Beta/RC tags).trixie-nextat the very beginning ofatreboot.sh, before virtualenv, package, service, network or boot-configuration migrations.packages/main.pybefore application imports. Old installed service units useExecStartPre=-...and ignore a failed recovery; the independent core-start guard covers those units without assuming a new service template has been installed.data/log; QoS1 retries reuse the event, acknowledged/dismissed events are not republished. Automatic startup recovery attempts receive a five-minute cooldown after failure. Directupdate_self.shrequests are not delayed by that cooldown.The compatible Release's startup script replaces the guarded script after checkout. The ordinary Release clears transient system messages during startup; this change does not promise that the pre-reboot warning remains visible after reboot.
No automatic OS migration, device/module eligibility restriction, configuration reset or backup restore is introduced. Failed fetch, missing compatible tags or failed checkout do not trigger a reboot. A blocked legacy service can still reach its existing systemd restart limit; the cooldown avoids repeating Git recovery work on each immediate restart.
Verification
ExecStartPrefailures, empty/missing OS identity, missing helper, damaged guard state, cooldown/retry boundaries and MQTT outage/reconnection with stable event IDs.Documentation and test additions are intentionally excluded as requested by the contributor. Existing repository tests are unchanged; private test evidence remains outside the PR.
Compatibility note
Already installed old updaters cannot be retroactively prevented from performing their initial checkout. The startup guard catches them afterwards. Preventing that first checkout requires a separate backport into the regular release; the Trixie-only startup rejection must not be copied unconditionally into a compatible legacy Release.