Ubuntu

[patch] update-grub: savedefault can cause problems

Reported by Carthik Sharma on 2006-10-15
28
Affects Status Importance Assigned to Milestone
grub (Debian)
New
Unknown
grub (Ubuntu)
Undecided
Unassigned

Bug Description

This bug was originally reported using reportbug. Filing by proxy.
The original bug report follows:
From: Peter Cordes <email address hidden>
To: Ubuntu Bug Tracking System <email address hidden>, <email address hidden>
Subject: update-grub: savedefault can cause problems
Date: Sat, 14 Oct 2006 18:08:03 -0300
User-Agent: Mutt/1.5.9i
X-Mailer: reportbug 3.18ubuntu1

Package: grub
Version: 0.97-1ubuntu9
Severity: normal

 (CC'ing Debian BTS, because I would have had the same problem with Sarge
instead of Dapper. Ubuntu's reportbug doesn't handle this very well...)

 I have a system using dmraid and booting grub from the Windows boot loader.
Using savedefault prevents grub from booting Linux. Selecting the menu
entry for the Ubuntu kernel, the "kernel" and "initrd" lines show, but then
I see:
....
savedefault

Error 15: File not found

 and I have to press return to go back to the main grub menu. If I hit 'e'
and take out the savedefault, it boots normally.

 The menu.lst entry wass generated by update-grub:
title Ubuntu, kernel 2.6.15-27-k7
root (hd0,6)
kernel /boot/vmlinuz-2.6.15-27-k7 root=/dev/mapper/via_hibggiii7 ro quiet splash
initrd /boot/initrd.img-2.6.15-27-k7
savedefault
boot

 As I said, this machine doesn't boot grub the normal way. The machine is
an Athlon XP on an Asus A7V600, with 2 160GB SATA hard drives using
BIOS-driven RAID1. It runs win2k, but I left 5GB at the end of the drives
to play around with; hence Ubuntu. I installed mostly using
http://www.ubuntu-in.org/wiki/SATA_RAID_Howto. (which, incidentally, is a
real pain compared to setting up /target and using the normal ubiquity
installer...)

 I put GRUB on the boot sector of my ext3 partition, not the MBR, using
grub
device (hd0) /dev/mapper/via_hibggiii
root (hd0,6)
setup (hd0,6)

 And then, instead of somehow chainloading that partition, I did
dd if=/dev/mapper/via_hibggiii of=grub.img bs=512 count=1
and after booting into win2k I copied that file to c:\grub.img, and told the
windows bootloader about it with boot.ini:
....
c:\grub.img="GRUB"

 So I don't know where grub could save defaults to, and I'm not shocked that
savedefault doesn't work. I've always been suspicious about by default
writing to the hard drive while booting, but this is the first time
savedefault has ever actually caused a problem. My opinion is that it's not
such a great default. The standard grub menu.lst doesn't use the saved
default anyway. I would suggest making savedefault another
automagic-comment configurable item, defaulting to off.

 Thanks,
Peter Cordes

-- System Information:
Debian Release: testing/unstable
  APT prefers dapper-security
  APT policy: (500, 'dapper-security'), (500, 'dapper')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-27-k7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages grub depends on:
ii libc6 2.3.6-0ubuntu20 GNU C Library: Shared libraries an
ii libncurses5 5.5-1ubuntu3 Shared libraries for terminal hand

grub recommends no packages.

-- no debconf information

Related branches

On Sun, Oct 15, 2006 at 12:02:14PM +0200, Robert Millan wrote:
>
> Btw, your Mail-followup-to header screwed my reply. Please don't use that
> header when submitting bugs to BTS.

 Sorry; I used Ubuntu's reportbug and then changed some headers without
realizing all the headers it sets. Hopefully I'm not causing more problems
by CC'ing Ubuntu's BTS on this. :>

 Also sorry for the delay; enough computer problems at work that I didn't
want to look at this one again :(

> On Sun, Oct 15, 2006 at 12:00:39PM +0200, Robert Millan wrote:
> > On Sat, Oct 14, 2006 at 06:08:03PM -0300, Peter Cordes wrote:
> > >
> > > So I don't know where grub could save defaults to, and I'm not shocked that
> > > savedefault doesn't work. I've always been suspicious about by default
> > > writing to the hard drive while booting, but this is the first time
> > > savedefault has ever actually caused a problem. My opinion is that it's not
> > > such a great default. The standard grub menu.lst doesn't use the saved
> > > default anyway. I would suggest making savedefault another
> > > automagic-comment configurable item, defaulting to off.
> >
> > Yes indeed, savedefault is implemented by writing into MBR. Unfortunately, we
> > had to diverge from upstream on this, and it resulted into a handful of problems
> > I'd rather not get into. Given that it's not enabled by default, though, I
> > think it's safe to do another release with it.

 It actually is enabled by default. It's the savedefault in every entry
that's the problem, not when reading it by specifying "default saved".
update-grub always writes savedefault in every entry (except the "alternate"
ones), right?

 Maybe update-grub could have an option for including savedefault or not, or
it could include it only if it sees a "default saved" or "fallback saved"?
That sounds likely to confuse anyone who actually wanted to figure out what
was going on, but might "just work" for more people.

 The error message I included was for Ubuntu's default boot menu, which has
no noticeable difference from Debian's. (no surprise there...)

> > For etch+1 this will all be taken over by GRUB 2.

 Happy hacking :)

--
#define X(x,y) x##y
Peter Cordes ; e-mail: X(peter@cor , des.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BC

Changed in grub:
status: Unconfirmed → Confirmed

This has to get fixed in Ubuntu, since Debian and upstream are no longer accepting changes for grub (1), but focus on grub2. I suppose Feisty will ship with grub 1.

The attached patch only fixes the missing configurability of the "savedefault" option. This patch will not change the default action - the menu.lst will be exactly like it is today.

Tormod Volden (tormodvolden) wrote :

This patch sets the default of "savedefault to "false". This is the only sane default setting, since if the user wants to use the savedefault feature, he has to edit the menu.lst manually anyway.

Tormod Volden (tormodvolden) wrote :

The warning in menu.lst about desyncing mirrors is wrongly formulated. It is not the "saved" value of "default" that will do any harm, but "savedefault" trying to write to the MBR of the raid.

This patch corrects the wording.

Tormod Volden (tormodvolden) wrote :

This patch is just a clean-up and has nothing to do with this bug. The set_default_value function appears twice (duplicated) in the script.

Tormod Volden (tormodvolden) wrote :

Test packages (source and i386) with these 4 patches can be downloaded here: http://tormod.webhop.org/linux/grub

Changed in grub:
status: Unknown → Unconfirmed
Andreas Jellinghaus (tolonuga) wrote :

thanks, I tested grub with these patches and it works fine.
Please add them for feisty, maybe even backport the fixes for dapper and edgy?
(At least I will most likely role out patched packages locally to all machines
and users I support, since we run into the problem everytime update-grub is run.)

Tormod Volden (tormodvolden) wrote :

Updated patch for feisty (grub 0.97-19ubuntu2).

Daniel Hahler (blueyed) wrote :

Here's another example of "savedefault" causing problems:
https://bugs.launchpad.net/grub/+bug/64928 (grub cannot replay ReiserFS journal and causes "GRUB Error 16: Inconsistent filesystem structure")

Brian Visel (eode) wrote :

Please fix this before feisty release!! It will cause anyone who tries to hibernate, or who experiences a crash to run into the message "GRUB Error 16: Inconsistent filesystem structure" at boot time.

Changed in grub:
assignee: nobody → ubuntu-bugs
Brian Visel (eode) wrote :

..that is, anyone with reiserfs.

ward (ward-pong) wrote :

The 'savedefault' option also causes problems if you are booting from compactflash; it causes the dreaded 'Error 15: File not found' error.

Can you *please* get rid of it/make it configurable?

Thanks,
Ward.

Daniel Hahler (blueyed) on 2007-06-10
Changed in grub:
assignee: ubuntu-bugs → blueyed
Daniel Hahler (blueyed) wrote :

I've taken all the 3 patches provided by Tormod and created a debdiff for Gutsy.
See https://wiki.ubuntu.com/UbuntuPackagingGuide/BuildFromDebdiff for applying it.

I will also provide a debdiff for Feisty in some minutes.

Daniel Hahler (blueyed) wrote :

Here is the debdiff for feisty-proposed: it only contains the critical patch (adding the option) and not the other two cosmetical ones.

Whurred! Thank you so much! :-)

> I've taken all the 3 patches provided by Tormod and created a debdiff for Gutsy.
> See https://wiki.ubuntu.com/UbuntuPackagingGuide/BuildFromDebdiff for applying it.
>
> I will also provide a debdiff for Feisty in some minutes.

Tormod Volden (tormodvolden) wrote :

I merged the newer version 0.97-28 from Debian, and added these patches as well (bug #119675). Let's hope it gets uploaded to Gutsy soon. Or that we will switch to grub2 soon!

Daniel Hahler (blueyed) on 2007-06-10
Changed in grub:
assignee: blueyed → nobody
Colin Watson (cjwatson) wrote :

grub (0.97-29ubuntu1) gutsy; urgency=low

  * Merge from Debian unstable. Remaining Ubuntu changes:
    - debian/control: build-depends on libc6-dev and gcc-3.4
    - debian/control: depends on volumeid, provides linux-boot-loader
    - debian/rules: use gcc-3.4
    - debian/patches/grub-install_storeversion.diff
    - debian/patches/quiet.diff
    - debian/patches/gpt.diff
    - debian/patches/grub-0.95-mem_lower.patch
    - debian/update-grub: assorted Ubuntu tweaks
      - use printf instead of echo -e
      - split up warning about missing /boot/grub
      - is_removable device handling
      - crashdump handling
      - get default root device from /etc/fstab
      - rename title to "Ubuntu"
      - quiet and splash default defoptions
      - rename "single-user" to "recovery"
      - timeout/hiddenmenu/colours defaults
      - robust oldversion handling
      - don't treat memtest as a kernel
      - convert_kopt_to_uuid
      - kopt_2_6 handling
      - remove freebsd support
    - configure.ac: -fno-strict-aliasing
    - debian/grub.postinst: run update-grub on upgrade from dapper
  * debian/patches/quiet.diff: Fix "help quiet" segfault (LP: #60163)
  * debian/update-grub: New "savedefault" automagic option (default: false)
    for adding the savedefault command to menu entries (LP: #66278)

 -- Tormod Volden <email address hidden> Fri, 29 Jun 2007 16:38:06 +0200

Changed in grub:
status: Confirmed → Fix Released
Martin Schaaf (mascha) wrote :

I have grub version 0.97-29ubuntu4 installed and still get the error message on booting with grub and resiserfs "16 : Inconsistent filesystem structure".

Tormod Volden (tormodvolden) wrote :

Martin, this bug report is closed. Please attach your menu.lst to bug #64928.

Changed in grub:
status: New → Fix Released
Changed in grub:
status: Fix Released → New
Changed in grub:
status: New → Fix Released
Changed in grub:
status: Fix Released → New
To post a comment you must log in.
This report contains Public information  Edit
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.