Skip to content

Detect pending OS update after marking the booted slot good#7022

Open
agners wants to merge 1 commit into
mainfrom
os-pending-update-grub-primary
Open

Detect pending OS update after marking the booted slot good#7022
agners wants to merge 1 commit into
mainfrom
os-pending-update-grub-primary

Conversation

@agners

@agners agners commented Jul 9, 2026

Copy link
Copy Markdown
Member

Proposed change

Since #7006 Supervisor recovers an OS update that is installed but still pending a reboot by comparing rauc's primary boot slot with the booted one at load time. On GRUB-based systems (generic-x86-64, OVA, generic-aarch64) this misfires on every boot: grub.cfg increments the booted slot's boot attempt counter on each boot attempt, and rauc's GRUB backend only treats a slot as primary once it has no boot attempts pending. Until the booted slot is marked good — which happens later in Core.start()GetPrimary reports the previous slot as primary, so Supervisor misdetected the previous slot's (older) version as a pending update. This raised a bogus reboot-required issue on every boot (#7016), and since /os/info reports a pending version as the current version, it also made Core offer an "update" to the already running version, which Supervisor then rejected as already installed (#7017).

Move the detection from load() into mark_healthy() and mark the booted slot good first: that resets the boot attempt counter, making GetPrimary trustworthy. Marking the booted slot active remains conditional on no pending update and now runs after the detection, so a genuinely pending update (which can also be a deliberate downgrade) still isn't cancelled by a Supervisor restart.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to the supervisor)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Ruff (ruff format supervisor tests)
  • Tests have been added to verify that the new code works.

If API endpoints or add-on configuration are added/changed:

Since #7006 Supervisor recovers an OS update that is installed but still
pending a reboot by comparing rauc's primary boot slot with the booted
one at load time. On GRUB-based systems (generic-x86-64, OVA,
generic-aarch64) this misfires on every boot: grub.cfg increments the
booted slot's boot attempt counter on each boot attempt, and rauc's GRUB
backend only treats a slot as primary once it has no boot attempts
pending. Until the booted slot is marked good -- which happens later in
Core.start() -- GetPrimary reports the previous slot as primary, so
Supervisor misdetected the previous slot's (older) version as a pending
update. This raised a bogus reboot-required issue on every boot (#7016)
and, since /os/info reports a pending version as the current version,
made Core offer an "update" to the already running version, which
Supervisor then rejected as already installed (#7017).

Move the detection from load() into mark_healthy() and mark the booted
slot good first: that resets the boot attempt counter, making GetPrimary
trustworthy. Marking the booted slot active remains conditional on no
pending update and now runs after the detection.
@agners agners requested review from mdegat01 and sairon July 9, 2026 22:38
@agners agners added the bugfix A bug fix label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistent reboot required message

1 participant