Skip to content

feat(installer): integrate complete runtime support for SONIE and systemd-boot OS upgrades#4532

Open
jasonbridges wants to merge 3 commits into
sonic-net:masterfrom
jasonbridges:sonie
Open

feat(installer): integrate complete runtime support for SONIE and systemd-boot OS upgrades#4532
jasonbridges wants to merge 3 commits into
sonic-net:masterfrom
jasonbridges:sonie

Conversation

@jasonbridges
Copy link
Copy Markdown

Pull Request Description: Add Support for SONIE & systemd-boot Upgrades

Title

feat(installer): integrate complete runtime support for SONIE and systemd-boot OS upgrades


Description Body

What I did

Introduced comprehensive runtime OS upgrade and installation support for bare-metal SONIE (SONiC Operating System Installation Environment) and generic systemd-boot based platforms into the sonic-installer framework.

This enables standard CLI operations (sonic-installer install, set-next-boot, set-default) to function seamlessly on non-GRUB, systemd-boot driven distribution architectures.

How I did it

Ported and combined three major feature evolutions into the standard utility framework:

  1. Base Bootloaders & Utilities: Introduced the sonic_sdboot_utils library to interact natively with systemd-boot loader variables and EFI configurations. Added the SonieGrubBootloader (sonie.py) and NullBootloader (null.py) classes.
  2. CLI Framework Integration: Integrated these bootloaders into sonic_installer/main.py. Added support for the --skip-bootloader parameter, robust temporary folder cleanup on SystemExit, and conditional database flags (-d) for hermetic environment updates.
  3. Optimized Path Refactoring: Refactored get_image_path in bootloader.py to implement a highly robust fallback sequence:
    • Validates target image versions securely by parsing slot sonic-config YAML manifests rather than guessing by file timestamps.
    • Tracks active slots containing valid SONiC root filesystems as automated fallbacks.
    • Resolves target slots dynamically based on /proc/cmdline running state.

How to verify it

Execute standard local unit test suites to confirm 100% pass rates across the new bootloader and assessment logic:

pytest tests/installer_bootloader_sonie_test.py
pytest tests/installer_bootloader_null_test.py
pytest tests/sdboot_install_main_test.py
pytest tests/sdboot_sdboot_config_test.py

Manual verification can be conducted on a SONIE bare-metal or QEMU instance:

sonic-installer install /path/to/sonic.bin -y

Previous command output (if the output of a command-line utility has changed)

Operations on systemd-boot architectures previously failed with fatal exceptions due to missing GRUB environment files:

Failed to detect bootloader environment. Aborting...

New command output (if the output of a command-line utility has changed)

Standard sonic-installer output now processes cleanly on systemd-boot platforms:

Installing image sonic.bin and setting it as default...
Verification successful
Setup SWAP memory
Done

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jasonbridges jasonbridges marked this pull request as ready for review May 10, 2026 00:47
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Change-Id: Ic923c51ded5c8343e4bf6cae2b83f3b2630c440a
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

# Always check for A/B slots first as they are preferred for SONiC
candidates = []
for slot in ["image-A", "image-B"]:
slot_path = path.join(HOST_PATH, slot)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this assumes that the two images will be mounted at /host/image-A and /host/image-B? Might it make sense to use partition labels or something similar instead of assuming it will be mounted there?

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.

3 participants