How to fix “Package is in a very bad inconsistent state” error?











up vote
77
down vote

favorite
27












I can't update my system because it freezes while installing a third-party update (zramswap-enabler)!



Sometimes I get the following message in Update manager:




Could not initialize the package information An unresolvable problem occurred while initializing the package information.



Please report this bug against the 'update-manager' package and include the following error message:



E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.




I tried to remove the zramswap-enabler, but it's impossible because I get the following message:



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


Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem.



So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update?










share|improve this question
























  • Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
    – Eliah Kagan
    Oct 13 '17 at 13:19















up vote
77
down vote

favorite
27












I can't update my system because it freezes while installing a third-party update (zramswap-enabler)!



Sometimes I get the following message in Update manager:




Could not initialize the package information An unresolvable problem occurred while initializing the package information.



Please report this bug against the 'update-manager' package and include the following error message:



E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.




I tried to remove the zramswap-enabler, but it's impossible because I get the following message:



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


Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem.



So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update?










share|improve this question
























  • Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
    – Eliah Kagan
    Oct 13 '17 at 13:19













up vote
77
down vote

favorite
27









up vote
77
down vote

favorite
27






27





I can't update my system because it freezes while installing a third-party update (zramswap-enabler)!



Sometimes I get the following message in Update manager:




Could not initialize the package information An unresolvable problem occurred while initializing the package information.



Please report this bug against the 'update-manager' package and include the following error message:



E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.




I tried to remove the zramswap-enabler, but it's impossible because I get the following message:



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


Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem.



So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update?










share|improve this question















I can't update my system because it freezes while installing a third-party update (zramswap-enabler)!



Sometimes I get the following message in Update manager:




Could not initialize the package information An unresolvable problem occurred while initializing the package information.



Please report this bug against the 'update-manager' package and include the following error message:



E:The package zramswap-enabler needs to be reinstalled, but I can't find an archive for it.




I tried to remove the zramswap-enabler, but it's impossible because I get the following message:



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


Actually I would really reinstall that package, but it is unable to do it! If I remove this third-party PPA then the system is warning me about a very very serious problem.



So why can I not install/reinstall/remove/update this package and why freezes the updater if I try to update?







package-management






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 5 '12 at 5:42









jokerdino

32.4k21118186




32.4k21118186










asked Jun 9 '12 at 19:51









Benjamin Piller

386144




386144












  • Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
    – Eliah Kagan
    Oct 13 '17 at 13:19


















  • Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
    – Eliah Kagan
    Oct 13 '17 at 13:19
















Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
– Eliah Kagan
Oct 13 '17 at 13:19




Related: Fix half-installed package, Apt/Synaptic needs to reinstall package but can't find the archive for it
– Eliah Kagan
Oct 13 '17 at 13:19










7 Answers
7






active

oldest

votes

















up vote
97
down vote













Edited out of the question and added as an answer.




  1. Make sure that your PPA is set up.



  2. Remove the broken package via the following command:



    sudo dpkg --remove --force-remove-reinstreq zramswap-enabler



  3. Install the package again:



    sudo apt-get install zramswap-enabler


  4. After restart (not necessary), you are able to install the updates correctly!



Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!






share|improve this answer























  • This worked perfectly for me! Thanks! :D
    – CharlesL
    Dec 6 '15 at 12:47






  • 1




    @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
    – hexafraction
    Dec 6 '15 at 13:28










  • I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
    – fadden
    Nov 27 '16 at 16:20






  • 1




    I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
    – dashesy
    Jan 5 '17 at 21:53


















up vote
62
down vote













This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04



sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
sudo dpkg --remove --force-remove-reinstreq <packagename>
sudo apt-get remove <packagename>
sudo apt-get autoremove && sudo apt-get autoclean





share|improve this answer



















  • 2




    Finally! This did the trick when dpkg and apt won't remove or reinstall a package
    – abaelter
    Mar 12 '15 at 7:51








  • 1




    Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
    – Ryan H.
    May 1 '15 at 7:43






  • 1




    The only true answer which works any time.
    – twicejr
    May 20 '16 at 12:26






  • 1




    it's working for me, thank you very much!
    – Chu-Siang Lai
    Sep 3 '16 at 5:09






  • 1




    This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
    – Charphacy
    Aug 3 '17 at 0:39


















up vote
9
down vote













I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.



sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>


Then I had to reinstall them



sudo apt-get -f install


That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.






share|improve this answer

















  • 1




    I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
    – Igor G.
    Jan 30 '17 at 21:34


















up vote
7
down vote













The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:



sudo apt-get install -f --reinstall zramswap-enabler





share|improve this answer






























    up vote
    2
    down vote













    i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:



    apt-get autoclean
    apt-get update
    apt-get upgrade
    apt-get install -f


    much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)






    share|improve this answer





















    • This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
      – Igor G.
      Jan 30 '17 at 21:36






    • 1




      I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
      – Dr. Azrael Tod
      Feb 1 '17 at 8:57




















    up vote
    1
    down vote













    I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:



    # apt-get install -f  
    <some output ommited>
    dpkg: warning: overriding problem because --force enabled:
    Package is in a very bad inconsistent state - you should
    reinstall it before attempting a removal.

    wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
    dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb


    Now its ok again:



    #apt-get install -f
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.





    share|improve this answer




























      up vote
      1
      down vote













      The same thing happened to me when I got disconnected from the internet while downloading 'wireshark' package. After that when I tried to reinstall it, it threw the same error 'package is in a very bad inconsistent state'. I've tried all the commands to install, purge, remove and reinstall but nothing worked.
      After a little bit of googling, I stumbled upon a command



      sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb



      (change libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with whatever package is creating problem, in the directory /var/cache/apt/archives/).



      After all the issues were resolved. I removed the package again using



      sudo apt --purge remove libwireshark8:amd64
      sudo apt autoremove to fully remove the package.



      After that, I installed wireshark again using: sudo apt-get install wireshark.

      Everything works smoothly now!



      Rferences:
      How To Solve ”Sub process usr bin dpkg returned an error code 1″ Error?
      Fix dpkg error






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f148715%2fhow-to-fix-package-is-in-a-very-bad-inconsistent-state-error%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        7 Answers
        7






        active

        oldest

        votes








        7 Answers
        7






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        97
        down vote













        Edited out of the question and added as an answer.




        1. Make sure that your PPA is set up.



        2. Remove the broken package via the following command:



          sudo dpkg --remove --force-remove-reinstreq zramswap-enabler



        3. Install the package again:



          sudo apt-get install zramswap-enabler


        4. After restart (not necessary), you are able to install the updates correctly!



        Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!






        share|improve this answer























        • This worked perfectly for me! Thanks! :D
          – CharlesL
          Dec 6 '15 at 12:47






        • 1




          @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
          – hexafraction
          Dec 6 '15 at 13:28










        • I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
          – fadden
          Nov 27 '16 at 16:20






        • 1




          I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
          – dashesy
          Jan 5 '17 at 21:53















        up vote
        97
        down vote













        Edited out of the question and added as an answer.




        1. Make sure that your PPA is set up.



        2. Remove the broken package via the following command:



          sudo dpkg --remove --force-remove-reinstreq zramswap-enabler



        3. Install the package again:



          sudo apt-get install zramswap-enabler


        4. After restart (not necessary), you are able to install the updates correctly!



        Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!






        share|improve this answer























        • This worked perfectly for me! Thanks! :D
          – CharlesL
          Dec 6 '15 at 12:47






        • 1




          @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
          – hexafraction
          Dec 6 '15 at 13:28










        • I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
          – fadden
          Nov 27 '16 at 16:20






        • 1




          I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
          – dashesy
          Jan 5 '17 at 21:53













        up vote
        97
        down vote










        up vote
        97
        down vote









        Edited out of the question and added as an answer.




        1. Make sure that your PPA is set up.



        2. Remove the broken package via the following command:



          sudo dpkg --remove --force-remove-reinstreq zramswap-enabler



        3. Install the package again:



          sudo apt-get install zramswap-enabler


        4. After restart (not necessary), you are able to install the updates correctly!



        Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!






        share|improve this answer














        Edited out of the question and added as an answer.




        1. Make sure that your PPA is set up.



        2. Remove the broken package via the following command:



          sudo dpkg --remove --force-remove-reinstreq zramswap-enabler



        3. Install the package again:



          sudo apt-get install zramswap-enabler


        4. After restart (not necessary), you are able to install the updates correctly!



        Actually you can fix any "Package is in a very bad inconsistent state” issues with this solution!







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:24


























        community wiki





        3 revs, 2 users 70%
        hexafraction













        • This worked perfectly for me! Thanks! :D
          – CharlesL
          Dec 6 '15 at 12:47






        • 1




          @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
          – hexafraction
          Dec 6 '15 at 13:28










        • I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
          – fadden
          Nov 27 '16 at 16:20






        • 1




          I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
          – dashesy
          Jan 5 '17 at 21:53


















        • This worked perfectly for me! Thanks! :D
          – CharlesL
          Dec 6 '15 at 12:47






        • 1




          @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
          – hexafraction
          Dec 6 '15 at 13:28










        • I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
          – fadden
          Nov 27 '16 at 16:20






        • 1




          I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
          – dashesy
          Jan 5 '17 at 21:53
















        This worked perfectly for me! Thanks! :D
        – CharlesL
        Dec 6 '15 at 12:47




        This worked perfectly for me! Thanks! :D
        – CharlesL
        Dec 6 '15 at 12:47




        1




        1




        @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
        – hexafraction
        Dec 6 '15 at 13:28




        @CharlesL Not a problem! Note that this answer is community wiki, and the solution was initially found by the author of the question, so I can't take credit for it. All I did was edit and reorganize to move it into an answer.
        – hexafraction
        Dec 6 '15 at 13:28












        I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
        – fadden
        Nov 27 '16 at 16:20




        I had some trouble with this one (14.04 to 16.04). "gcc-doc" didn't work. The error message showed /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb, and the tools reject '%' in the name, so the full name didn't work either. I ended up removing files until it was happy -- see ubuntuforums.org/showthread.php?t=2321414&page=2 .
        – fadden
        Nov 27 '16 at 16:20




        1




        1




        I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
        – dashesy
        Jan 5 '17 at 21:53




        I had to use a combination of --force-remove-reinstreq and --purge --force-depends when cpp-5 somehow had broken dependency problems.
        – dashesy
        Jan 5 '17 at 21:53












        up vote
        62
        down vote













        This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04



        sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
        sudo dpkg --remove --force-remove-reinstreq <packagename>
        sudo apt-get remove <packagename>
        sudo apt-get autoremove && sudo apt-get autoclean





        share|improve this answer



















        • 2




          Finally! This did the trick when dpkg and apt won't remove or reinstall a package
          – abaelter
          Mar 12 '15 at 7:51








        • 1




          Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
          – Ryan H.
          May 1 '15 at 7:43






        • 1




          The only true answer which works any time.
          – twicejr
          May 20 '16 at 12:26






        • 1




          it's working for me, thank you very much!
          – Chu-Siang Lai
          Sep 3 '16 at 5:09






        • 1




          This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
          – Charphacy
          Aug 3 '17 at 0:39















        up vote
        62
        down vote













        This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04



        sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
        sudo dpkg --remove --force-remove-reinstreq <packagename>
        sudo apt-get remove <packagename>
        sudo apt-get autoremove && sudo apt-get autoclean





        share|improve this answer



















        • 2




          Finally! This did the trick when dpkg and apt won't remove or reinstall a package
          – abaelter
          Mar 12 '15 at 7:51








        • 1




          Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
          – Ryan H.
          May 1 '15 at 7:43






        • 1




          The only true answer which works any time.
          – twicejr
          May 20 '16 at 12:26






        • 1




          it's working for me, thank you very much!
          – Chu-Siang Lai
          Sep 3 '16 at 5:09






        • 1




          This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
          – Charphacy
          Aug 3 '17 at 0:39













        up vote
        62
        down vote










        up vote
        62
        down vote









        This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04



        sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
        sudo dpkg --remove --force-remove-reinstreq <packagename>
        sudo apt-get remove <packagename>
        sudo apt-get autoremove && sudo apt-get autoclean





        share|improve this answer














        This worked for me after pretty much scouring the whole of AskUbuntu and Ubuntu forums! (Source). I'm running Lubuntu 14.04



        sudo mv /var/lib/dpkg/info/<packagename>.* /tmp/
        sudo dpkg --remove --force-remove-reinstreq <packagename>
        sudo apt-get remove <packagename>
        sudo apt-get autoremove && sudo apt-get autoclean






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 7 '14 at 22:40









        Alvar

        11.5k2678126




        11.5k2678126










        answered Aug 13 '14 at 16:06









        Hamman Samuel

        729711




        729711








        • 2




          Finally! This did the trick when dpkg and apt won't remove or reinstall a package
          – abaelter
          Mar 12 '15 at 7:51








        • 1




          Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
          – Ryan H.
          May 1 '15 at 7:43






        • 1




          The only true answer which works any time.
          – twicejr
          May 20 '16 at 12:26






        • 1




          it's working for me, thank you very much!
          – Chu-Siang Lai
          Sep 3 '16 at 5:09






        • 1




          This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
          – Charphacy
          Aug 3 '17 at 0:39














        • 2




          Finally! This did the trick when dpkg and apt won't remove or reinstall a package
          – abaelter
          Mar 12 '15 at 7:51








        • 1




          Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
          – Ryan H.
          May 1 '15 at 7:43






        • 1




          The only true answer which works any time.
          – twicejr
          May 20 '16 at 12:26






        • 1




          it's working for me, thank you very much!
          – Chu-Siang Lai
          Sep 3 '16 at 5:09






        • 1




          This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
          – Charphacy
          Aug 3 '17 at 0:39








        2




        2




        Finally! This did the trick when dpkg and apt won't remove or reinstall a package
        – abaelter
        Mar 12 '15 at 7:51






        Finally! This did the trick when dpkg and apt won't remove or reinstall a package
        – abaelter
        Mar 12 '15 at 7:51






        1




        1




        Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
        – Ryan H.
        May 1 '15 at 7:43




        Thanks. This saved me BIG TIME! I tried skipping the last line, followed by a apt-get install... and had to start over and do ALL four lines, then I could finally purge my package. :)
        – Ryan H.
        May 1 '15 at 7:43




        1




        1




        The only true answer which works any time.
        – twicejr
        May 20 '16 at 12:26




        The only true answer which works any time.
        – twicejr
        May 20 '16 at 12:26




        1




        1




        it's working for me, thank you very much!
        – Chu-Siang Lai
        Sep 3 '16 at 5:09




        it's working for me, thank you very much!
        – Chu-Siang Lai
        Sep 3 '16 at 5:09




        1




        1




        This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
        – Charphacy
        Aug 3 '17 at 0:39




        This helped when I had problems with gcc-doc and cpp-doc after an upgrade from 14.04. I had more recent tools install from ppa:ubuntu-toolchain-r/test and they screwed everything up. Moral of the story, purge ppas before upgrading to a new release. But this tip helped me in fixing the mess afterwards.
        – Charphacy
        Aug 3 '17 at 0:39










        up vote
        9
        down vote













        I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.



        sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>


        Then I had to reinstall them



        sudo apt-get -f install


        That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.






        share|improve this answer

















        • 1




          I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
          – Igor G.
          Jan 30 '17 at 21:34















        up vote
        9
        down vote













        I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.



        sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>


        Then I had to reinstall them



        sudo apt-get -f install


        That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.






        share|improve this answer

















        • 1




          I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
          – Igor G.
          Jan 30 '17 at 21:34













        up vote
        9
        down vote










        up vote
        9
        down vote









        I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.



        sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>


        Then I had to reinstall them



        sudo apt-get -f install


        That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.






        share|improve this answer












        I had a situation worse than this. I had to remove the half-installed packages by forcing dependencies.



        sudo dpkg --remove --force-remove-reinstreq --force-depends <package-name>


        Then I had to reinstall them



        sudo apt-get -f install


        That should solve any issue. But please make sure you have network connectivity when you try to do this. Otherwise, you will have to go through even more trouble.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 1 '13 at 18:23









        Sriram Murali

        25425




        25425








        • 1




          I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
          – Igor G.
          Jan 30 '17 at 21:34














        • 1




          I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
          – Igor G.
          Jan 30 '17 at 21:34








        1




        1




        I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
        – Igor G.
        Jan 30 '17 at 21:34




        I get an error: dpkg: error processing package debconf (--configure): package is in a very bad inconsistent state; you should reinstall it before attempting configuration Errors were encountered while processing: debconf
        – Igor G.
        Jan 30 '17 at 21:34










        up vote
        7
        down vote













        The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:



        sudo apt-get install -f --reinstall zramswap-enabler





        share|improve this answer



























          up vote
          7
          down vote













          The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:



          sudo apt-get install -f --reinstall zramswap-enabler





          share|improve this answer

























            up vote
            7
            down vote










            up vote
            7
            down vote









            The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:



            sudo apt-get install -f --reinstall zramswap-enabler





            share|improve this answer














            The other answers are correct to mention a package removal followed by apt-get install -f to reinstall the broken package (and fully install other half-installed packages). However, this can be done in one step:



            sudo apt-get install -f --reinstall zramswap-enabler






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 4 at 17:54

























            answered Feb 22 '17 at 13:22









            David Foerster

            27.6k1364109




            27.6k1364109






















                up vote
                2
                down vote













                i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:



                apt-get autoclean
                apt-get update
                apt-get upgrade
                apt-get install -f


                much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)






                share|improve this answer





















                • This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                  – Igor G.
                  Jan 30 '17 at 21:36






                • 1




                  I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                  – Dr. Azrael Tod
                  Feb 1 '17 at 8:57

















                up vote
                2
                down vote













                i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:



                apt-get autoclean
                apt-get update
                apt-get upgrade
                apt-get install -f


                much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)






                share|improve this answer





















                • This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                  – Igor G.
                  Jan 30 '17 at 21:36






                • 1




                  I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                  – Dr. Azrael Tod
                  Feb 1 '17 at 8:57















                up vote
                2
                down vote










                up vote
                2
                down vote









                i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:



                apt-get autoclean
                apt-get update
                apt-get upgrade
                apt-get install -f


                much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)






                share|improve this answer












                i'd try cleaning the status of my installation before resorting to uninstalling whatever created the problem:



                apt-get autoclean
                apt-get update
                apt-get upgrade
                apt-get install -f


                much better way to solve this in most cases and in at least one instance had helped me when the other way wouldn't work (because huge dependencies on the package to be removed)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 18 '15 at 4:44









                Dr. Azrael Tod

                293




                293












                • This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                  – Igor G.
                  Jan 30 '17 at 21:36






                • 1




                  I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                  – Dr. Azrael Tod
                  Feb 1 '17 at 8:57




















                • This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                  – Igor G.
                  Jan 30 '17 at 21:36






                • 1




                  I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                  – Dr. Azrael Tod
                  Feb 1 '17 at 8:57


















                This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                – Igor G.
                Jan 30 '17 at 21:36




                This yields an error: sh: 0: getcwd() failed: No such file or directory /bin/sh: 1: /usr/sbin/dpkg-preconfigure: Permission denied
                – Igor G.
                Jan 30 '17 at 21:36




                1




                1




                I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                – Dr. Azrael Tod
                Feb 1 '17 at 8:57






                I'd guess you did this from an non-admin account. Try prefixing each line with sudo or completely login as root (i.e. with: "sudo su" and your password or "su" and the admin-password)
                – Dr. Azrael Tod
                Feb 1 '17 at 8:57












                up vote
                1
                down vote













                I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:



                # apt-get install -f  
                <some output ommited>
                dpkg: warning: overriding problem because --force enabled:
                Package is in a very bad inconsistent state - you should
                reinstall it before attempting a removal.

                wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
                dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb


                Now its ok again:



                #apt-get install -f
                Reading package lists... Done
                Building dependency tree
                Reading state information... Done
                0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.





                share|improve this answer

























                  up vote
                  1
                  down vote













                  I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:



                  # apt-get install -f  
                  <some output ommited>
                  dpkg: warning: overriding problem because --force enabled:
                  Package is in a very bad inconsistent state - you should
                  reinstall it before attempting a removal.

                  wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
                  dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb


                  Now its ok again:



                  #apt-get install -f
                  Reading package lists... Done
                  Building dependency tree
                  Reading state information... Done
                  0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.





                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:



                    # apt-get install -f  
                    <some output ommited>
                    dpkg: warning: overriding problem because --force enabled:
                    Package is in a very bad inconsistent state - you should
                    reinstall it before attempting a removal.

                    wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
                    dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb


                    Now its ok again:



                    #apt-get install -f
                    Reading package lists... Done
                    Building dependency tree
                    Reading state information... Done
                    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.





                    share|improve this answer












                    I had similar problem with quagga, the routing daemon. Just reinstaling the package worked for me:



                    # apt-get install -f  
                    <some output ommited>
                    dpkg: warning: overriding problem because --force enabled:
                    Package is in a very bad inconsistent state - you should
                    reinstall it before attempting a removal.

                    wget http://security.debian.org/debian-security/pool/updates/main/q/quagga/quagga_0.99.22.4-1+wheezy3_i386.deb
                    dpkg -i quagga_0.99.22.4-1+wheezy3_i386.deb


                    Now its ok again:



                    #apt-get install -f
                    Reading package lists... Done
                    Building dependency tree
                    Reading state information... Done
                    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 14 '16 at 12:33









                    locutus

                    111




                    111






















                        up vote
                        1
                        down vote













                        The same thing happened to me when I got disconnected from the internet while downloading 'wireshark' package. After that when I tried to reinstall it, it threw the same error 'package is in a very bad inconsistent state'. I've tried all the commands to install, purge, remove and reinstall but nothing worked.
                        After a little bit of googling, I stumbled upon a command



                        sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb



                        (change libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with whatever package is creating problem, in the directory /var/cache/apt/archives/).



                        After all the issues were resolved. I removed the package again using



                        sudo apt --purge remove libwireshark8:amd64
                        sudo apt autoremove to fully remove the package.



                        After that, I installed wireshark again using: sudo apt-get install wireshark.

                        Everything works smoothly now!



                        Rferences:
                        How To Solve ”Sub process usr bin dpkg returned an error code 1″ Error?
                        Fix dpkg error






                        share|improve this answer



























                          up vote
                          1
                          down vote













                          The same thing happened to me when I got disconnected from the internet while downloading 'wireshark' package. After that when I tried to reinstall it, it threw the same error 'package is in a very bad inconsistent state'. I've tried all the commands to install, purge, remove and reinstall but nothing worked.
                          After a little bit of googling, I stumbled upon a command



                          sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb



                          (change libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with whatever package is creating problem, in the directory /var/cache/apt/archives/).



                          After all the issues were resolved. I removed the package again using



                          sudo apt --purge remove libwireshark8:amd64
                          sudo apt autoremove to fully remove the package.



                          After that, I installed wireshark again using: sudo apt-get install wireshark.

                          Everything works smoothly now!



                          Rferences:
                          How To Solve ”Sub process usr bin dpkg returned an error code 1″ Error?
                          Fix dpkg error






                          share|improve this answer

























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            The same thing happened to me when I got disconnected from the internet while downloading 'wireshark' package. After that when I tried to reinstall it, it threw the same error 'package is in a very bad inconsistent state'. I've tried all the commands to install, purge, remove and reinstall but nothing worked.
                            After a little bit of googling, I stumbled upon a command



                            sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb



                            (change libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with whatever package is creating problem, in the directory /var/cache/apt/archives/).



                            After all the issues were resolved. I removed the package again using



                            sudo apt --purge remove libwireshark8:amd64
                            sudo apt autoremove to fully remove the package.



                            After that, I installed wireshark again using: sudo apt-get install wireshark.

                            Everything works smoothly now!



                            Rferences:
                            How To Solve ”Sub process usr bin dpkg returned an error code 1″ Error?
                            Fix dpkg error






                            share|improve this answer














                            The same thing happened to me when I got disconnected from the internet while downloading 'wireshark' package. After that when I tried to reinstall it, it threw the same error 'package is in a very bad inconsistent state'. I've tried all the commands to install, purge, remove and reinstall but nothing worked.
                            After a little bit of googling, I stumbled upon a command



                            sudo dpkg -i --force-overwrite /var/cache/apt/archives/libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb



                            (change libwireshark8_2.2.6+g32dac6a-2ubuntu0.16.04_amd64.deb with whatever package is creating problem, in the directory /var/cache/apt/archives/).



                            After all the issues were resolved. I removed the package again using



                            sudo apt --purge remove libwireshark8:amd64
                            sudo apt autoremove to fully remove the package.



                            After that, I installed wireshark again using: sudo apt-get install wireshark.

                            Everything works smoothly now!



                            Rferences:
                            How To Solve ”Sub process usr bin dpkg returned an error code 1″ Error?
                            Fix dpkg error







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Apr 25 at 17:16

























                            answered Apr 25 at 17:09









                            Dark_Byt3

                            266




                            266






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f148715%2fhow-to-fix-package-is-in-a-very-bad-inconsistent-state-error%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                數位音樂下載

                                When can things happen in Etherscan, such as the picture below?

                                格利澤436b