From 4fbf5646157be3c14286a97272ddb8f809303e94 Mon Sep 17 00:00:00 2001 From: Maksim Malchuk Date: Fri, 15 Sep 2023 18:11:15 +0300 Subject: [PATCH] Set grub timeout style Set the grub timeout style to display the menu. By default it set to 'hidden' but can be changed to 'menu' to display the menu and then wait for the timeout expire before booting the default entry. Change-Id: I8c58407ef645d528dd77efe866bfe0389cbbbd33 Signed-off-by: Maksim Malchuk --- diskimage_builder/elements/bootloader/README.rst | 5 +++++ .../elements/bootloader/finalise.d/50-bootloader | 1 + .../notes/grub-timeout-style-4bb9b2bde4ff2b02.yaml | 7 +++++++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/grub-timeout-style-4bb9b2bde4ff2b02.yaml diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index 306410de3..a5b343679 100644 --- a/diskimage_builder/elements/bootloader/README.rst +++ b/diskimage_builder/elements/bootloader/README.rst @@ -10,6 +10,11 @@ Arguments * ``DIB_GRUB_TIMEOUT`` sets the ``grub`` menu timeout. It defaults to 5 seconds. Set this to 0 (no timeout) for fast boot times. +* ``DIB_GRUB_TIMEOUT_STYLE`` sets the visibility of the ``grub`` menu. + It defaults to ``hidden`` (or ``countdown`` as an alias). Set this to + ``menu`` to display the menu and then wait for the timeout set by + ``DIB_GRUB_TIMEOUT`` to expire before booting the default entry. + * ``DIB_BOOTLOADER_DEFAULT_CMDLINE`` sets parameters that are appended to the ``GRUB_CMDLINE_LINUX_DEFAULT`` values in ``grub.cfg`` configuration. It defaults to ``nofb nomodeset gfxpayload=text``. diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index d4bad0e5d..21d84f2a5 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -85,6 +85,7 @@ fi echo "GRUB_DEVICE=LABEL=${DIB_ROOT_LABEL}" >> /etc/default/grub echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub +echo "GRUB_TIMEOUT_STYLE=${DIB_GRUB_TIMEOUT_STYLE:-hidden}" >>/etc/default/grub echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub echo 'GRUB_GFXPAYLOAD_LINUX=auto' >>/etc/default/grub diff --git a/releasenotes/notes/grub-timeout-style-4bb9b2bde4ff2b02.yaml b/releasenotes/notes/grub-timeout-style-4bb9b2bde4ff2b02.yaml new file mode 100644 index 000000000..81f319219 --- /dev/null +++ b/releasenotes/notes/grub-timeout-style-4bb9b2bde4ff2b02.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + The ``bootloader`` element will explicitly set the timeout style to + ``hidden`` to hide the menu. Set ``DIB_GRUB_TIMEOUT_STYLE`` to ``menu`` + to display the menu and then wait for the timeout expire before booting + the default entry.