upgrade kernel destroys ubuntu grub menu.lst entries

Bug #141642 reported by Collins Richey on 2007-09-22
4
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Undecided
Unassigned

Bug Description

My gutsy system (i386) has been continuously updated since Tribe 2. I update exclusively with apt-get update, upgrad, dist-upgrade.

The last two kernel upgrades have fudged my grub menu.lst. The kernel and restricted modules and initramfs update successfully, and the grub update lines in the upgrade "look" normal, but under the covers it's wrong for the ubuntu stanzas. Other systems (this is a multi-boot system) are not affected.

Here's an excerpt from the corrected menu.lst

. . .
## ## End Default Options ##

title Ubuntu gutsy (development branch), kernel 2.6.22-12-generic
root (hd1,2)
kernel /boot/vmlinuz-2.6.22-12-generic root=UUID=fd325db2-d682-495e-bd63-7a4b881b8913 ro quiet splash
initrd /boot/initrd.img-2.6.22-12-generic
quiet

title Ubuntu gutsy (development branch), kernel 2.6.22-12-generic (recovery mode)
root (hd1,2)
kernel /boot/vmlinuz-2.6.22-12-generic root=UUID=fd325db2-d682-495e-bd63-7a4b881b8913 ro single
initrd /boot/initrd.img-2.6.22-12-generic

title Ubuntu gutsy (development branch), kernel 2.6.22-11-generic
root (hd1,2)
kernel /boot/vmlinuz-2.6.22-11-generic root=UUID=fd325db2-d682-495e-bd63-7a4b881b8913 ro quiet splash
initrd /boot/initrd.img-2.6.22-11-generic
quiet

title Ubuntu gutsy (development branch), kernel 2.6.22-11-generic (recovery mode)
root (hd1,2)
kernel /boot/vmlinuz-2.6.22-11-generic root=UUID=fd325db2-d682-495e-bd63-7a4b881b8913 ro single
initrd /boot/initrd.img-2.6.22-11-generic

. . .
(other ubuntu kernels follow)
. . .
### END DEBIAN AUTOMAGIC KERNELS LIST

After a kernel update, the new kernel stanzas are added, and all the ubuntu kernel entries have

root (hd0,7) and the UUID is no longer that of hdb3. I failed to record the actual incorrect UUID.

ls /dev/disk/by-uuid -al and blkid show nothing for hda8, an empty partition. This partition used to contain an earlier ubuntu system, removed before this problem reared its head.

1. How can I fix this?
2. How can this be cured permanently?

It's a super PITA to need to boot an alternate system and repair the menu.lst manually.

TJ (tj) wrote :

I had a similar experience. It is expected and by design. Anything inside

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST

### END DEBIAN AUTOMAGIC KERNELS LIST

is liable to being re-written.

You probably need to set the default kopt and groot to match your system so grub uses them when menu.lst is updated. For example, here's the default options I have:

# kopt=root=UUID=f8f56c60-4507-47ff-beaf-bb87352f3128 ro
# groot=(hd0,4)

On 9/21/07, TJ <email address hidden> wrote:
> I had a similar experience. It is expected and by design. Anything
> inside
>
> #
> # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
>
> ### BEGIN AUTOMAGIC KERNELS LIST
>
> ### END DEBIAN AUTOMAGIC KERNELS LIST
>
> is liable to being re-written.
>
> You probably need to set the default kopt and groot to match your system
> so grub uses them when menu.lst is updated. For example, here's the
> default options I have:
>
> # kopt=root=UUID=f8f56c60-4507-47ff-beaf-bb87352f3128 ro
> # groot=(hd0,4)
>
> --
> upgrade kernel destroys ubuntu grub menu.lst entries
> https://bugs.launchpad.net/bugs/141642
> You received this bug notification because you are a direct subscriber
> of the bug.
>

In the past, the existing kernel stanzas for Ubuntu between the
markers were not altered, so I fail to understand how this is by
design. Whence does the updater get the idea to drag in a UUID that is
not that of the booted partition and/or the prior kernel stanzas in
menu.lst? It's poor design, or a bug.

I've never heard of the 'kopt' and 'groot' options, but I'll check
them out. If these options are required, why doesn't the installer put
them in?

--
Collins Richey
     If you fill your heart with regrets of yesterday and the worries
     of tomorrow, you have no today to be thankful for.

TJ (tj) wrote :

It's a function of update-grub.

See https://help.ubuntu.com/community/GrubHowto

On my system I have three bootable partitions:

sda1 Recovery
sda2 windows **bootable**
sda3 swap
sda5 /boot
sda6 Feisty 32-bit / **bootable**
sda7 Gutsy 64-bit / **bootable**
sda8 /home

Originally sda7 was used for testing and if I installed from the LiveCD allowing the default option to install grub, whenever there was a kernel-update sda5/boot/grub/menu.lst would be altered inside the automagic blocks and the UUIDs of sda7 (the default root as far as Gutsy is concerned) would replace the UUID of sda6 for all the Feisty kernel entries.

I set the default kopt and groot to Feisty and then installed Gutsy to sda7 without allowing grub to be installed. It's an option in the final dialog of the installer (Advanced... button I seem to recall).

Now when Gutsy updates kernels it doesn't touch the menu.lst, and I deal with it manually. I have the added issue of renaming generic kernel files to -64 or -32.

Collins Richey (crichey) wrote :

On 9/21/07, TJ <email address hidden> wrote:
> It's a function of update-grub.
>
> See https://help.ubuntu.com/community/GrubHowto
>

OK, I've reviewed this, but it still looks like a bug. My menu.lst has

# kopt=root=UUID=fd325db2-d682-495e-bd63-7a4b881b8913 ro
# groot=(hd1,2)

but the update-grub is generating entries for device 0 and UUIDs for
an empty partition.

--
Collins Richey
     If you fill your heart with regrets of yesterday and the worries
     of tomorrow, you have no today to be thankful for.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers