GRUB_CMDLINE_LINUX_DEFAULT contains duplicate options

Bug #1291434 reported by Joey Stanford
56
This bug affects 10 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Invalid
Undecided
Unassigned
mdadm (Ubuntu)
Fix Released
Undecided
Unassigned

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"

Tags: patch trusty
Anders (eddiedog988)
Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

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:
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT nomdmonddf nomdmonisw"

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?

Nathan

Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

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?

Nathan

Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

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

Nathan

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

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
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in mdadm (Ubuntu):
status: New → Confirmed
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

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

DMRAID2MDADM_TOAPPEND="nomdmonddf nomdmonisw"

case "$GRUB_CMDLINE_LINUX_DEFAULT" in
    *$DMRAID2MDADM_TOAPPEND*)
        ;;
    *)
        GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT $DMRAID2MDADM_TOAPPEND"
        ;;
esac

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
Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

(The change described in comment #6 was applied as a fix for LP: #1465567)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.