diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index 3fcc5f68c..6cfa2fcff 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -87,6 +87,16 @@ if [[ -L $GRUBENV ]]; then rm -f $GRUBENV fi +# NOTE(TheJulia): Explicitly strip out embedded console settings +# in the source's grub defaults. This prevents re-introduction later. +# Intentionally matching 'console=ttyS0,115200n8 console=tty0' +# Also globally matches so it can handle 'console=tty0 stuff console=tty1' +# ... and also matches +# 'console=ttyS0,112500n81 console=ttyS1,n8 console=tty0' +if [[ -f /etc/default/grub ]]; then + sed -i 's/\> /etc/default/grub echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub diff --git a/releasenotes/notes/bootloader-strip-source-console-param-b73b603df0b01dc9.yaml b/releasenotes/notes/bootloader-strip-source-console-param-b73b603df0b01dc9.yaml new file mode 100644 index 000000000..d90be7b6e --- /dev/null +++ b/releasenotes/notes/bootloader-strip-source-console-param-b73b603df0b01dc9.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + The ``bootloader`` element now strips prior explicit console settings + from the ``/etc/default/grub`` file, in order to prevent accidential + re-introduction of prior settings when grub configuration is manually + updated later.