Repository navigation
fix(upgrade): don't leave the device empty when a reboot is pending - #3420
Merged
vpetersson merged 1 commit intoOct 25, 2026
Merged
Conversation
When the dist-upgrade sets /var/run/reboot-required, this script exited before its `up -d`. install.sh has already run `docker compose down --remove-orphans` by then, and a removed container is not something `restart: always` can bring back, so the device was left with no containers, the script exited 0, and the installer reported success over a dark screen that the reboot did not fix. The check was correct when written in 2023: nothing removed the containers then, so skipping the bring-up left them defined and the restart policy recovered them at boot. The `down` added later for the swapoff OOM fix invalidated that, including the comment here that still described it. - Move the gate below the `up -d` and the wifi-connect pre-create, so the stack is running before we defer to the reboot. - Keep it above the stale-image purge, which is the one step worth deferring on a half-upgraded host. - Correct the now-stale comment on the low-RAM `stop`. - Add tests over the ordering, since the script has no unit harness and this is the part that broke a device. Reproduced and verified on a Pi 4: the same sequence that left zero containers now ends with all four Up and /api/v2/assets at 200, purge correctly skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
There was a problem hiding this comment.
Copilot encountered an error: Your billing is not configured or you have Copilot licenses from multiple standalone organizations or enterprises. To use premium requests, select a billing entity via the GitHub site, under Settings > Copilot > Features.
|
vpetersson
approved these changes
Oct 25, 2026
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.



Issues Fixed
Fixes #3419.
Description
When the Ansible run's dist-upgrade sets
/var/run/reboot-required,bin/upgrade_containers.shexited before itsdocker compose up -d.install.shhas already rundocker compose down --remove-orphansby then to free RAM for the dist-upgrade, and a removed container is not somethingrestart: alwayscan bring back. So the device was left with no containers at all, this script exited 0, and the installer reported success over a dark screen that rebooting did not fix.Found from a user whose
docker pscame back completely empty after running the installer: https://forums.screenly.io/t/sd-card-completely-full/6778The check itself was correct when it was written in 2023. Nothing removed the containers then, so skipping the bring-up left them defined and the restart policy recovered them at the next boot. The
down --remove-orphansadded later in #3172 invalidated that assumption, including the comment in this very file that still described it as holding.up -dand the wifi-connect pre-create, so the stack is running before the script defers to the reboot. Starting it costs nothing: the reboot is moments away andrestart: alwaysrestores it afterwards.stop, which claimed the reboot branch exits above theup -d.Verification
Pi 4 testbed on
latest-pi4-64, replaying the exact sequence.Before, on master:
After, same sequence with this branch:
The purge was correctly skipped on the reboot path. Testbed restored to baseline afterwards and its lock released.
The new tests fail against master with
the /var/run/reboot-required exit sits above the 'up -d' (line 259 vs 268), so they are not passing vacuously.shellcheckoutput is byte-identical to master's, 13 findings either side, all pre-existing.Note for whoever merges
This touches
bin/upgrade_containers.sh, as does the still-open #3415. The two edit different regions (that one the pull failure path, this one the reboot gate) but they are close enough that the second to merge may want a trivial rebase.Checklist
🤖 Generated with Claude Code