Ubuntu

package libghc6-mtl-dev 1.0.1-1 failed to install/upgrade: Package is in a very bad inconsistent state - you should

Reported by fuxter on 2008-05-12
32
Affects Status Importance Assigned to Milestone
gtk2hs (Debian)
Fix Released
Unknown
gtk2hs (Ubuntu)
Undecided
Unassigned

Bug Description

dpkg: error processing libghc6-gtkglext-dev (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
dpkg: error processing libghc6-gtk-dev (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
dpkg: error processing libghc6-cairo-dev (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
dpkg: error processing libghc6-mtl-dev (--remove):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 libghc6-gtkglext-dev
 libghc6-gtk-dev
 libghc6-cairo-dev
 libghc6-mtl-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)

ProblemType: Package
Architecture: i386
Date: Mon May 12 13:32:40 2008
DistroRelease: Ubuntu 8.04
ErrorMessage: Package is in a very bad inconsistent state - you should
Package: libghc6-mtl-dev 1.0.1-1
PackageArchitecture: i386
SourcePackage: haskell-mtl
Title: package libghc6-mtl-dev 1.0.1-1 failed to install/upgrade: Package is in a very bad inconsistent state - you should
Uname: Linux 2.6.24-17-generic i686

Related branches

fuxter (fuxter) wrote :

Have you tried reinstalling the packages you are trying to remove, as the error message suggests to do?

fuxter (fuxter) wrote :

in attachment you'll find screenshots with errors when updating problem packages and also errors when trying to remove them.
please, let me know if i can do anything else for more information.
thanks

Please attach the file /var/log/apt/term.log
Also the file /etc/apt/sources.list

Also, what lead you to this situation? Why are you trying to remove those packages and when were they installed?

Thanks

fuxter (fuxter) wrote :

It came out after automatic upgrade to 8.04 from 7.10.
there were some errors while installing upgrade.
since then i got "you got 4 updates" notification of these four packages that will never install correctly.
also if i try to install any other package it says "you got broken packages..."

Since the issue started during a distribution upgrade, could you please add the log files from '/var/log/dist-upgrade/' to this bug report as attachments?

Also, your sources.list file has some incorrect entries (possibly due to the failed upgrade, we'll know better when we get those logs). In the meantime, you are free to use this sources.list for Hardy (attached). To replace the sources.list file requires "sudo" the you need to update your information with a "sudo apt-get update" and then "sudo apt-get upgrade"

Thanks in advance

fuxter (fuxter) wrote :

ok, here are logs

StefanPotyra (sistpoty) wrote :

From the logs:

Preparing to replace libghc6-gtkglext-dev 0.9.12-0ubuntu1.1 (using .../libghc6-gtkglext-dev_0.9.12.1-1ubuntu2_i386.deb) ...

/var/lib/dpkg/info/libghc6-gtkglext-dev.prerm: line 5: ghc-pkg: command not found

So seems to be either a bug in gkt2hs or in ghc6, reassigning to gtk2hs for now. (still, I'm a little bit confused *why* ghc-pkg isn't there during prerm)

Duncan Coutts (duncan-haskell) wrote :

I happen to be an upstream developer of Gtk2Hs and I ran into this problem while doing the upgrade from 7.10 to 8.04.

What's going on:
--------------------------
Every Haskell library gets registered with the Haskell compiler ghc. The ghc-pkg program is used to do that.
Packages get registered (ghc-pkg register) when they're installed and unregistered (ghc-pkg unregister) when
they get uninstalled or upgraded. To be unregistered they have to be registered in the first pace.

So what's gone wrong is that ghc itself has been upgraded before the other libs (gtk2hs, mtl etc) were unregistered.
When ghc gets upgraded it includes an empty package database. So now when it comes time to upgrade the other
Haskell libs they are of course no longer registered (because they were registered with the older version of the
compiler and not the new one). The uninstall script then fails because ghc-pkg unregister fails, since the package is
not registered.

How to fix it:
----------------------------------
For a proper fix, pester the debian Haskell packagers.

How to workaround it:
----------------------------------
The workaround is to register dummy versions of the packages that the debs are trying to unregister. Then it will be
possible to uninstall the packages and after that, possible to install the new versions that work with ghc-6.8.2.

This assumes you do now have ghc-6.8.2 installed.

You need to register dummy versions of exactly the versions that were previously registered. For example if you are
having a problem with libghc6-gtk-dev-0.9.12, libghc6-glib-dev-0.9.12 and libghc6-cairo-dev-0.9.12 then we need to
register dummy ghc packages gtk-0.9.12, glib-0.9.12, cairo-0.9.12. An easy way to make dummy package registration
files is to copy them from an existing package registration and change the name and version numbers to the ones
we need.

For example:
ghc-pkg describe containers > gtk.pkg
ghc-pkg describe containers > glib.pkg
ghc-pkg describe containers > cairo.pkg

*** It is vitally important that you now edit the content files to change the package name, or you'll overwrite the
registration of the containers package which would screw up your ghc installation! ***

gedit gtk.pkg glib.pkg cairo.pkg

Change the first two lines of each of these package registration files from:
  name: containers
  version: 0.1.0.1
to
  name: gtk
  version: 0.9.12
Obviously using the right package name for the file, so gtk, glib, cairo etc.

Once that's done then as root we register these dummy packages:
sudo ghc-pkg register gtk.pkg
sudo ghc-pkg register glib.pkg
sudo ghc-pkg register cairo.pkg

You can check they're registered with ghc-pkg list

Once you've done this it should be possible to uninstall the problematic deb packages and then install the new
versions. You might just want to check afterwards again with ghc-pkg list that the dummy packages we registered
got unregistered again when you uninstalled the deb packages. If you end up with one left over you can use
ghc-pkg unregister to remove them again (specify the exact package name and version).

StefanPotyra (sistpoty) wrote :

Hi Duncan,

thanks for the info. However I'm still unsure why this situation can happen in the first place. Imho the old version should have been removed (and hence the postinst run) before ghc6 is getting upgraded, since it has a versioned dependency on ghc6. I've also just dist-upgraded a gutsy chroot to hardy, and that worked as expected.

One thing that's definitely wrong in the postinst is, that it doesn't support rollback/recovery (i.e. the postinst of the new version, which gets tried if the old one fails, cannot work).

I'll forward this to the debian maintainers.

Cheers,
   Stefan.

StefanPotyra (sistpoty) wrote :

also subscribing Michael. Maybe you can give some deeper inside about what's going on when upgrading?

Thanks,
   Stefan.

StefanPotyra (sistpoty) on 2008-06-07
Changed in gtk2hs:
status: Incomplete → Confirmed
Changed in gtk2hs:
status: Unknown → New
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gtk2hs - 0.9.13-2ubuntu2

---------------
gtk2hs (0.9.13-2ubuntu2) intrepid; urgency=low

  * debian/postinst.in, debian/prerm.in:
    Call /usr/bin/ghc-pkg6 instead of ghc-pkg, because the latter is
    managed in ghc6 via alternatives, and hence might not be available
    when gtk2hs's binary packges get configured. LP: #229489, #277233.
    Forwarded to Debian BTS via bug #501052.

 -- Stefan Potyra <email address hidden> Fri, 03 Oct 2008 18:34:53 +0200

Changed in gtk2hs:
status: Confirmed → Fix Released
Changed in gtk2hs:
status: New → Fix Released
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

Remote bug watches

Bug watches keep track of this bug in other bug trackers.