Allow /etc/default/grub overriding via /etc/default/grub.d/

Bug #901600 reported by Dave Walker
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
High
Colin Watson
Precise
Fix Released
High
Colin Watson
Quantal
Fix Released
High
Colin Watson

Bug Description

[Impact] Various customised images have upgrade problems because they don't have a way to add grub-mkconfig configuration without editing /etc/default/grub directly.
[Test Case] Check that setting something in /etc/default/grub.d/new-file.cfg affects grub-mkconfig, e.g. by setting GRUB_CMDLINE_LINUX and checking that update-grub causes it to be passed through to /boot/grub/grub.cfg.
[Regression Potential] I think the main thing is to make sure that nothing goes wrong when /etc/default/grub.d/ is missing.

Original report follows:

It would be good to be able to keep the settings in /etc/default/grub pristine, and allow overides via /etc/grub.d/.

The one of most interest is:
GRUB_DEFAULT=0 -> GRUB_DEFAULT=saved

Thanks.

Related bugs:
 * bug 1179940: cloud-images build process should not modify /etc/default/grub

Changed in grub2 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Steve Langasek (vorlon) wrote :

This is related to bug #759545 and bug #1009294. 759545 is about a spurious prompt when /etc/default/grub is unmodified; that bug is probably fixed now and should be closed. Bug #1009294 is about a spurious prompt on cloud images because ucf's cache doesn't reflect the debconf settings used for /etc/default/grub within the image.

Because of this bug, however, the cloud images will continue to carry a delta to /etc/default/grub relative to what's in the grub2 package, and therefore any time there *is* a change to the template, users will continue to get a ucf prompt.

So a solution needs to be found that lets the cloud images override settings without triggering ucf pain.

Changed in grub2 (Ubuntu):
importance: Medium → High
assignee: nobody → Adam Conrad (adconrad)
Changed in grub2 (Ubuntu Precise):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Colin Watson (cjwatson) wrote :

I'm working on this now. I think it should be /etc/default/grub.d/ rather than /etc/grub.d/, though, as /etc/grub.d/ already has quite specific and different semantics. Directories in /etc/default/ are unusual, but not unprecedented; there are already packages in the archive shipping files in /etc/default/kdm.d/ and /etc/default/lire.d/.

Changed in grub2 (Ubuntu Quantal):
assignee: Adam Conrad (adconrad) → Colin Watson (cjwatson)
status: Triaged → In Progress
Colin Watson (cjwatson)
summary: - Allow /etc/default/grub overriding via /etc/grub.d/
+ Allow /etc/default/grub overriding via /etc/default/grub.d/
Colin Watson (cjwatson)
Changed in grub2 (Ubuntu Quantal):
status: In Progress → Fix Committed
Colin Watson (cjwatson)
Changed in grub2 (Ubuntu Precise):
milestone: none → ubuntu-12.04.2
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.5 KiB)

This bug was fixed in the package grub2 - 2.00-7ubuntu1

---------------
grub2 (2.00-7ubuntu1) quantal; urgency=low

  * Resynchronise with Debian. Remaining changes:
    - Adjust for default Ubuntu boot options ("quiet splash").
    - Default to hiding the menu; holding down Shift at boot will show it.
    - Set a monochromatic theme and an appropriate background for Ubuntu.
    - Apply Ubuntu GRUB Legacy changes to legacy update-grub script.
    - Fix backslash-escaping in merge_debconf_into_conf.
    - Remove "GNU/Linux" from default distributor string.
    - Add crashkernel option.
    - Bypass menu unless other OSes are installed or Shift is pressed.
    - Allow Shift to interrupt 'sleep --interruptible'.
    - Reduce visual clutter in normal mode.
    - Remove verbose messages printed before reading configuration.
    - Suppress kernel/initrd progress messages, except in recovery mode.
    - Show the boot menu if the previous boot failed.
    - Adjust upgrade version checks for Ubuntu.
    - Suppress "GRUB loading" message unless Shift is held down.
    - Adjust versions of grub-doc and grub-legacy-doc conflicts.
    - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
    - Check hardware support before using gfxpayload=keep.
    - Set vt.handoff=7 for smooth handoff to kernel graphical mode.
    - In recovery mode, add nomodeset to the Linux kernel arguments, and
      remove the 'set gfxpayload=keep' command.
    - Skip Windows os-prober entries on Wubi systems, and suppress the menu
      by default if those are the only other-OS entries.
    - Handle probing striped DM-RAID devices.
    - Replace 'single' by 'recovery' when friendly-recovery is installed.
    - Disable cursor as early as possible in grub_main.
    - Apply patch from Fedora to forbid insmod on UEFI secure boot.
    - Apply patch from Fedora to add a "linuxefi" loader.
    - On amd64, add a raw-uefi custom upload tarball for signing.
  * Fix hwmatch to not override more informative errors from grub_file_open
    with "file not found".
  * Read /etc/default/grub.d/*.cfg after /etc/default/grub (LP: #901600).

grub2 (2.00-7) experimental; urgency=low

  * Backport from upstream:
    - Fix stderr leakage from grub-probe in is_path_readable_by_grub.
    - Fix tftp endianness problem.
  * Merge from Ubuntu:
    - Prefer translations from language packs (LP: #537998). (No-op for
      Debian, but harmless.)
    - Avoid getting confused by inaccessible loop device backing paths
      (LP: #938724).

grub2 (2.00-6) experimental; urgency=low

  [ Colin Watson ]
  * Adjust package descriptions to talk about update-grub, not update-grub2.
  * Backport from upstream:
    - Fix grub-emu build on FreeBSD.
  * Revert gcc-4.6-multilib build-dependency change from 2.00-1, since
    kfreebsd-i386 and hurd-i386 don't have gcc-4.6-multilib. Instead, make
    sure to only install efiemu32.o and efiemu64.o on (linux-)i386,
    kopensolaris-i386, and any-amd64.
  * Manually expand @PACKAGE@ symbols in grub-efi.postinst (closes:
    #688725), grub-linuxbios.postinst (closes: #688726), and grub2.postinst
    (closes: #688724).

  [ Debconf translations ]
  * Lithuanian (R...

Read more...

Changed in grub2 (Ubuntu Quantal):
status: Fix Committed → Fix Released
Colin Watson (cjwatson)
Changed in grub2 (Ubuntu Precise):
status: Triaged → In Progress
Colin Watson (cjwatson)
description: updated
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Hello Dave, or anyone else affected,

Accepted grub2 into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/grub2/1.99-21ubuntu3.8 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in grub2 (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote :

This seems to be doing the right thing (1.99-21ubuntu3.9).

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 1.99-21ubuntu3.9

---------------
grub2 (1.99-21ubuntu3.9) precise; urgency=low

  * Also skip update-grub when running in a container (LP: #1060404).
 -- Colin Watson <email address hidden> Tue, 22 Jan 2013 14:43:32 +0000

Changed in grub2 (Ubuntu Precise):
status: Fix Committed → Fix Released
Scott Moser (smoser)
description: updated
Colin Watson (cjwatson)
description: updated
Revision history for this message
LenWeisberg (len-weisberg) wrote :

This feature looks very useful, but I have not found a shred of
documentation for it. The one aspect I can think of that is
not completely obvious is the order that the grub default files are read.

I did find from reading /usr/sbin/grub-mkconfig
that all of the /etc/default/grub.d files are read in order,
      AFTER the /etc/default/grub file.

I hope that this point is noted when this feature does appear in
the Grub2 docs.

Revision history for this message
LenWeisberg (len-weisberg) wrote :

Correction to my comment #7:
   Only files in /etc/default/grub.d that end in '.cfg' are read.
All the more reason documentation is needed.

Revision history for this message
François Leurent (131-ubuntu) wrote :

Same as LenWeisberg, i had to read the source code to find this out (and this save my day, please send it upstream !)

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.