update-grub ran before update-initramfs resulting in a menu.lst without an initrd line

Bug #957262 reported by Brian Murray on 2012-03-16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Steve Langasek

Bug Description

I was performing a distribution upgrade from Lucid to Precise and was unable to boot after the upgrade. Come to find out this was due to my menu.lst missing an intird line. I had the following:

title Ubuntu precise (development branch), kernel 3.2.0-18-generic
root (hd0,0)
kernel /boot/vmlinuz-3.2.0-18-generic root=/dev/md0 ro quiet splash

I manually added in the initrd line and was able to boot. I also reinstalled the linux-image package and the initrd line was created for the recovery boot option. From what I could see in the apt-term.log file update-grub was run one time halfway through the upgrade and update-initramfs was run at the very end. So I'm guessing because there wasn't an initrd available it wasn't added to menu.lst.

Brian Murray (brian-murray) wrote :

Here is the apt-term.log from the system.

tags: added: dist-upgrade
tags: added: precise
description: updated
Steve Langasek (vorlon) wrote :

Please attach /etc/kernel-img.conf from this system. Also, if you have /var/log/installer, it would help to know the contents of /var/log/installer/version and /var/log/installer/media-info.

Steve Langasek (vorlon) wrote :

Nevermind about the other files; there's enough info in the term log to figure this out.

Setting up linux-image-3.2.0-18-generic (3.2.0-18.29) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Running postinst hook script /sbin/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 ...
Found kernel: /boot/vmlinuz-3.2.0-18-generic
Found kernel: /boot/vmlinuz-2.6.32-38-server
Found kernel: /boot/vmlinuz-2.6.32-34-server
Found kernel: /boot/vmlinuz-2.6.32-33-server
Found kernel: /boot/vmlinuz-2.6.32-28-server
Found kernel: /boot/vmlinuz-2.6.32-27-server
Found kernel: /boot/vmlinuz-2.6.32-23-server
Found kernel: /boot/vmlinuz-2.6.32-21-server
Found kernel: /boot/vmlinuz-2.6.31-16-server
Found kernel: /boot/vmlinuz-2.6.28-17-server
Found kernel: /boot/vmlinuz-2.6.27-9-server
Found kernel: /boot/vmlinuz-2.6.24-19-server
Found kernel: /boot/memtest86+.bin
Replacing config file /var/run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-18-generic /boot/vmlinuz-3.2.0-18-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-18-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.2.0-18-generic /boot/vmlinuz-3.2.0-18-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.2.0-18-generic /boot/vmlinuz-3.2.0-18-generic
Setting up plymouth-theme-ubuntu-text (0.8.2-2ubuntu28) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-18-generic
Setting up grub (0.97-29ubuntu65) ...
Removing update-grub hooks from /etc/kernel-img.conf in favour of
/etc/kernel/ hooks.
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-18-generic

So the grub update knows to take care of replacing the /etc/kernel-img.conf line with a proper /etc/kernel hook, but then nothing ensures this is called after the kernel upgrade. The kernel postinst calls update-grub too early, and it's not called again after upgrade.

We should probably just have grub call update-grub in the postinst when the upgrade handling is triggered.

Changed in update-manager (Ubuntu):
status: New → Triaged
importance: Undecided → High
Colin Watson (cjwatson) wrote :

Agreed. Shunting over to grub, since it should be fixed there.

affects: update-manager (Ubuntu) → grub (Ubuntu)
Changed in grub (Ubuntu):
assignee: nobody → Colin Watson (cjwatson)
Steve Langasek (vorlon) wrote :

Oh, heh, I thought this bug /was/ filed against grub. Fix already uploaded, but of course the bug didn't get closed because of the wrong package.

Changed in grub (Ubuntu):
status: Triaged → Fix Released
Colin Watson (cjwatson) wrote :

grub (0.97-29ubuntu66) precise; urgency=low

  * When we replace the /etc/kernel-img.conf hook with the
    /etc/kernel/postinst.d hook on upgrade, also call update-grub manually;
    otherwise if the kernel was upgraded before grub itself, update-grub may
    only be called before update-initramfs (due to triggerization of the
    latter), giving us an unbootable default entry in menu.lst.
    LP: #957262.

 -- Steve Langasek <email address hidden> Fri, 16 Mar 2012 12:55:10 -0700

Changed in grub (Ubuntu):
assignee: Colin Watson (cjwatson) → Steve Langasek (vorlon)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments