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
This commit is contained in:
Ian Wienand 2018-09-12 17:07:19 +10:00
parent b29aee3383
commit f6a2452d4c
3 changed files with 11 additions and 5 deletions

View File

@ -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``.

View File

@ -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"

View File

@ -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``