grub-legacy-ec2 cannot be purged

Bug #749444 reported by iMac
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: cloud-init

Running current Maverick-Server as a Xen pv_ops domu. Installed the grub-legacy-ec2 package, and now it cannot be purged. It does not properly account for the pv_ops kernels (detected as non-domu) so it is not much use to me to create a menu.lst for use with Debian Squeeze/6 Dom0 pygrub . It removes the diversion of /usr/sbin/grub-set-default and then trys to remove it again during the purge.. and fails. So it is stuck on my system in a "removed" state, with no dpkg --force options to purge/workaround.

The following apt/dpkg output shows a reinstall followed by remove, and purge. Note the purge fails.

root@ibm-main:/usr/sbin# apt-get install grub-legacy-ec2 --reinstall
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/28.4kB of archives.
After this operation, 0B of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 145664 files and directories currently installed.)
Preparing to replace grub-legacy-ec2 0.5.15-0ubuntu3 (using .../grub-legacy-ec2_0.5.15-0ubuntu3_all.deb) ...
Leaving 'diversion of /usr/sbin/grub-set-default to /usr/sbin/grub-set-default.real by grub-legacy-ec2'
Unpacking replacement grub-legacy-ec2 ...
Setting up grub-legacy-ec2 (0.5.15-0ubuntu3) ...
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 ...
Ignoring non-Xen Kernel on Xen domU host: vmlinuz-2.6.35-28-server
Updating /boot/grub/menu.lst ... done

root@ibm-main:/usr/sbin# apt-get remove grub-legacy-ec2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  grub-legacy-ec2
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 160kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 145663 files and directories currently installed.)
Removing grub-legacy-ec2 ...
Removing 'diversion of /usr/sbin/grub-set-default to /usr/sbin/grub-set-default.real by grub-legacy-ec2'
root@ibm-main:/usr/sbin# apt-get remove --purge grub-legacy-ec2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  grub-legacy-ec2*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]?
(Reading database ... 145656 files and directories currently installed.)
Removing grub-legacy-ec2 ...
Purging configuration files for grub-legacy-ec2 ...
No diversion 'diversion of /usr/sbin/grub-set-default to /usr/sbin/grub-set-default.real by grub-legacy-ec2', none removed.
dpkg: error processing grub-legacy-ec2 (--purge):
 subprocess installed post-removal script returned error exit status 128
Errors were encountered while processing:
 grub-legacy-ec2
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ibm-main:/usr/sbin#

root@ibm-main:/usr/sbin# dpkg -l | grep grub
ii grub-common 1.98+20100804-5ubuntu3.1 GRand Unified Bootloader, version 2 (common files)
pc grub-legacy-ec2 0.5.15-0ubuntu3 Handles update-grub for ec2 instances
ii grub-pc 1.98+20100804-5ubuntu3.1 GRand Unified Bootloader, version 2 (PC/BIOS version)
root@ibm-main:/usr/sbin#

Revision history for this message
iMac (imac-netstatz) wrote :

Not related to the bug, but I noted the option inDomU=true can be set in menu.lst, to override detection for pv_ops kernels.

Revision history for this message
iMac (imac-netstatz) wrote :

Premature comment.. ignore my last, as the option does not work as expected (menu.lst is recreated with each grub-legacy-ec2-update). Anyhow, to get this package off your system, edit the /var/lib/dpkg/info/grub-legacy-ec2.postrm script and find the following if statement,

if [ "$1" = "remove" -o "$1" = "purge" ]; then
   dpkg-divert --package grub-legacy-ec2 --remove --rename --divert \
      /usr/sbin/grub-set-default.real /usr/sbin/grub-set-default
fi

Simply change the first line,
 if [ "$1" = "remove" -o "$1" = "purge" ]; then
to
 if [ "$1" = "remove" ]; then

This removes the diversion removal step from the purge function, allowing a removal, followed by a clean purge.

#apt-get remove grub-legacy-ec2
#apt-get remove grub-legacy-ec2 --purge

..and it is gone..

root@ibm-main:/var/lib/dpkg/info# dpkg -l | grep grub
ii grub-common 1.98+20100804-5ubuntu3.1 GRand Unified Bootloader, version 2 (common files)
ii grub-pc 1.98+20100804-5ubuntu3.1 GRand Unified Bootloader, version 2 (PC/BIOS version)
root@ibm-main:/var/lib/dpkg/info#

Scott Moser (smoser)
Changed in cloud-init (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.6.1-0ubuntu5

---------------
cloud-init (0.6.1-0ubuntu5) natty; urgency=low

  * fix --purge of grub-legacy-ec2 package (LP: #749444)
  * catchup to trunk cloud-init (rev 394)
  * support user-data formated in dos format by converting to unix for
    user-scripts, boothooks, and upstart jobs (LP: #744965)
  * removal of some debug code, minor documentation fix
 -- Scott Moser <email address hidden> Mon, 04 Apr 2011 13:20:27 -0400

Changed in cloud-init (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.