8

I'm kind of new to Ubuntu. A couple of days ago, I upgraded to 16.04 from 14.04. After the upgrade, I can neither install new software nor upgrade OS. When I enter

 sudo apt-get upgrade

I get this is my output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  apt apt-transport-https apt-utils gcc-doc libapt-inst2.0 libapt-pkg5.0 
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2.011 kB/2.014 kB of archives.
After this operation, 6.144 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 libapt-pkg5.0 amd64 1.2.12~ubuntu16.04.1 [696 kB]
Get:2 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 libapt-inst2.0 amd64 1.2.12~ubuntu16.04.1 [55,4 kB]
Get:3 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt amd64 1.2.12~ubuntu16.04.1 [1.038 kB]
Get:4 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt-utils amd64 1.2.12~ubuntu16.04.1 [196 kB]
Get:5 http://mirror.ni.net.tr/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.12~ubuntu16.04.1 [25,7 kB]
Fetched 2.011 kB in 2s (859 kB/s)         
(Reading database ... 325999 files and directories currently installed.)
Preparing to unpack .../gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb ...
install-info: No dir file specified; try --help for more information.
dpkg: warning: subprocess old pre-removal script returned error exit         status 1
dpkg: trying script from the new package instead ...
dpkg: error processing archive /var/cache/apt/archives/gcc-    doc_4%3a5.3.1-1ubuntu1_amd64.deb (--unpack):
 there is no script in the new version of the package - giving up
install-info: No dir file specified; try --help for more information.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit     status 1
Preparing to unpack .../libapt-pkg5.0_1.2.12~ubuntu16.04.1_amd64.deb     ...
Unpacking libapt-pkg5.0:amd64 (1.2.12~ubuntu16.04.1) over     (1.2.10ubuntu1)     ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Using the error code below I searched for solutions in the AskUbuntu but couldn't find one that works.

 Errors were encountered while processing:
 /var/cache/apt/archives/gcc-doc_4%3a5.3.1-1ubuntu1_amd64.deb
 E: Sub-process /usr/bin/dpkg returned an error code (1)

I have gcc-doc waiting to be upgraded in the Software Center. When I try to upgrade it on Software Center it takes forever and there is no upgrade. In Synaptics it halts the upgrade because of gcc-doc.

Thanks a lot for the help in advance.

4
  • Can you try changing download location to Main server from Software & Updates and then executing: sudo apt-get update and sudo apt-get dist-upgrade (maybe dist-upgraded fixes some dependencies, I don't know...). Jun 1, 2016 at 14:39
  • I did what you said. First I got this qwq@qwq-X202E:~$ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: apt-utils : Depends: apt (= 1.2.10ubuntu1) but 1.2.12~ubuntu16.04.1 is installed E: Unmet dependencies. Try using -f. with -f i get the previous error
    – Silenciooo
    Jun 1, 2016 at 15:10
  • Looks like the pre-removal script of gcc-doc is broken. What happens when you run sudo dpkg -r --force-depends gcc-doc? Jun 2, 2016 at 9:23
  • @DavidFoerster: You get dpkg: error processing package gcc-doc (--remove): package is in a very bad inconsistent state; you should reinstall it before attempting a removal.
    – fadden
    Nov 27, 2016 at 16:10

1 Answer 1

5

I had the same problem here. Then after googling, I found solution (i hope) on How to fix "Package is in a very bad inconsistent state" error?

Run:

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
2
  • 1
    If your answer is essentially a referral to another question, it would be better to flag this question as a duplicate of the other (with the [flag] button below this one). Jun 22, 2016 at 7:54
  • This may be a duplicate, but the cite is to one of multiple answers offered to the other question. Nothing distinguishes this answer form the others - BUT this answer worked for me. I suggest that the OPs for this question and the other one mark this answer as accepted or otherwise mark it as useful.
    – user96
    Jun 19, 2018 at 16:08

Not the answer you're looking for? Browse other questions tagged .