Skip to content

Use grubby to update kernel command line arguments - #511

Open
mihaelabalutoiu wants to merge 5 commits into
cloudbase:mainfrom
mihaelabalutoiu:add-grubby-kernel-opts
Open

mihaelabalutoiu wants to merge 5 commits into
cloudbase:mainfrom
mihaelabalutoiu:add-grubby-kernel-opts

Conversation

@mihaelabalutoiu

@mihaelabalutoiu mihaelabalutoiu commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Failing to update the kernel console options breaks text console functionality on affected platforms.

The issue is caused by BLS being enabled by default in /etc/default/grub. On RHEL 10, kernel arguments are managed through /boot/loader/entries, and grub2-mkconfig does not propagate the updated options there.

This PR implements the following:

  • Adds Grub2ConfigEditor.remove_from_option, with grubby --remove-args semantics: a bare name drops the argument whichever value it holds, a name/value pair drops it only on an exact match.
  • Adds _update_kernel_cmdline_args to the base OSMorphing tools, editing both GRUB2 cmdline options through Grub2ConfigEditor. Debian and SUSE each had their own copy of these edits and now share this one.
  • Overrides it on redhat to use grubby --update-kernel=ALL, which reaches the BLS boot entries.

Comment thread coriolis/osmorphing/base.py
@mihaelabalutoiu
mihaelabalutoiu marked this pull request as draft September 4, 2026 07:08
@mihaelabalutoiu
mihaelabalutoiu force-pushed the add-grubby-kernel-opts branch 2 times, most recently from 17e0300 to f6177de Compare September 8, 2026 13:34
@mihaelabalutoiu
mihaelabalutoiu marked this pull request as ready for review September 9, 2026 09:47
Comment thread coriolis/osmorphing/suse.py
Comment thread coriolis/osmorphing/base.py
Comment thread coriolis/tests/osmorphing/test_base.py Outdated
Comment thread coriolis/tests/osmorphing/test_base.py Outdated
Comment thread coriolis/tests/osmorphing/test_debian.py Outdated
Comment thread coriolis/tests/osmorphing/test_redhat.py
Comment thread coriolis/tests/osmorphing/test_redhat.py Outdated
Comment thread coriolis/tests/osmorphing/test_suse.py Outdated
Comment thread coriolis/tests/test_utils.py Outdated
Removes cmdline entries with `grubby --remove-args` semantics: a bare
name drops the argument whichever value it holds, a name/value pair
drops it only on an exact match.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Use `grubby --update-kernel=ALL` to update kernel arguments on
BLS-based systems such as RHEL 10, where `grub2-mkconfig` does not
propagate them to `/boot/loader/entries`.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Existing `name=value` arguments are parsed as `key_val`, so appending
them as `single` values duplicated them.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
@mihaelabalutoiu

Copy link
Copy Markdown
Member Author

I've made all the changes, please take a look now. Thank you!

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