Unable to force remove/purge package ubuntu 16.04

24,165

Solution 1

Read man dpkg and man apt-get. Your first command should have been sudo apt-get remove gitlab-ce, then sudo apt-get purge gitlab-ce. The autoremove command just removes packages that were installed due to the requirements of another package, but the other package was uninstalled.

Solution 2

I've accepted @waltinator answer because by reading man dpkg I've come up with a solution by using

sudo dpkg --remove --force-all gitlab-ce

I know the best solution for this is to reinstall the application but I've had trouble with that and this command helped me, but I suggest people to try and reinstall the application before remove/purge it.

Solution 3

Try

find / -iname "gitlab" 

after you find the folder where it was installed.

/opt/gitlab/bin/gitlab-ctl uninstall

Did you tried ?

sudo dpkg -r gitlab-ce

if yes and still the package is unable to be removed than you messed it by triggering commad :

sudo apt-get dist-upgrade

you should check your version now using command :

cat /etc/lsb-release 

& edit your question back

Share:
24,165

Related videos on Youtube

copser
Author by

copser

God forbid we have to move our fingers away from the hjkl position.

Updated on September 18, 2022

Comments

  • copser
    copser over 1 year

    I'm trying to remove gitlab-ce from my system, because I don't need it and I'm not able to do it, first I tried this:

    sudo apt-get --remove autoremove gitlab-ce
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages will be REMOVED:
      gitlab-ce
    0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
    1 not fully installed or removed.
    After this operation, 1076 MB disk space will be freed.
    Do you want to continue? [Y/n] Y
    dpkg: error processing package gitlab-ce (--remove):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting a removal
    Errors were encountered while processing:
     gitlab-ce
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    Then I tried this

    sudo dpkg --purge gitlab-ce               
    dpkg: error processing package gitlab-ce (--purge):
     package is in a very bad inconsistent state; you should
     reinstall it before attempting a removal
    Errors were encountered while processing:
     gitlab-ce
    

    The system is persistent is asking me to reinstall the app, and I don't want it, first I've tried to update my system using sudo apt-get update && sudo apt-get dist-upgrade because I've seen that my update is not working properly, so in the end I was left with some broken dpkg packages, so I needed to solve that and now I'm trying to remove this forsaken app from my system, so what can I do to purge this out of my system.

    • goo
      goo almost 7 years
      Read man dpkg and man apt-get. Your first command should have been sudo apt-get remove gitlab-ce, then sudo apt-get purge gitlab-ce. The autoremove command just removes packages that were installed due to the requirements of another package, but the other package was uninstalled.
    • Danibix
      Danibix almost 7 years
      Have you tried to reinstall gitlab-ce yet (as suggested by commands you issued)? Then you should be able to run commands provided in the answer without any problem.
    • copser
      copser almost 7 years
      Problem with that is that my system crashes every time I try that, and yes I've tried it a couple of times
    • Panther
      Panther almost 7 years
      If all else fails follow this procedure - blog.bodhizazen.com/linux/…
  • copser
    copser almost 7 years
    sudo apt-get remove gitlab-ce and sudo apt-get purge gitlab-ce are returning E: Sub-process /usr/bin/dpkg returned an error code (1) so what is the clean way or cleaning dpkg
  • Artemmm
    Artemmm almost 7 years
    @PetarP The clean way is reinstalling the package (sudo apt install --reinstall packagename) then remove/purge it.
  • copser
    copser almost 7 years
    Yes, doing that right now
  • copser
    copser almost 7 years
    I'm reinstalling it, but I'll try this if reinstall fails
  • Panther
    Panther almost 7 years
    If that fails see blog.bodhizazen.com/linux/…