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

Bug #1884829 reported by Mauricio Faria de Oliveira
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charm-sysconfig
Fix Released
Medium
Unassigned

Bug Description

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:
- previously configured 'important=option'
- newly configured 'something=else'
- charm configured options.

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

Related branches

Revision history for this message
Zachary Zehring (zzehring) wrote :

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

Changed in charm-sysconfig:
importance: Undecided → Medium
status: New → In Progress
status: In Progress → Triaged
Revision history for this message
Xav Paice (xavpaice) wrote :

cs:~bootstack-charmers-next/sysconfig-4 has this merged.

Changed in charm-sysconfig:
status: Triaged → Fix Committed
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

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

Revision history for this message
Arif Ali (arif-ali) wrote :

cs:sysconfig now has the fix

Changed in charm-sysconfig:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.