Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove an incomplete package by using apt-get? [closed]

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?

like image 266
hsfzxjy Avatar asked Dec 03 '22 18:12

hsfzxjy


2 Answers

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.

like image 131
x4h1d Avatar answered Dec 05 '22 08:12

x4h1d


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

like image 41
Santosh Avatar answered Dec 05 '22 07:12

Santosh