Skip to content

bootloader: Add bootc loader-entries set-options-for-source support#827

Draft
jmarrero wants to merge 1 commit intoredhat-performance:masterfrom
jmarrero:kargs-source
Draft

bootloader: Add bootc loader-entries set-options-for-source support#827
jmarrero wants to merge 1 commit intoredhat-performance:masterfrom
jmarrero:kargs-source

Conversation

@jmarrero
Copy link
Copy Markdown

@jmarrero jmarrero commented Feb 27, 2026

bootloader: Add bootc loader-entries set-options-for-source support
On bootc systems with transient /etc, the state file
/etc/tuned/bootcmdline is lost after each reboot. This causes
TuneD to lose track of which kernel arguments it previously
set, leading to kargs stacking up on every reboot cycle.

bootc loader-entries set-options-for-source solves this by
recording kargs ownership directly in the BLS config on /boot,
which persists across reboots regardless of /etc transience.
With --source tuned, bootc automatically removes all previous
kargs from the "tuned" source and replaces them with the new
set, eliminating the need for TuneD to maintain its own state
for diffing.

This commit adds bootc source tracking to the bootloader plugin:

  1. Detect set-options-for-source availability by checking
    "bootc loader-entries set-options-for-source --help" exit
    code during plugin init.

  2. When available, use "bootc loader-entries
    set-options-for-source --source tuned --options ..." for
    applying kargs and the same command without --options for
    clearing all TuneD-owned kargs on profile removal.

  3. The bootc path is a top-level dispatch branch, checked
    before rpm-ostree. Fallback chain: bootc -> rpm-ostree
    legacy --delete/--append -> GRUB2. All existing code paths
    are unchanged.

  4. Continue writing to /etc/tuned/bootcmdline as best-effort
    for diagnostics and backward compatibility, but do not
    depend on it for correctness when bootc source tracking
    is available.

  5. Add 15 unit tests for the bootloader plugin covering:
    bootc detection (3), apply (3), removal (2), init flag
    derivation (2), and top-level dispatch (5).

Requires: bootc with loader-entries set-options-for-source
(bootc PR #2114) and ostree >= 2026.1
See: bootc-dev/bootc#899
See: bootc-dev/bootc#2114

Assisted-by: OpenCode (Claude Opus 4.6)

On bootc systems with transient /etc, the state file
/etc/tuned/bootcmdline is lost after each reboot. This causes
TuneD to lose track of which kernel arguments it previously
set, leading to kargs stacking up on every reboot cycle.

bootc loader-entries set-options-for-source solves this by
recording kargs ownership directly in the BLS config on /boot,
which persists across reboots regardless of /etc transience.
With --source tuned, bootc automatically removes all previous
kargs from the "tuned" source and replaces them with the new
set, eliminating the need for TuneD to maintain its own state
for diffing.

This commit adds bootc source tracking to the bootloader plugin:

1. Detect set-options-for-source availability by checking
   "bootc loader-entries set-options-for-source --help" exit
   code during plugin init.

2. When available, use "bootc loader-entries
   set-options-for-source --source tuned --options ..." for
   applying kargs and the same command without --options for
   clearing all TuneD-owned kargs on profile removal.

3. The bootc path is a top-level dispatch branch, checked
   before rpm-ostree. Fallback chain: bootc -> rpm-ostree
   legacy --delete/--append -> GRUB2. All existing code paths
   are unchanged.

4. Continue writing to /etc/tuned/bootcmdline as best-effort
   for diagnostics and backward compatibility, but do not
   depend on it for correctness when bootc source tracking
   is available.

5. Add 15 unit tests for the bootloader plugin covering:
   bootc detection (3), apply (3), removal (2), init flag
   derivation (2), and top-level dispatch (5).

Requires: bootc with loader-entries set-options-for-source
          (bootc PR #2114) and ostree >= 2026.1
See: bootc-dev/bootc#899
See: bootc-dev/bootc#2114

Assisted-by: OpenCode (Claude Opus 4.6)
@jmarrero jmarrero changed the title bootloader: Add rpm-ostree kargs --source=tuned support bootloader: Add bootc loader-entries set-options-for-source support Apr 17, 2026
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