Skip to content

UKI Addons Support - #2448

Open
Johan-Liebert1 wants to merge 16 commits into
bootc-dev:mainfrom
Johan-Liebert1:uki-addon-full-support
Open

Johan-Liebert1 wants to merge 16 commits into
bootc-dev:mainfrom
Johan-Liebert1:uki-addon-full-support

Conversation

@Johan-Liebert1

Copy link
Copy Markdown
Member

uki-addon: Update addons on update/switch

Introduce a function to gather all currently installed addons, scoped
and global. On upgrade/switch, gather all installed addons and if an
addon with the same name is found in the upgrade image, update that
particular addon automatically


uki/addon: Support global addons

We were partially supporting global addons, but they were lumped in with
scoped/local addons. Add a new cli option to composefs installs called
--global-uki-addon which would determine which global addon to
install.


cfs/upgrade/switch: Handle UKI Addons

Here is what we do now with UKI Addons

  • Accept --uki-addon and --global-uki-addon cli options for bootc
    switch/upgrade commands

  • If we find an installed addon with the same name as the one in the new
    image, we update it


global-uki-addons: Add prefix to name

Prefix global addon filenames with the bootc identifier in the ESP so
we can distinguish bootc-managed global addons from third-party ones


uki-addon: Add CLI for managing UKI Addons

Add bootc uki-addon subcommand with three operations:

  • bootc uki-addon list: List installed UKI addons
    Supports --json for JSON output

  • bootc uki-addon add <name> <global|scoped>: Install an addon from
    the booted image onto the ESP

  • bootc uki-addon remove <name> [deployment_id]: Remove an addon

Add Display and Serialize to UkiAddonType/UkiAddonsList

@github-actions github-actions Bot added area/install Issues related to `bootc install` area/documentation Updates to the documentation labels Sep 10, 2026
@Johan-Liebert1
Johan-Liebert1 force-pushed the uki-addon-full-support branch 2 times, most recently from 2579e09 to e31ce45 Compare September 11, 2026 07:44
@supakeen

Copy link
Copy Markdown
Contributor

Can we install UKI addons as part of a deployment with bootc install? These are (sometimes) used to have addons for mount options so the UKI isn't tightly coupled to a specific disk layout.

Comment thread crates/lib/src/bootc_composefs/boot.rs
Comment thread crates/lib/src/bootc_composefs/boot.rs
Comment thread crates/lib/src/bootc_composefs/uki_addon.rs Outdated
Comment thread crates/lib/src/bootc_composefs/uki_addon.rs Outdated
Comment thread crates/lib/src/cli.rs
pub(crate) enum UkiAddonCliOpts {
/// List all installed UKI Addons
List {
/// Output in JSON format

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cc #522

Comment thread docs/src/man/bootc-uki-addon-add.8.md
Comment thread docs/src/experimental-composefs.md Outdated
Comment thread crates/lib/src/install.rs
/// This option can be provided multiple times if multiple addons are to be installed.
#[clap(long = "uki-addon")]
#[serde(default)]
pub(crate) scoped: Option<Vec<String>>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

BTW ideally we validate these eagerly at install time

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah. I'll add these to the UKI installation flow we have currently

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On second thoughts, would you be fine with this as a follow up? This PR's getting huge as is, and this requires some refactoring in the prepare_install function

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh yeah for sure can be a followup

@cgwalters

Copy link
Copy Markdown
Collaborator

Can we install UKI addons as part of a deployment with bootc install?

That's in the docs here right?

@cgwalters

Copy link
Copy Markdown
Collaborator

Or well actually, I think what you may be asking about is external UKI addons (i.e. not included in the container image), in which case it would totally make sense to do.

@supakeen

Copy link
Copy Markdown
Contributor

Or well actually, I think what you may be asking about is external UKI addons (i.e. not included in the container image), in which case it would totally make sense to do.

Yea I wasn't super clear but that was what I was thinking about 🙂

@Johan-Liebert1
Johan-Liebert1 force-pushed the uki-addon-full-support branch 3 times, most recently from 3422e57 to 4b63be2 Compare September 15, 2026 12:58

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How about bootc install --included-uki-addon foo --external-uki-addon /path/to/external.efi i.e. we always disambiguate between internal and external?

Comment thread docs/src/experimental-composefs.md Outdated
# Global addon: lives in loader/addons/, loaded by every UKI ergo every deployment
mkdir -p /out/loader/addons
ukify build --cmdline 'custom_param=value' \
--output /out/loader/addons/site-config.addon.efi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Uh is /loader right here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, the global addons go in /boot/loader/addons where /boot is the ESP. I made this changes in finalize-uki

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing I find hard to understand here is where the somewhat bespoke build system we've grown stops and where the actual APIs we're offering starts.

It feels weird to me to use /boot/loader here, shouldn't the addons live literally right next to the UKI?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It feels weird to me to use /boot/loader here, shouldn't the addons live literally right next to the UKI?

that's true for scoped UKI addons, but global addons do live in /boot/loader

From https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html

Addon files are sorted, loaded, and measured into TPM PCR 12 (if a TPM is present) and appended to the kernel command line. UKI command line options are listed first, then options from addons in /loader/addons/*.addon.efi, and finally UKI-specific addons.
[...]
Additionally, files /loader/addons/*.addon.efi are loaded and verified as PE binaries, and ".cmdline", ".dtb", ".initrd", and ".ucode" sections are parsed from them.

@Johan-Liebert1

Copy link
Copy Markdown
Member Author

How about bootc install --included-uki-addon foo --external-uki-addon /path/to/external.efi i.e. we always disambiguate between internal and external?

I don't understand what we mean by external here? I'm guessing it doesn't mean "global" addons

@cgwalters

Copy link
Copy Markdown
Collaborator

external ➡️ #2448 (comment)

Introduce a function to gather all currently installed addons, scoped
and global. On upgrade/switch, gather all installed addons and if an
addon with the same name is found in the upgrade image, update that
particular addon automatically

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
We were partially supporting global addons, but they were lumped in with
scoped/local addons. Add a new cli option to composefs installs called
`--global-uki-addon` which would determine which global addon to
install.

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Here is what we do now with UKI Addons

- Accept `--uki-addon` and `--global-uki-addon` cli options for bootc
  switch/upgrade commands

- If we find an installed addon with the same name as the one in the new
  image, we update it

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Assisted-by: AI

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Prefix global addon filenames with the bootc identifier in the ESP so
we can distinguish bootc-managed global addons from third-party ones

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Add `bootc uki-addon` subcommand with three operations:

- `bootc uki-addon list`: List installed UKI addons
  Supports `--json` for JSON output

- `bootc uki-addon add <name> <global|scoped>`: Install an addon from
  the booted image onto the ESP

- `bootc uki-addon remove <name> [deployment_id]`: Remove an addon

Add Display and Serialize to UkiAddonType/UkiAddonsList

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
- Add GC tests for Addons
- Add CLI tests

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Mark UKI Addons as experimental

Assisted-by: Claude-Code (Opus)
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
UkiAddonOpts is now flattened into both upgrade and switch commands,
which don't have a --composefs-backend flag. The
`requires = "composefs_backend"` constraint causes a panic
at clap validation time because the referenced argument doesn't exist
in those command contexts.

This is generally safe as the options are ignored for ostree installs
anyway

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Extract cmdline parsing from write_pe_to_esp into parse_uki_cmdline so
it runs for both the UKI and UKI addons. The `composefs=` parameter can
now be found in the main UKI or a scoped addon

- At most one composefs= cmdline across all PE binaries (UKI + addons).
  A second one is rejected even if the digest matches.

- Global UKI addons must never contain `composefs=` cmdline

- At least one `composefs=` cmdline must be found or the install fails

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Before removing a scoped addon, parse its PE binary and check for a
composefs= kernel parameter. If found, early exit as removing that addon
would make the system unbootable

Global addons are not checked because `composefs=` is rejected at
install time for global addons

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Test that bootc rejects composefs= in the wrong places

- Build a global addon containing composefs= from
  `bootc compute-composefs-digest`, attempt switch with
  --global-uki-addon, assert failure

- Build a scoped addon containing composefs= alongside
  the UKI (which already has it), attempt switch with --uki-addon,
  assert failure due to duplicate composefs=

It's a shame that we can't test UKI Addon only cmdline without piling on
a bunch of hacks since `bootc container ukify` unconditionally puts the
cmdline inside the UKI

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
This option lists all the UKI Addons across all deployments. Also, it
associates global addons with the deployments that reference them. It is
useful for GC-ing global UKI Addons if no deployments refer to them

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Similar to how we GC UKIs and scoped UKI Addons, GC Global UKI addons if
we have no EROFS images remaining that hold a reference to them, which
means that the deployments that depended on the Global addons have been
removed

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

Labels

area/documentation Updates to the documentation area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants