/etc/kernel/prerm.d/last-good-boot fails if grub is removed but not purged

Bug #272885 reported by Shriramana Sharma on 2008-09-21
174
This bug affects 6 people
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Undecided
Colin Watson
Intrepid
Undecided
Unassigned

Bug Description

After installing linux-image-2.6.27-3-generic (i.e. upgrading the kernel to the latest) from an install of Intrepid Alpha 5, I tried to remove the 2.6.27-2 image:

$ sudo apt-get purge linux-image-2.6.27-2-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-2.6.27-2-generic*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 96.0MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 109912 files and directories currently installed.)
Removing linux-image-2.6.27-2-generic ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/last-good-boot
/etc/kernel/prerm.d/last-good-boot: 3: /usr/sbin/kernel-helper: not found
run-parts: /etc/kernel/prerm.d/last-good-boot exited with return code 127
Failed to process /etc/kernel/prerm.d at /var/lib/dpkg/info/linux-image-2.6.27-2-generic.prerm line 267.
dpkg: error processing linux-image-2.6.27-2-generic (--purge):
 subprocess pre-removal script returned error exit status 2
Errors were encountered while processing:
 linux-image-2.6.27-2-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

I found out that the reason is that I had installed grub2 (just for testing) which removed grub which apparently provides this kernel-helper file. After installing grub (which removed grub2) the purge proceeded successfully.

This must mean, I believe, that the package linux-image (or some other such package) must depend on grub, but it does not, since I was allow to uninstall grub.

Please look at the situation and find a solution.

Mackenzie Morgan (maco.m) wrote :

In Hardy it's set to recommend grub or lilo. What depends, recommends, and suggests are listed in Intrepid?

Mackenzie Morgan wrote:
> In Hardy it's set to recommend grub or lilo. What depends, recommends,
> and suggests are listed in Intrepid?
>
> ** Changed in: ubuntu
> Status: New => Incomplete

It seems to be the same:

Recommends: lilo (>= 19.1) | grub

but my point is that when the package cannot be successfully
installed/uninstalled without the presence of another package, it must
depend on that package, no? Does mere "Recommends" fulfil the need?

Shriramana Sharma.

Hello. I am removing the "Incomplete" tag as no further information is requested of me.

Kow (kow) wrote :

I can confirm this bug for anyone who removes the package "grub". All linux-image packages should REQUIRE grub or a better solution: fix the linux-image package so it doesn't depend on any particular boot loader.

Colin Watson (cjwatson) wrote :

The kernel must not depend on grub. That cure would be worse than the disease.

We can't really fix this *properly* without a time machine; the buggy script is shipped by the grub package. (Before you say that you removed the grub package, indeed you did; but conffiles are not removed unless you *purge* the package, and that's why this script is still hanging around. It's not actually the kernel's fault at all.)

However, we can update this script in grub to avoid failing if kernel-helper is missing, i.e. the package is removed but not purged. This won't help people who have already removed grub without the aid of the aforementioned time machine, but it will fix it for people who remove it in future.

Changed in grub:
assignee: nobody → cjwatson
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub - 0.97-29ubuntu50

---------------
grub (0.97-29ubuntu50) jaunty; urgency=low

  * debian/update-grub: Strip trailing slashes from mountpoints in fstab
    before comparing them (LP: #317085).
  * debian/kernel-prerm.d-last-good-boot: Don't fail if grub has been
    removed but not purged (LP: #272885).
  * Depend on grub-common for grub-probe, needed to check whether XFS is in
    use (LP: #328633).

 -- Colin Watson <email address hidden> Mon, 23 Feb 2009 09:52:50 +0000

Changed in grub:
status: Fix Committed → Fix Released
Pancho (pancho.s) wrote :

I can confirm that it works now!

Alex Valavanis (valavanisalex) wrote :

Intrepid Ibex reached end-of-life on 30 April 2010 so I am closing the
report. The bug has been fixed in newer releases of Ubuntu.

Changed in grub (Ubuntu Intrepid):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers