Repository navigation
Conversation
On systems using bootc 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 added, resulting in kargs stacking up indefinitely. This commit makes two changes: 1. Use idempotent rpm-ostree flags: - --delete-if-present instead of --delete - --append-if-missing instead of --append This prevents errors when state is inconsistent and avoids duplicate kargs. 2. Before modifying kargs, check if the profile's kargs are already present in rpm-ostree. If so, just restore the state file instead of attempting to add them again. This handles the post-reboot case where kargs persist in rpm-ostree but the state file was wiped. Resolves: RHEL-135363 Assisted-by: OpenCode (Claude Opus 4.5)
|
The root problem is we don't have a clean "kargs.d" that operates locally: bootc-dev/bootc#899 All that we have is the merged BLS config file - but "ownership" is lost in that in the merged Now one clear model with UKIs is where these materialize as drop-ins https://www.freedesktop.org/software/systemd/man/latest/systemd-stub.html That's a .d style approach. |
|
Strawman: Extend Then if we rerun e.g. That would automatically handle dropping out any kargs that are no long referenced from the old commented And it'd need a return value to say if anything changed. Of course we don't actually need to implement this in rpm-ostree, tuned could do this on its own directly editing the BLS files (this just loses out on the rollback-by-default). |
|
It looks like this would be better addressed then in rpm-ostree. Closing here and I will start investigating the rpm-ostree changes for this. |
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append.
2. Stores source ownership using a custom key in the BLS config:
ostree-source-<name>=<kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is written to the staged
deployment GVariant ("bootconfig-extra" key) so custom BLS keys
survive the finalization roundtrip at shutdown. For direct deployments,
the BLS file is written directly.
6. Source names are validated to contain only alphanumeric characters,
dashes, and underscores to prevent malformed BLS keys.
Example workflow for TuneD:
# First run sets tuned's kargs
rpm-ostree kargs --source=tuned --append=nohz=full --append=isolcpus=1-3
# After reboot (with transient /etc), running again replaces, not stacks
rpm-ostree kargs --source=tuned --append=nohz=on --append=rcu_nocbs=2-7
# Old kargs (nohz=full, isolcpus=1-3) are removed
# New kargs (nohz=on, rcu_nocbs=2-7) are added
Restrictions:
- --source cannot be combined with --editor (use append-based workflow)
- --source cannot be combined with --delete or --replace (replacement
semantics are automatic)
Requires: ostree with "bootconfig-extra" staged serialization support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero <[email protected]>
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append.
2. Stores source ownership using a custom key in the BLS config:
ostree-source-<name>=<kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is written to the staged
deployment GVariant ("bootconfig-extra" key) so custom BLS keys
survive the finalization roundtrip at shutdown. For direct deployments,
the BLS file is written directly.
6. Source names are validated to contain only alphanumeric characters,
dashes, and underscores to prevent malformed BLS keys.
Example workflow for TuneD:
# First run sets tuned's kargs
rpm-ostree kargs --source=tuned --append=nohz=full --append=isolcpus=1-3
# After reboot (with transient /etc), running again replaces, not stacks
rpm-ostree kargs --source=tuned --append=nohz=on --append=rcu_nocbs=2-7
# Old kargs (nohz=full, isolcpus=1-3) are removed
# New kargs (nohz=on, rcu_nocbs=2-7) are added
Restrictions:
- --source cannot be combined with --editor (use append-based workflow)
- --source cannot be combined with --delete or --replace (replacement
semantics are automatic)
Requires: ostree with "bootconfig-extra" staged serialization support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero <[email protected]>
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append.
2. Stores source ownership using a custom key in the BLS config:
ostree-source-<name>=<kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is written to the staged
deployment GVariant ("bootconfig-extra" key) so custom BLS keys
survive the finalization roundtrip at shutdown. For direct deployments,
the BLS file is written directly.
6. Source names are validated to contain only alphanumeric characters,
dashes, and underscores to prevent malformed BLS keys.
Example workflow for TuneD:
# First run sets tuned's kargs
rpm-ostree kargs --source=tuned --append=nohz=full --append=isolcpus=1-3
# After reboot (with transient /etc), running again replaces, not stacks
rpm-ostree kargs --source=tuned --append=nohz=on --append=rcu_nocbs=2-7
# Old kargs (nohz=full, isolcpus=1-3) are removed
# New kargs (nohz=on, rcu_nocbs=2-7) are added
Restrictions:
- --source cannot be combined with --editor (use append-based workflow)
- --source cannot be combined with --delete or --replace (replacement
semantics are automatic)
Requires: ostree with "bootconfig-extra" staged serialization support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero Corchado <[email protected]>
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append.
2. Stores source ownership using a custom key in the BLS config:
ostree-source-<name>=<kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is written to the staged
deployment GVariant ("bootconfig-extra" key) so custom BLS keys
survive the finalization roundtrip at shutdown. For direct deployments,
the BLS file is written directly.
6. Source names are validated to contain only alphanumeric characters,
dashes, and underscores to prevent malformed BLS keys.
Example workflow for TuneD:
# First run sets tuned's kargs
rpm-ostree kargs --source=tuned --append=nohz=full --append=isolcpus=1-3
# After reboot (with transient /etc), running again replaces, not stacks
rpm-ostree kargs --source=tuned --append=nohz=on --append=rcu_nocbs=2-7
# Old kargs (nohz=full, isolcpus=1-3) are removed
# New kargs (nohz=on, rcu_nocbs=2-7) are added
Restrictions:
- --source cannot be combined with --editor (use append-based workflow)
- --source cannot be combined with --delete or --replace (replacement
semantics are automatic)
Requires: ostree with "bootconfig-extra" staged serialization support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero Corchado <[email protected]>
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append. When specified with no --append, all kargs from that source
are cleared.
2. Stores source ownership using a magic comment in the BLS config:
# x-ostree-options-source-<name> <kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc. Using comments (rather than custom keys) avoids
the risk of other tools choking on unknown BLS entries.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is serialized by ostree's
"bootconfig-comments" mechanism so magic comments survive the
finalization roundtrip at shutdown. For direct deployments, the BLS
file is written directly.
6. Source names are validated to be non-empty and contain only alphanumeric
characters, dashes, and underscores to prevent malformed entries.
Requires: ostree with magic comment preservation support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero Corchado <[email protected]>
On bootc systems with transient /etc, TuneD loses track of which kernel
arguments it previously added because its state file (/etc/tuned/bootcmdline)
is wiped on each reboot. This causes kargs to stack indefinitely - each time
TuneD runs, it adds the same kargs again without knowing they already exist.
This implements Colin's suggestion from the tuned PR discussion: add a
--source flag that tracks kargs ownership in the BLS config file itself.
When used, the source's previous kargs are removed and replaced with the
new set.
The implementation:
1. Adds --source=NAME option to 'rpm-ostree kargs'. When specified, all
kargs from that source are replaced with the new set provided via
--append. When specified with no --append, all kargs from that source
are cleared.
2. Stores source ownership using a magic comment in the BLS config:
# x-ostree-options-source-<name> <kargs>
Since BLS lives on /boot (not /etc), it persists across reboots even
with transient /etc. Using comments (rather than custom keys) avoids
the risk of other tools choking on unknown BLS entries.
3. On subsequent runs with the same --source, computes a diff between
old and new source kargs, removes the old ones, and adds the new ones.
4. Multiple sources can coexist independently (tuned, dracut, user, etc.)
5. For staged deployments, the source metadata is serialized by ostree's
"bootconfig-comments" mechanism so magic comments survive the
finalization roundtrip at shutdown. For direct deployments, the BLS
file is written directly.
6. Source names are validated to be non-empty and contain only alphanumeric
characters, dashes, and underscores to prevent malformed entries.
Requires: ostree with magic comment preservation support
Resolves: RHEL-135363
See: bootc-dev/bootc#899
See: redhat-performance/tuned#821
Assisted-by: OpenCode (Claude Opus 4.6)
Signed-off-by: Joseph Marrero Corchado <[email protected]>
On systems using bootc 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 added, resulting in kargs stacking up indefinitely.
This commit makes two changes:
Use idempotent rpm-ostree flags:
Before modifying kargs, check if the profile's kargs are already present in rpm-ostree. If so, just restore the state file instead of attempting to add them again. This handles the post-reboot case where kargs persist in rpm-ostree but the state file was wiped.
Resolves: RHEL-135363
Assisted-by: OpenCode (Claude Opus 4.5)
--
I have not tested this e2e and this was mostly written by Claude Opus 4.5 via Open Code but the idea here is to reconcile with
rpm-ostree kargsoutput before trying to add or delete kargs.