update-grub failes when "default" is set to "saved" instead of numeric value
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-
linux-ubuntu-
linux-restricte
nvidia-glx
ubuntu-standard
linux-image-generic
update-manager
linux-restricte
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 |
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 "$defaultEntryN umber"; then
In the meanwhile, a workaround would appear to be setting 'updatedefaulte ntry' to 'false',
which should sidestep the whole issue.