Skip to content

Conversation

@iwanicki92
Copy link

@iwanicki92 iwanicki92 commented Oct 19, 2025

@macpijan do you think this way of doing A/B updates is better or not? From my point of view:

Pros:

  • Smaller images
  • Simpler Yocto code (no need for custom plugins to modify files during image generation).

Cons:

  • More complex initramfs (first boot) and update (otab-shell) scripts

Implements zarhus/zarhus-issues#47

.wic.gz and .swu files now have around half their previous size.

How it previously worked:

  • first boot, creation of rwoverlay

    old-first-boot
  • update

    old-update

How it works with this PR:

  • first boot, creation of slot B (boot_b, rootfs_b) and rwoverlay

    new-first-boot
  • update, otab-shell has to do a little more now (configuration is very similar/near identical to first boot). .swu update file contains boot_a/rootfs_a partition with changed label/UUID so it doesn't clash with original during update, or after if it fails.

    new-update

Tests: manual and not-yet merged OSFV tests:

  • Starting point: dynamically created slot B (.wic.gz and .swu was from this PR)

    ==============================================================================
    Zarhus
    ==============================================================================
    ZHS001.206 Make sure that cukinia tests pass                          | PASS |
    ------------------------------------------------------------------------------
    ZHS002.206 Make sure that update works :: Make sure that update vi... | PASS |
    ------------------------------------------------------------------------------
    ZHS003.206 Make sure that failed update rollbacks to working slot ... | PASS |
    ------------------------------------------------------------------------------
    ZHS004.206 Make sure that rollback works :: Make sure that `otab r... | PASS |
    ------------------------------------------------------------------------------
    Zarhus                                                                | PASS |
    4 tests, 4 passed, 0 failed
    ==============================================================================
    
  • Starting point: .wic.gz built from current develop (without changes from this PR), .swu file built from this PR. Tests results are the same as previously, so this update is backwards compatible.

  • Also tested without encryption feature


Current issues with this implementation:

  • Had to create workaround for missing tools needed by otab-shell script that runs during update (add /bin from inactive slot to PATH)
  • If update fails, then next updates won't work without either manual intervention or specially crafted update. This happens due to partitions on .swu having temporary label which is changed during update in otab-shell script. If update fails, then temporary label stays and next update can't find device to update (which is searched by label).
    This issue could also happen with current implementation, if for some reason inactive slot partitions had different labels from expected, either due to mistake or if update broke inactive partition filesystem so much that Linux can't read device label.

Second issue should be fixed before merging.

Signed-off-by: iwanicki92 <iwanicki92@gmail.com>
It'll be done dynamically during first boot

Signed-off-by: iwanicki92 <iwanicki92@gmail.com>
Signed-off-by: iwanicki92 <iwanicki92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant