6

I've tried to install android-studio via apt-get in Ubuntu and find that a dependency package with a size of 233 M is required to download from Google. Since I'm in China the network condition is so bad that I cannot download the package completely, and finally I have to give up.
However here comes a problem: now every time I execute apt-get I will get a hint of Incomplete dependency and be asked to download the package above. If I execute sudo apt-get remove android-studio an error will occur:

dpkg: error processing package android-studio (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
An error occurred when processing:
android-studio
E: Sub-process /usr/bin/dpkg returned an error code (1)

My apt-get was stuck. So how can I remove an incomplete package entirely?

hsfzxjy
  • 1,242
  • 4
  • 14
  • 22

2 Answers2

20

Try running following commands on the terminal:

sudo apt-get autoremove
sudo apt-get --purge remove
sudo dpkg --remove --force-remove-reinstreq tspc
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get -f install

These may clear or fix broken packages and try to install again.

x4h1d
  • 6,042
  • 1
  • 31
  • 46
  • As I executed `sudo apt-get autoremove` it told me that "A package will be upgrade: android-studio" and began to download. But as I've told above my network condition does not allow me to download such a enormous file from Google. So is there any other solutions without requiring to fix the dependencies? – hsfzxjy Dec 13 '14 at 05:05
  • 1
    can you please try to execute third command first to remove broken package? let me know what you got. – x4h1d Dec 13 '14 at 05:08
  • Now it've been removed. Thank you very much! – hsfzxjy Dec 13 '14 at 05:12
  • How to check if it has been removed or not? – MrObjectOriented Dec 12 '17 at 08:27
  • sudo apt-get -f install will try to insteall the damn thing, not remove it. – TheNegative Feb 17 '20 at 23:07
4

Open synaptic Install synaptic. Then go to status and choose Broken. Then remove completely the broken packages.

Santosh
  • 141
  • 1
  • 6