GRUB_CMDLINE_LINUX_DEFAULT contains duplicate options

Bug #1291434 reported by Joey Stanford on 2014-03-12
This bug affects 10 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
mdadm (Ubuntu)

Bug Description

2014-03-12 - Today's trusty update installed grub-pc 2.02~beta2-7 and the linux default params were duplicated

Instead of this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline nomdmonddf nomdmonisw"
It wanted to install this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline nomdmonddf nomdmonisw nomdmonddf nomdmonisw"

Anders (eddiedog988) on 2014-03-13
Changed in grub2 (Ubuntu):
status: New → Confirmed

Also note that another set up duplicates is added to the line each time the grub-pc.postinst script is run -- on one of my Trusty systems I now see:
  GRUB_CMDLINE_LINUX_DEFAULT="nomdmonddf nomdmonisw nomdmonddf nomdmonisw nomdmonddf nomdmonisw"

(I see that this value is also saved in the debconf database:
# debconf-show grub-pc | grep linux_cmdline_default
* grub2/linux_cmdline_default: nomdmonddf nomdmonisw nomdmonddf nomdmonisw nomdmonddf nomdmonisw

I tracked the source of these two keywords to /etc/default/grub.d/dmraid2mdadm.cfg (part of the mdadm package), which contains the single line:

Perhaps that script needs to be expanded to check the current value of $GRUB_CMDLINE_LINUX_DEFAULT and only add the new keywords if they aren't already included?


Hmm, one additional thing to note is that when /boot/grub/grub.cfg is generated, each "linux" line created there gets an additional copy of the keywords. That is, if I run "dpkg-reconfigured grub-pc" and strip the "Linux default command line" prompt down to just "nomdmonddf nomdmonisw" and then let it re-install grub, I'm left with /etc/default/grub containing just
  GRUB_CMDLINE_LINUX_DEFAULT="nomdmonddf nomdmonisw"
... but the "linux" lines in grub.cfg look like:
        linux /boot/vmlinuz-3.13.0-32-generic root=UUID=[...ID...] ro nomdmonddf nomdmonisw nomdmonddf nomdmonisw

That makes me think that the intent of the dmraid2mdadm.cfg file is to add the keywords to the grub.cfg lines, but not to actually change the GRUB_CMDLINE_LINUX_DEFAULT value in /etc/default/grub. Is there a proper way to do the former using a default/grub.d/ file without having the side-effect of changing the default/grub file on grub-pc package reconfiguration, too?


In case there isn't a some better solution, here's a quick attempt at a patch to the dmraid2mdadm.cfg script so that it only adds the keywords to the value of GRUB_CMDLINE_LINUX_DEFAULT if it doesn't already contain them. That would at least prevent the command line from accumulating any additional copies of the keywords during later grub-pc package upgrades.

This patch doesn't attempt to clean up already-existing extra copies of the keywords in the line in the /etc/default/grub file.

Also, it only checks for cases where the keywords are found exactly as they would have been added by this script; I don't know if those two nomdmon* options are likely enough to have been added in some other format that it's worth having this script check for them each independently instead....


The attachment "avoid adding keywords multiple times" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
tags: added: trusty
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mdadm (Ubuntu):
status: New → Confirmed

In Ubuntu 15.10 /etc/default/grub.d/dmraid2mdadm.cfg now contains the following code:

DMRAID2MDADM_TOAPPEND="nomdmonddf nomdmonisw"


that prevents the options "nomdmonddf nomdmonisw" to be added several times.

Changed in mdadm (Ubuntu):
status: Confirmed → Fix Released
Changed in grub2 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers