David Zelinsky wrote:
> I just did an 'apt-get dist-upgrade' from the lasted squeeze update, and
> failed to notice it had decided to install a stock kernel image:
> linux-image-2.6.32-5-686_2.6.32-48squeeze1.  I did not want this, since
> I'm using a custom kernel, and I'm not sure the stock kernel will even
> work.

I imagine you had one of these installed:

  linux-image-686
  linux-image-2.6-686
  linux-image-2.6-686-bigmem

Those are meta packages that will rotate forward and depend upon the
current package such as linux-image-2.6.32-5-686_2.6.32-48squeeze1.
That is how the rest of us have automated system upgrades.

> Worse, the linux-image package did not install properly, with
> some part of the post-install script returning errors (zz-update-grub).
> The rest of the dist-upgrade appeared to succeed, but the
> linux-image-2.6.32-5-686 package is in a half-installed state.

The zz-update-grub script is part of the grub-pc package.

  $ dlocate /etc/kernel/postrm.d/zz-update-grub
  grub-pc: /etc/kernel/postrm.d/zz-update-grub

I don't know if you are using grub for booting but IIRC those files
are only needed to set up and install grub.  IIRC removing those will
not uninstall grub.  Meaning that you can purge the grub packages that
are causing you problem and that should allow you to to purge the
linux-image packages that you don't want.  Then afterward you can
re-install anything that you may have temporarly uninstalled.

> I tried removing the offending package ("apt-get remove") but got the
> same error from the post-remove script.

Using apt-get remove will call dpkg --remove.  And dpkg --purge would
be just the same for running the prerm scripts.  You will need to
avoid the errors from the prerm family of scripts in order to be able
to cleanly remove these.

Normally package scripts are plainly available at in the
/var/lib/dpkg/info/$PACKAGE.* location.  If it is shell script we can
just hack edit the prerm and put in an 'exit 0' to avoid the error and
then remove it.  But in this case the script is a perl script.  (Still
could hack it.  It is going away.)  You can browse the script this way:

  less /var/lib/dpkg/info/linux-image-2.6.32-5-686.prerm

That script is going away when you remove the package.  So hacking it
to avoid the error seems like the best solution.  It is simply calling
all of the script parts at /etc/kernel/prerm.d/* and it is the
/etc/kernel/prerm.d/zz-update-grub script that is giving you problem.

> How can I fix this?  I want the linux-image package to go away, and also
> to make sure 'apt-get dist-upgrade' will not try to install it in the
> future.

I would hack the /var/lib/dpkg/info/linux-image-2.6.32-5-686.prerm
perl script with "exit(0);" at the top right after the #!/usr/bin/perl
line.  Or I would remove grub-pc to remove the zz-update-grub script.
Probably hacking the first is most direct.  It all depends.

Then to make sure it doesn't come back make sure you do not have any
of these installed:

  linux-image-686
  linux-image-2.6-686
  linux-image-2.6-686-bigmem

And for amd64 architecture users (making this posting useful for other
architectures too) it would be:

  linux-image-amd64
  linux-image-2.6-amd64

But of course your apt-get remove is going to remove it for you.  You
can see that in this output that you showed:

> The following packages will be REMOVED:
>   linux-image-2.6-686 linux-image-2.6.32-5-686

So with that you will have what you want already.

Bob

Attachment: signature.asc
Description: Digital signature

Reply via email to