Update-grub does not add savedefault anymore

Bug #131858 reported by Bart Samwel
4
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: grub

Update-grub used to add savedefault to ubuntu entries. Recently it stopped doing this. Apparently a setting was added to /boot/grub/menu.lst, but this setting was apparently initialized to the inverse of the old behaviour. This should be set to the old behaviour!

Related branches

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Well, the new setting is more logical, since adding "savedefault" only makes sense if the user has specified "default saved" in menu.lst, in which case the user is already sophisticated and can turn on the savedefault option as well.

The old setting would leave many set-ups broken (see bug references in the changelog). There could be a possibility to have update-grub (or .postinst?) check for "saved" and then guess that the user wants to enable savedefault, but I am not sure if it's worth the added complexity.

Revision history for this message
Bart Samwel (bart-samwel) wrote : Re: [Bug 131858] Re: Update-grub does not add savedefault anymore

Tormod Volden wrote:
> Well, the new setting is more logical, since adding "savedefault" only
> makes sense if the user has specified "default saved" in menu.lst, in
> which case the user is already sophisticated and can turn on the
> savedefault option as well.

Ahhh, I get it.

> The old setting would leave many set-ups broken (see bug references in
> the changelog). There could be a possibility to have update-grub (or
> .postinst?) check for "saved" and then guess that the user wants to
> enable savedefault, but I am not sure if it's worth the added
> complexity.

One reason to actually do so is that the current situation breaks
existing valid configurations. The fact that they are user-modified
configurations might make it somewhat less of a problem, but I think
that this is a very common setting to change for people who dual-boot,
so perhaps it's worth doing anyway.

Cheers,
Bart

Revision history for this message
Tormod Volden (tormodvolden) wrote :

(Every time I look inside the Frankenstein of all scripts that is update-grub, I hope it will be the last.)

I made a quick patch, which will set the savedefault to true if the user have "default saved" and not yet has any #savedefault= setting in his menu.lst. This will work on upgrades from Feisty, but not for those who have used the current Gutsy version and thus have a #savedefault setting already.

Can you test it (taking away your current #savedefault line first)? I will it test it myself later, and can then prepare a debdiff.

Revision history for this message
Bart Samwel (bart-samwel) wrote :

Tormod Volden wrote:
> (Every time I look inside the Frankenstein of all scripts that is
> update-grub, I hope it will be the last.)

I know what you mean. :-)

> I made a quick patch, which will set the savedefault to true if the user
> have "default saved" and not yet has any #savedefault= setting in his
> menu.lst. This will work on upgrades from Feisty, but not for those who
> have used the current Gutsy version and thus have a #savedefault setting
> already.

Well, those people will have fixed it already anyway if they cared. But
it's a nice feature that upgrades from Feisty won't break anything.

> Can you test it (taking away your current #savedefault line first)? I
> will it test it myself later, and can then prepare a debdiff.

OK, I'll test it tonight. Thanks!

Cheers,
Bart

Revision history for this message
Bart Samwel (bart-samwel) wrote :

Tormod Volden wrote:
> (Every time I look inside the Frankenstein of all scripts that is
> update-grub, I hope it will be the last.)

Yeah. I'll kick Wichert for you next time I see him. :-)

> I made a quick patch, which will set the savedefault to true if the user
> have "default saved" and not yet has any #savedefault= setting in his
> menu.lst. This will work on upgrades from Feisty, but not for those who
> have used the current Gutsy version and thus have a #savedefault setting
> already.
>
> Can you test it (taking away your current #savedefault line first)? I
> will it test it myself later, and can then prepare a debdiff.

I tested it. I removed the #savedefault=true line from my menu.lst and
ran the patched update-grub. Afterwards I had savedefault everywhere,
and I also had my #savedefault=true line back. The first thing is
correct, is that last thing expected?

Cheers,
Bart

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Yes, that's how I intended it to be: Everybody should have a #savedefault= line, and it should default to "false", except if the user already uses "default saved" at the time this new option is introduced. If there's already a #savedefault= line, it won't be touched.

You will only get savedefault everywhere if you have #savedefault=true. Don't you think this is the expected (and best) behaviour?

We can not add savedefault boot flags just on the basis of the user having "default saved" because the "default" line can be changed back and forth (and should be immediately honoured at boot) without update-grub being run to update the kernel entries. So we need the "#savedefault=" option, that adds (or removes) the "savedefault" boot flags to the kernel entries regardless of what "default" is set to.

Only for the convenience of an upgrade, the "default" option will be looked at in order to guess the best default setting for the new "#savedefault" option. Maybe it would have been cleaner to put this logic into an install script like grub.postinst, but having it in update-grub makes sure this is done if the user copies an old menu.lst from somewhere else for instance.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

I realize I was ambiguous in comment 3, I was talking about #savedefault= options, and not "savedefault" boot flags in the kernel entries. It should read:

I made a quick patch, which will set the #savedefault= option to "true" if the user has "default saved" and not yet has any #savedefault= setting in his menu.lst.

Revision history for this message
Bart Samwel (bart-samwel) wrote :

Tormod Volden wrote:
> Yes, that's how I intended it to be: Everybody should have a
> #savedefault= line, and it should default to "false", except if the user
> already uses "default saved" at the time this new option is introduced.
> If there's already a #savedefault= line, it won't be touched.
>
> You will only get savedefault everywhere if you have #savedefault=true.
> Don't you think this is the expected (and best) behaviour?
>
> We can not add savedefault boot flags just on the basis of the user
> having "default saved" because the "default" line can be changed back
> and forth (and should be immediately honoured at boot) without update-
> grub being run to update the kernel entries. So we need the
> "#savedefault=" option, that adds (or removes) the "savedefault" boot
> flags to the kernel entries regardless of what "default" is set to.
>
> Only for the convenience of an upgrade, the "default" option will be
> looked at in order to guess the best default setting for the new
> "#savedefault" option. Maybe it would have been cleaner to put this
> logic into an install script like grub.postinst, but having it in
> update-grub makes sure this is done if the user copies an old menu.lst
> from somewhere else for instance.

ACK, I think it's definitely the best way to handle this. This way
upgrades through any path will work fine. Thanks for the effort!

Cheers,
Bart

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Here is one debdiff for both this bug and bug #83690.

  * debian/update-grub: replace Ubuntu with lsb_release if possible
    (LP: #83690, #19040)
  * debian/update-grub: on upgrades, set the new savedefault option
    to "true" if the user was using "default saved" (LP: 131858)

Revision history for this message
Tormod Volden (tormodvolden) wrote :

Here is a debdiff for only this bug, in case the fix for bug #83690 is not accepted.

It is most important that the bug fix here comes into Gutsy, since it fixes a potential issue when upgrading from Feisty.

Revision history for this message
Tormod Volden (tormodvolden) wrote :

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

  * debian/update-grub: replace Ubuntu with lsb_release if possible
    (LP: #83690, #19040)
  * debian/update-grub: on upgrades, set the new savedefault option
    to "true" if the user was using "default saved" (LP: #131858)

 -- Tormod Volden <email address hidden> Mon, 03 Sep 2007 22:56:34 +0200

Changed in grub:
status: New → Fix Released
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.