bugGNU GRUB - Bugs: bug #12018, grub-0.96. savedefault feature is...


You are not allowed to post comments on this tracker with your current authentication level.

bug #12018: grub-0.96. savedefault feature is not working for me.

Submitter:  Invalid User ID <#38697>
Submitted:  Fri 18 Feb 2005 06:07:42 AM UTC
Category:  None Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  Peter
Open/Closed:  Closed Release:  None
Release:  0.96 Reproducibility:  Every Time
Planned Release:  None

( Jump to the original submission )

Sat 19 Mar 2005 06:04:03 PM UTC, comment #10: 

I have fixed it right now. Thanks.

Please write ChangeLog next time. Usually I do not apply any patch if ChangeLog is not written.


Yoshinori K. Okuji <okuji>
Project Administrator
Sat 19 Mar 2005 05:15:31 PM UTC, comment #9: 


I encountered the same trouble this night, and found a bug in stage2.c.
The buffer for the "default" file path is not initialized correctly.
Attached patch will fix the bug.  Hope it helps.

NATORI Shin <natori>
Fri 18 Mar 2005 04:25:48 PM UTC, comment #8: 


Thank you. I've tried latest cvs grub with your patch. Applied cleanly, compiled but savedefault not working. May be error messages helps you to find an error.

If I setup grub with `grub-install --root-directory=/boot --no-floppy  /dev/hda` then I have the error:
savedefault 2

Default file name: '!fPSR2##/boot/grub/default' will be open from (hd127,0,a): Filesystem type is ext2fs, partition type 0x83.

-- press a key


Instead of ! and ## there are some unreadable symbols.

If I setup with `grub-install --no-floppy  /dev/hda` then error is the same except boot/grub/default -> grub/default ; without boot.

Thank you for your work,

Thu 17 Mar 2005 09:55:40 PM UTC, comment #7: 

Sorry, I have forgotten one file... here is another test patch. Be sure to have the last cvs version (2005/03/15 16:54:24).

Thu 17 Mar 2005 09:41:09 AM UTC, comment #6: 

Seems that patch is not working.
After applying (look ChangeLog is rejected:) but I'll fix  this manually):
peter@camobap ~/grub-0.96/grub-0.96 $ patch -p1 < ../savedefault.patch
patching file ChangeLog
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file ChangeLog.rej
patching file stage2/builtins.c
Hunk #1 succeeded at 3070 (offset -9 lines).
Hunk #2 succeeded at 3103 (offset -9 lines).
Hunk #3 succeeded at 3312 (offset -9 lines).
patching file stage2/shared.h
patching file stage2/stage2.c

I encounter this linking problem:
pre_stage2_exec-builtins.o(.text+0x26e3):/home/peter/grub-0.96/grub-0.96/stage2/builtins.c:3316: undefined reference to `savedefault_partition'
pre_stage2_exec-stage2.o(.text+0xccb): In function `cmain':
/home/peter/grub-0.96/grub-0.96/stage2/stage2.c:891: undefined reference to `savedefault_drive'
pre_stage2_exec-stage2.o(.text+0xcd5):/home/peter/grub-0.96/grub-0.96/stage2/stage2.c:892: undefined reference to `savedefault_partition'
collect2: ld returned 1 exit status
make[2]: *** [pre_stage2.exec] &#1054;&#1096;&#1080;&#1073;&#1082;&#1072; 1
make[2]: Leaving directory `/home/peter/grub-0.96/grub-0.96/stage2'
make[1]: *** [all-recursive] &#1054;&#1096;&#1080;&#1073;&#1082;&#1072; 1
make[1]: Leaving directory `/home/peter/grub-0.96/grub-0.96'
make: *** [all] &#1054;&#1096;&#1080;&#1073;&#1082;&#1072; 2

Thank you, for your work,

Wed 16 Mar 2005 10:07:23 PM UTC, comment #5: 

I think the bug is in stage2/builtins.c lines 3292 and 3293. The aim of these 2 lines is to get the drive and the partition of the /boot/grub/default file. The bug is that it takes the device and the partition from your "root (hd0,1)" command. It is correct most of the time, but when /boot is on another partition than /, it doesn't work.

The attached patch should fix the bug. I let my debug traces (printf) in this patch, so this patch must NOT be commited. I want to be sure that I'm correct and that it works on your computer before doing a better patch. Take it as a draft.

As usual, backup your data before test this patch ;)

Wed 16 Mar 2005 05:40:14 AM UTC, comment #4: 

> I don't understand why this problem occurs.
> Can you try "grub-set-default n" and checks if the value in
> /boot/grub/default is changed consequently?

Yes. I've checked this. My save-default file is the same as yours.

Also I can from grub shell cat (hd0,1)/grub/default and menu.lst.

I've even checked that this is not our distribution patching problem. I've installed grub from sources, but the problem still occurs.

I'd like to repeat my config:
timeout 30
default saved

title  GNU/Linux
root (hd0,1)
kernel /vmlinuz root=/dev/hda6 lapic=on
savedefault 0

title Windows XP SP2
rootnoverify (hd0,0)
chainloader  +1

and camobap grub-0.96 # cat /boot/grub/default
# WARNING: If you want to edit this file directly, do not remove any line
# from this file, including this warning. Using `grub-set-default\' is
# strongly recommended.

Well. I can try to reproduce this problem in vmware virtual computer and to put it somewhere for downloading. Can this help? Does anybody interested in this?

Any way. Thank you all, for your help,

Tue 15 Mar 2005 11:06:31 PM UTC, comment #3: 

I don't understand why this problem occurs.

Can you try "grub-set-default n" and checks if the value in /boot/grub/default is changed consequently? Here is my default file when I do "grub-set-default 1":
# WARNING: If you want to edit this file directly, do not remove any line
# from this file, including this warning. Using `grub-set-default\' is
# strongly recommended.

Can you do from the grub shell do a
"cat (hd0,1)/grub/default" in order to see if grub can read the file? Can you cat menu.lst?

AFAIK the default file must be in the same file system and same directory than your menu.lst file. But it seems to be your case.

Mon 07 Mar 2005 12:12:45 PM UTC, comment #2: 

The "default saved" command works only if a file named "default" exists and has the correct format. I had to guess its format, since I do not have an installed Linux on the system. If there is an instaled Linux, you can create that file with the command "grub-set-default" on the command line.

BTW: It would be nice to have some info about the file.

Sun 06 Mar 2005 11:12:37 AM UTC, comment #1: 

I can confirm "savedefault" does not work for me with 0.96 -- I get the message "Error 15: File not found." unless I remove the "savedefault" command from my grub.conf/menu.lst.

Wolfram Schlich <wschlich>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #2751:  grub-0.96-savedefault-bugfix.patch added by natori (372B - text/plain - Patch for fixing the bug)
file #2745:  savedefault-v2.patch added by None (4KiB - text/x-patch - Patch which should fix the bug (2))
file #2739:  savedefault.patch added by None (4KiB - text/x-patch - Patch wich should fix the bug)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by robertmh (Updated the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-15 robertmh Open/ClosedOpen Closed
    2005-03-19 natori Attached File- Added grub-0.96-savedefault-bugfix.patch, #2328
    2005-03-17 None Attached File- Added savedefault-v2.patch, #2322
    2005-03-16 None Attached File- Added savedefault.patch, #2316
    2005-03-06 wschlich Carbon-Copy- Added wschlich

    Back to the top

    Powered by Savane 3.9