From f6a2452d4c72d52af1abd6f9d4165ff19a0506ba Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 12 Sep 2018 17:07:19 +1000 Subject: [PATCH] Only append DIB_BOOTLOADER_DEFAULT_CMDLINE to default grub entry The grub.cfg has two variables [1] GRUB_CMDLINE_LINUX : used on all boots GRUB_CMDLINE_LINUX_DEFAULT : additionally used on all "normal" boots The problem with I2298675dda1f699c572b3423e7274bc8bd7c1c9d is that it appened the values in DIB_BOOTLOADER_DEFAULT_CMDLINE to both of these, resulting in duplicated arguments. I don't think we considered that GRUB_CMDLINE_LINUX_DEFAULT actually already appends to the GRUB_CMDLINE_LINUX values. Make DIB_BOOTLOADER_DEFAULT_CMDLINE only append itself to GRUB_CMDLINE_LINUX_DEFAULT. That seems to line up sensibly with the name of the variable. Documentation is enhanced around this, and a releasenote added. [1] https://help.ubuntu.com/community/Grub2/Setup Change-Id: I76b5442a9090c19a6540ed2d4ab324546f241ebf Closes: #1791736 --- diskimage_builder/elements/bootloader/README.rst | 6 +++--- .../elements/bootloader/finalise.d/50-bootloader | 3 +-- .../notes/bootloader-commandline-d2db7524f1f9ad28.yaml | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index ce2147bca..56e170768 100644 --- a/diskimage_builder/elements/bootloader/README.rst +++ b/diskimage_builder/elements/bootloader/README.rst @@ -13,6 +13,6 @@ 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_BOOTLOADER_DEFAULT_CMDLINE`` sets the CMDLINE parameters that - are appended to the grub.cfg configuration. It defaults to - 'nofb nomodeset vga=normal' +* ``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 vga=normal``. diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 0a6b0db6b..75dfd78c3 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -185,9 +185,8 @@ function install_grub2 { GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=${SERIAL_CONSOLE} no_timer_check" - echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT}\"" >>/etc/default/grub + echo "GRUB_CMDLINE_LINUX_DEFAULT=\"${GRUB_CMDLINE_LINUX_DEFAULT} ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"" >>/etc/default/grub echo 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"' >>/etc/default/grub - sed -i -e "s/\(^GRUB_CMDLINE_LINUX.*\)\"$/\1 ${DIB_BOOTLOADER_DEFAULT_CMDLINE}\"/" /etc/default/grub if type grub2-mkconfig >/dev/null; then GRUB_MKCONFIG="grub2-mkconfig -o $GRUB_CFG" diff --git a/releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml b/releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml new file mode 100644 index 000000000..643d22b9a --- /dev/null +++ b/releasenotes/notes/bootloader-commandline-d2db7524f1f9ad28.yaml @@ -0,0 +1,7 @@ +--- +other: + - It has been clarified that the ``DIB_BOOTLOADER_DEFAULT_CMDLINE`` + variable appends its values to grubs + ``GRUB_CMDLINE_LINUX_DEFAULT``, which is used during all normal + boots but not rescue boots; as opposed to applying to + ``GRUB_CMDLINE_LINUX``