On armel (Babbage platform), kernel image upgrading breaks if Ubiquity is instructed not to install a bootloader

Bug #365053 reported by Dave Martin
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
flash-kernel (Ubuntu)
Fix Released
High
Ubuntu ARM Team
initramfs-tools (Ubuntu)
Fix Released
Medium
Ubuntu ARM Team

Bug Description

Binary package hint: ubiquity

If the "install bootloader" option is cleared (in the advanced options on the last page of the Ubiquity installer dialogs), it appears that no /etc/flash-kernel.conf configuration file is generated for flash-kernel to use.

However, the linux image postinst script unconditionally runs flash-kernel to reprogram the kernel and (I think) initrd on the SD card. flash-kernel gets confused if there is no /etc/flash-kernel.conf; some shell variables remain unset in flash-kernel causing odd errors.

This means that if the kernel image package (e.g., linux-image-2.6.28-11-imx51) is upgraded, the postinst script will fail, leaving that package half-configured. This also seems to prevent apt-get (probably also higher-level package managers) from working until the problem is resolved manually.

This will not affect typical users who just install with the default configuration; however I already had a different SD card set up with a suitable kernel for booting purposes, and wanted to avoid clobbering the SD card with the live image on it so that I could use it again, reproducibly.

Here's what happens when I try to upgrade the kernel image just after a clean install:
(Actually, there's no newer package available, so I simulate this by reinstalling the kernel image)

root@ubuntu-desktop:~# apt-get --reinstall install linux-image-2.6.28-11-imx51
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0B/8235kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]?
(Reading database ... 95002 files and directories currently installed.)
Preparing to replace linux-image-2.6.28-11-imx51 2.6.28-11.42 (using .../linux-image-2.6.28-11-imx51_2.6.28-11.42_armel.deb) ...
Done.
Unpacking replacement linux-image-2.6.28-11-imx51 ...
Setting up linux-image-2.6.28-11-imx51 (2.6.28-11.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.28-11-imx51
 is not a block device
Failed to create initrd image.
dpkg: error processing linux-image-2.6.28-11-imx51 (--configure):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 linux-image-2.6.28-11-imx51
E: Sub-process /usr/bin/dpkg returned an error code (1)

Poking around, I can see that there is no flash-kernel.conf (it _is_ there with sane contents of bootloader installation was enabled)

root@ubuntu-desktop:~# ls --color=never /etc/flash-kernel.conf
ls: cannot access /etc/flash-kernel.conf: No such file or directory

Since flash-kernel.conf is just sourced as a shell script, I can artificially make flash-kernel "succeed" by this ugly hack (but it's obviously not the right solution!)

root@ubuntu-desktop:~# echo exit 0 >/etc/flash-kernel.conf
root@ubuntu-desktop:~# dpkg --pending --configure
Setting up linux-image-2.6.28-11-imx51 (2.6.28-11.42) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.28-11-imx51
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.28-11.42 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.28-11.42 was configured last, according to dpkg)

root@ubuntu-desktop:~# exit

ProblemType: Bug
Architecture: armel
DistroRelease: Ubuntu 9.04
Package: ubiquity 1.12.12
ProcEnviron:
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: ubiquity
Uname: Linux 2.6.28-11-imx51 armv7l

Revision history for this message
Dave Martin (dave-martin-arm) wrote :
Revision history for this message
Loïc Minier (lool) wrote :

Could you please attach your /etc/kernel-img.conf?

tags: added: arm
Revision history for this message
Dave Martin (dave-martin-arm) wrote :
Revision history for this message
Dave Martin (dave-martin-arm) wrote :

Perhaps do_initrd should be "no" when not installing the bootloader?

Revision history for this message
Loïc Minier (lool) wrote :

So I think the installer does thing correctly in that it doesn't pull a bootloader and doesn't setup kernel-img.conf to run it (on systems where the bootloader is installed, kernel-img.conf has: "postinst_hook = flash-kernel"). The only problem is that flash-kernel gets installed while it shouldn't. I suspect this is due to the Recommends of linux-image-imx51, but I need to confirm where it gets pulled.

Revision history for this message
Dave Martin (dave-martin-arm) wrote :

I see; yes, that sounds plausible.

So it might make sense to remove the Recommends from linux-image-imx51 and install flash-kernel explicitly if the bootloader installation option is enabled in ubiquity?

Revision history for this message
Oliver Grawert (ogra) wrote :

i dont think the dependency is wrong, the code in update-initramfs should simply respect that there is no postinst_hook set (like the postinst of the kernel package itself seems to do here) in the linux-image postinst perl script the following code appears:

## Run user hook script here, if any
if ($postinst_hook) {
  &run_hook("postinst", $postinst_hook);
}

Revision history for this message
Loïc Minier (lool) wrote :

So flash-kernel is installed in the live-system (I see it in the manifest); perhaps it shouldn't be, or should be removed from the installed, I'm not sure.

There's a way I can prevent it to fail though which is to mark it as unsupported when there's no flash-kernel.conf; I think I'll upload that to karmic.

affects: ubiquity (Ubuntu) → flash-kernel (Ubuntu)
Revision history for this message
Loïc Minier (lool) wrote :

Subscribed Ubuntu Installer folks to hear what they think of the overall approach :-)

Revision history for this message
Emmet Hikory (persia) wrote :

There are two aspects to this bug: firstly, that flash-kernel really shouldn't fail in the absence of a configuration. The second is that update-initramfs should be checking the appropriate hook from kernel-img.conf. The hook to call flash-kernel will only be present if either manually added, or added by flash-kernel-installer (in the case where the user chose to install the bootloader).

Revision history for this message
Oliver Grawert (ogra) wrote :

the fix for update-initramfs

--- ../update-initramfs 2009-04-23 12:15:22.000000000 +0200
+++ update-initramfs 2009-04-23 12:23:05.000000000 +0200
@@ -263,7 +263,9 @@
   zipl
  fi
  if flash-kernel --supported >/dev/null 2>&1; then
- flash-kernel
+ if grep -q flash-kernel /etc/kernel-img.conf; then
+ flash-kernel
+ fi
  fi
 }

Revision history for this message
Loïc Minier (lool) wrote :

I don't like the crude greq; here's a nicer version of this option

Revision history for this message
Loïc Minier (lool) wrote :

And this is another option which drops --supported.

Revision history for this message
Loïc Minier (lool) wrote :

My preference for initramfs-tools is still to add a new post-update-initramfs option which would allow dropping the bunch of bootloader calls in update-initramfs (elilo and folks).

Revision history for this message
Loïc Minier (lool) wrote :
Paul Larson (pwlars)
tags: removed: arm
Paul Larson (pwlars)
Changed in flash-kernel (Ubuntu):
status: New → Triaged
Changed in initramfs-tools (Ubuntu):
status: New → Triaged
Changed in flash-kernel (Ubuntu):
importance: Undecided → Medium
Changed in initramfs-tools (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Tobin Davis (gruemaster) wrote :

I would think that flash-kernel-installer.postinst script should have the ability to ensure that flash-kernel is enabled in /etc/kernel-img.conf after installing the flash-kernel package. This is now affecting the omap preinstalled images, as they don't use ubiquity to create the image (except for oem-tools on first boot). Upgrading to high, as currently updating the kernel in Maverick on omap fails to run flash-kernel.

Changed in flash-kernel (Ubuntu):
importance: Medium → High
milestone: none → ubuntu-10.10-beta
Revision history for this message
Tobin Davis (gruemaster) wrote :

This issue should be revisited with natty.

Changed in flash-kernel (Ubuntu):
assignee: nobody → Ubuntu armel porters (ubuntu-armel)
milestone: ubuntu-10.10-beta → none
Changed in initramfs-tools (Ubuntu):
assignee: nobody → Ubuntu armel porters (ubuntu-armel)
Revision history for this message
Tobin Davis (gruemaster) wrote :

This issue seems to have been resolved. Marking as "Fix Released".

Changed in flash-kernel (Ubuntu):
status: Triaged → Fix Released
Changed in initramfs-tools (Ubuntu):
status: Triaged → Fix Released
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.