Public bug reported:

piboot-try-reboot.service reboots at sysinit while cloud-init-local is
still running. The reboot kills the cloud-init-local stage shim, and
cloud-init's SocketSync.__exit__ then fails to send the stage completion
reply (BrokenPipeError), aborting the remaining cloud-init stages and
marking cloud-init-main.service failed. This happens on the first boot
after every kernel, initramfs or flash-kernel update.

Why it races:
- piboot-try-reboot.service: DefaultDependencies=no,
  After=local-fs.target, WantedBy=sysinit.target,
  ExecStart=/usr/sbin/piboot-try --reboot.
- cloud-init-local.service: Before=sysinit.target.
- There is no Before=/After= relationship between them, so systemd
  starts both in the same sysinit transaction. piboot-try sets
  new/state=trying and calls `reboot`, which stops cloud-init-local
  (the shim) while cloud-init-main is still in the local stage.

Reproduction:
1. On a Pi image (25.10 or later), install a kernel update or run
   `sudo flash-kernel` so /boot/firmware/new/state is "unknown".
2. Reboot.
3. piboot-try-reboot reboots again during the boot; journalctl -u
   cloud-init-main shows the BrokenPipeError traceback and the unit
   exits 1.
A fresh image does not reproduce because there is no new/state.

Impact: every Pi user gets a console traceback and a failed
cloud-init-main.service on each kernel update. The machine still boots
(the A/B double boot completes), but the error tracker bucket is one of
the top 26.04 crashers (133-191 reports/week, 4,772 reports in calendar
2026 to date).

Proposed fix: add `Before=cloud-init-local.service` (and optionally
`Conflicts=cloud-init-local.service`) to piboot-try-reboot.service so
the A/B reboot is issued before the local stage starts. On the tryboot
boot the service is a no-op, so cloud-init runs normally. This is a
one-line unit change.

The cloud-init side is also being hardened (it must not abort the
remaining stages when its sync peer dies):
https://github.com/canonical/cloud-init/issues/7307
https://github.com/canonical/cloud-init/pull/7308

The original cloud-init bug, with the journal:
https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2146834

A/B boot documentation:
https://ubuntu.com/hardware/docs/boards/explanations/piboot-ab

Related: LP #2154627 (piboot-try-reboot cannot reach D-Bus at
sysinit.target and fails to reboot).

** Affects: piboot-try (Ubuntu)
     Importance: Medium
         Status: New


** Tags: arm64 questing raspi-image resolute stonking tenacious

** Tags added: arm64 questing raspi-image resolute stonking tenacious

** Changed in: piboot-try (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2190914

Title:
  piboot-try-reboot races cloud-init-local (BrokenPipeError on boot-
  asset updates)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/piboot-try/+bug/2190914/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to