canonical / charm-sysconfig

A subordinate charm to apply system settings like grub configurations or systemd configurations.
Apache License 2.0
0 stars 5 forks source link

grub-config-flags usage of $GRUB_CMDLINE_LINUX_DEFAULT does not work to keep previously configured kernel parameters #15

Closed dashmage closed 8 months ago

dashmage commented 8 months ago

The sysconfig charm's README.md says:

""" To add or keep kernel parameters you had previously configured see the grub-config-flags option below.

...

For instance, if you need to set the kernel parameter "nvme_core.multipath=0" you would add:

juju config sysconfig grub-config-flags='GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT nvme_core.multipath=0" """

But it does not work.

Without the charm:

$ cat /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="important=option"

$ sudo update-grub

$ grep -w -m1 ' linux' /boot/grub/grub.cfg linux /vmlinuz-4.15.0-106-generic root=... ro important=option

Now with the charm, but grub-config-flags option unset: (overrides it, as documented.)

$ grep -w -m1 ' linux' /boot/grub/grub.cfg linux /vmlinuz-4.15.0-106-generic root=... ro console=tty0 console=ttyS0,115200 console=ttyS1,115200 pti=off

Now with the charm, AND grub-config-flags option set as suggested:

$ juju config sysconfig-ubuntu grub-config-flags='GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT something=else"'

$ grep -w -m1 ' linux' /boot/grub/grub.cfg linux /vmlinuz-4.15.0-106-generic root=... ro console=tty0 console=ttyS0,115200 console=ttyS1,115200 pti=off something=else

Note that the 'important=option' is lost.

With this fix:

@ https://code.launchpad.net/~mfo/charm-sysconfig/+git/charm-sysconfig/+merge/386280

$ juju upgrade-charm --path .../sysconfig sysconfig-ubuntu

$ grep -w -m1 ' linux' /boot/grub/grub.cfg linux /vmlinuz-4.15.0-106-generic root=... ro important=option something=else console=tty0 console=ttyS0,115200 console=ttyS1,115200 pti=off

Now all options are there:

And if we reset the option (keep current behavior)

$ juju config sysconfig-ubuntu --reset grub-config-flags

$ grep -w -m1 ' linux' /boot/grub/grub.cfg linux /vmlinuz-4.15.0-106-generic root=... ro console=tty0 console=ttyS0,115200 console=ttyS1,115200 pti=off


Imported from Launchpad using lp2gh.

dashmage commented 8 months ago

(by zzehring) Thanks for the detailed bug report and associated MR. We'll get this change through our MR process.

dashmage commented 8 months ago

(by xavpaice) cs:~bootstack-charmers-next/sysconfig-4 has this merged.

dashmage commented 8 months ago

(by mfo) Hi Xav / Bootstack Charmers,

Could you please clarify whether there is an ETA on landing this fix to the stable charms, and/or how your release process works?

Thank you! Mauricio

dashmage commented 8 months ago

(by arif-ali) cs:sysconfig now has the fix