savedefault not default in update-grub

Bug #216178 reported by Jisakiel
36
This bug affects 3 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
Wishlist
Colin Watson

Bug Description

Binary package hint: grub2

Running hardy, updated to grub2 to test it. Savedefault equivalent in grub2, if it exists, is not present in the default update-grub configuration (/etc/default/grub I'm guessing). Would be useful, certainly.

Related branches

Daniel T Chen (crimsun)
Changed in grub2:
importance: Undecided → Wishlist
Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The current iteration of the patch to add this feature to grub2 is here:

  http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00040.html

Changed in grub2 (Ubuntu):
assignee: nobody → Colin Watson (cjwatson)
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 1.97~beta1-1ubuntu2

---------------
grub2 (1.97~beta1-1ubuntu2) karmic; urgency=low

  * debian/patches/953_no_eh_frame.diff: Build with -fno-dwarf2-cfi-asm to
    stop gcc-4.4 generating .eh_frame sections that cause core.img to be too
    big to embed in some common cases (LP: #423412).
  * debian/patches/954_normal_quiet.diff: Don't display introductory message
    about line editing unless we're actually offering a shell prompt.
  * debian/patches/955_really_quiet.diff: Remove some verbose messages
    printed before reading the configuration file. In some ways this is
    awkward because it makes debugging harder, but it's a requirement for a
    smooth-looking boot process; we may be able to do better in future (LP:
    #386922).
  * debian/patches/956_linux_quiet.diff: If the environment variable "quiet"
    is set to something other than 1, suppress progress messages as the
    kernel and initrd load. Set this for non-recovery kernel menu entries
    (LP: #386922).
  * debian/patches/957_savedefault.diff: Add GRUB_DEFAULT=saved, as well as
    grub-set-default and grub-reboot utilities. Provides functionality
    essentially equivalent to GRUB Legacy's savedefault (LP: #216178).
  * debian/rules, debian/grub-pc.install.in: Install grub-reboot and
    grub-set-default only in grub-common.
  * Add tag information to old Ubuntu patches.

 -- Colin Watson <email address hidden> Fri, 04 Sep 2009 15:02:36 +0100

Changed in grub2 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
drs305 (drs305) wrote :

Colin,

I have been playing with "GRUB_DEFAULT=saved" today following the latest grub2 update.

40_custom doesn't seem to incorporate this setting.
One thing I noticed is that in the 10_linux section the following line is imported correctly into grub.cfg:

saved_entry=${chosen}

However, when I update grub.cfg, the same line in my 40_custom file is imported as follows and the selection is not retained i.e. the "${chosen}" portion is not imported. Rather, it is imported as:

saved_entry=

If I manually edit grub.cfg (for troubleshooting only) and change the line to the same as the 10_linux entries ( saved_entry=${chosen} ), the previous grub selection is retained on rebooting.

I don't know if this is a bug or by design. Thanks.

Package: grub2
Priority: extra
Section: universe/admin
Installed-Size: 256
Maintainer: Ubuntu Core Developers <email address hidden>
Original-Maintainer: GRUB Maintainers <email address hidden>
Architecture: amd64
Version: 1.97~beta1-1ubuntu3

Revision history for this message
Colin Watson (cjwatson) wrote : Re: [Bug 216178] Re: savedefault not default in update-grub

40_custom doesn't do anything by default, of course. If you've written a
custom script there, I suggest that you use the save_default_entry
function that's now provided by grub-mkconfig_lib. See the other scripts
in /etc/grub.d/ for examples.

It sounds like you tried to do the same thing by hand and got the
quoting wrong. If you use the provided function, you'll avoid this
problem.

Revision history for this message
totzo (tim) wrote :

Cheers! I've got it working now.

For anyone who chances upon this thread, my 40_custom looks like this, I don't know if this is correct but it seems to work fine for now:

#! /bin/sh -e

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
echo "Adding My Custom Entries" >&2
cat << EOF
menuentry "Windows" {
EOF
  save_default_entry | sed -e "s/^/\t/"
  cat << EOF
 insmod ntfs
 set root=(hd1,1)
 search --no-floppy --fs-uuid --set c73e96cf907ef733
 chainloader +1
}

Revision history for this message
Daniel Albers (al) wrote :

The patch doesn't provide "savedefault fallback" functionality yet, does it?

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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