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

Add option to allow setting grub menu visibility and timeout #20

Closed dashmage closed 9 months ago

dashmage commented 9 months ago

During recovery of a CDK cluster on top of vmware, we were unable to catch a grub prompt to alter kernel boot flags, as the cloud image does not stop at a grub menu.

This needs to be configurable via sysconfig charm such that we can set a 30 or 60 second boot timer and make the grub menu visible on cloud images, whether hosted on Openstack, AWS, Google, or VMware.


Imported from Launchpad using lp2gh.

dashmage commented 9 months ago

(by jneo8) question: About grub-config-flags config

There is grub-config-flags in the sysconfig config. Can we use this config to set the timer?

dashmage commented 9 months ago

(by jneo8) Update: I test sysconfig on my local virtual-maas with this command

juju config sysconfig  update-grub=true grub-config-flags='GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=menu
GRUB_SERIAL_COMMAND="serial --speed=115200"
GRUB_TERMINAL="console serial"
'

And deploy on ubuntu(focal)

The /etc/default/grub.d/90-sysconfig.cfg will be config as

# Juju generated file - do not edit manually

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

# Evaluate grub-config-flags first, in case it uses $GRUB_CMDLINE_LINUX_DEFAULT.
# However, if grub-config-flags is not specified, ignore that (current behavior.)
# config-flags
GRUB_TIMEOUT=10
GRUB_TIMEOUT_STYLE=menu
GRUB_SERIAL_COMMAND="serial --speed=115200"
GRUB_TERMINAL="console serial"
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT console=ttyS0,115200 console=tty0"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
GRUB_TERMINAL=serial

The GRUB_TERMINAL will be override by default GRUB_TERMINAL=serial(Not sure why two config not merge), which make console be disabled and grub can't view on virt-viewer

(I tried to comment GRUB_TERMINAL=serial manual, and grub showed on virt-viewer)

I am not sure which TERMINAL type Openstack, AWS, Google, or VMware need.

But maybe is because GRUB_TERMINAL?