Bug#547705: grub-pc: Screws up "default" entry in menu.lst when updatedefaultentry is false

Felix Zielcke fzielcke at z-51.de
Mon Sep 21 18:09:30 UTC 2009


reassign 547705 grub-legacy
reassign 465144 grub-legacy
forcemerge 465144 547705
affects 547705 grub-pc
thanks

Even though this bug affects grub2, it still needs to be fixed in
grub-legacy.

Am Montag, den 21.09.2009, 19:28 +0200 schrieb Matthijs Kooijman:
> Package: grub-pc
> Version: 1.97~beta3-1
> Severity: normal
> 
> Hi,
> 
> I've upgraded grub to grub-pc, which does some magic chainloading (on my
> request). However, this screwed up my default entry in menu.lst, which
> used to read "default saved" and now reads "default 0saved".
> 
> >From following the logic in /usr/lib/grub-legacy/update-grub, it seems
> this is caused by updatedefaultentry not being set.
> 
> The following code parses the current default entry, including the setting of
> use_grub_set_default. Note that this does not happen when updatedefaultentry is
> false.
> 
[...]
> 
> Further down, the default number is updated in the generated menu.lst file. The
> actual code for the non-grub2 case is removed. Note that if grub 2 is not being
> installed, the default is not changed when notChangeDefault is set, which is
> the case if updatedefaultentry is false (see the final else clause above).
> 
> 	#Updating the default number
> 	if [ "$LET_US_TRY_GRUB_2" = "true" ] && test -f /boot/grub/core.img ; then
> 		set_default_value "0"
> 	elif test -z "$notChangeDefault"; then
> 		[ Code removed ]
> 	fi
> 
> This code uses the set_default_value function, which looks like:
> 
[...]
> 
> Here, the second half of the if contains a sed that matches numbers only (which
> seems to make sense, since it only runs if use_grub_set_default is false,
> right?). However, this breaks when the default config is "saved" and not a
> number, which can occur as shown above.
> 
> To fix this, I'd probably change the first snippet above, to not check for
> updatedefaultentry if LET_US_TRY_GRUB_2 is set. This might get complicated,
> though, so perhaps something more elegant can be done?
> 

This is just cosmetical. GRUB Legacy boots fine from the newly created
first menu entry.
It's just an a bit strange way to preserve the `default saved' in case
you want to revert that change.
Actually I think the only change we need to make, is to remove the added
0 again on purge, when the boot GRUB 2 menu entry gets removed.



-- 
Felix Zielcke
Proud Debian Maintainer






More information about the Pkg-grub-devel mailing list