update-grub failes when "default" is set to "saved" instead of numeric value

Bug #164513 reported by nickb834
6
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: grub

When performing a distro upgrade from Feisty to Gutsy, update manager complained about these packages:

linux-image-2.6.22-14-generic
linux-ubuntu-modules-2.6.22-14-generic
linux-restricted-modules-2.6.22-14-generic
nvidia-glx
ubuntu-standard
linux-image-generic
update-manager
linux-restricted-modules-generic
linux-generic
memtest86+

Specifically the problem manifested itself whenever a packages post install called "update-grub".

Running "update-grub" manually produced the same error:

nick@:~$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
expr: non-numeric argument

notice the last line "expr: non-numeric argument", this was down to my default booted entry being set to "saved" instead of a decimal number:

default saved
#default 2

If I uncomment the 2nd default line, all is well and package installation and post install actions succeed.

"saved" is a valid option for default as I have used it succesfully for years by adding "savedefault" at the end of my boot options.

I can reproduce this bug at will by changing defaults value to "saved" from 1 / 2 / 3 / whatever.

description: updated
Revision history for this message
Tres Seaver (tseaver) wrote :

I believe that the culprit here is the final stanza of /usr/sbin/update-grub, which tries to
compute the new default number by performing arithmetic on the old one: if you have
entered 'saved' as your default, the arithmetic fails. I think it needs to be wrapped in a
test for numeric, e.g.:

   if test -n "$defaultEntryNumber"; then

In the meanwhile, a workaround would appear to be setting 'updatedefaultentry' to 'false',
which should sidestep the whole issue.

Revision history for this message
Till Ulen (tillulen) wrote :

This looks like a bug in grub that has been reported once again and already confirmed there (#193439). Marking as duplicate.

Revision history for this message
Tres Seaver (tseaver) wrote :

There is information here which is not present in #19439:

  - #19439 is about setting 'default' in /boot/grub/default; in
    my case the value is configured in /boot/grub/menu.1st (the
    "normal" way to configure grub), and it is set to 'saved' (a
    value which actually means something).

Also, #19439 is newer than this bug by three months.

OTOH, the underlying cause is indeed the same: 'update-grub' is
wrongly assuming that the default must be numeric).

Revision history for this message
Steve Langasek (vorlon) wrote :

Tres,

Yes, setting default to "saved" means something - it means to look in /boot/grub/default for the value. :) These are indeed the exact same bug.

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.