This question already has an answer here:

So this seems simple, but I've been googling for days.

An install of gitlab went wrong, so I tried to purge it to reinstall, however I get this:

dpkg: error processing package gitlab-ce (--remove):
    package is in a very bad inconsistent state; you should
    reinstall it before attempting a removal

However trying to install it causes it to hang at 6%, the problem it had initially. I'm no longer needing gitlab at all (I'm using gitea on a different machine), but this problem is preventing me from installing anything at any time I use apt to install something it also wants to install gitlab at the same time, which again hangs at 6%.

For example sudo apt-get install curl shows this:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
    gitlab-ce libcurl4
The following packages will be upgraded:
    curl gitlab-ce libcurl4
3 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.
1 not fully installed or removed.
Need to get 472 MB of archives.
After this operation, 1460 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.5 [159 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.5 [214 kB]
Get:3 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic/main amd64 gitlab-ce amd64 11.5.0-ce.0 [472 MB]
Fetched 287 MB in 18s (16.3 MB/s)
(Reading database ... 54181 files and directories currently installed.)
Preparing to unpack .../gitlab-ce_11.5.0-ce.0_amd64.deb ...

marked as duplicate by NickTux, karel, muru, Fabby, N0rbert Nov 27 '18 at 20:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    The gitlab-ce package is not in the Ubuntu repositories. Contact whomever you got that non-Ubuntu software from -- they need to know that their package breaks your system. They probably did not intend that behavior. – user535733 Nov 27 '18 at 15:59

Too many similar questions exist in AskUbuntu

  1. Package is in a very bad inconsistent state
  2. How to fix "Package is in a very bad inconsistent state" error?
  3. dpkg: "Package is in a very bad inconsistent state" how to fix it?

but its one has its own singularity.

The general answer is

package is in a very bad inconsistent state - you should reinstall it before attempting configuration.

The issue is easy to fix. Just reinstall the package:

sudo apt-get --reinstall install gitlab-ce

But in case you don't want to install it, or you cannot because it stuck, you can always use the --force-all option in dpkg.

Be Careful with this option as it can break things badly.

sudo dpkg -P --force-all gitlab-ce

Also, if you have any PPA enabled that provides gitlab-ce, please disable it or completely remove it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.