2

I installed youtube-dl_2015.06.04.1-1~webupd8~trusty0_all.deb in my system.

It is not properly installed and I want to remove this package from my system. I am using the command below to remove this package.

I am getting following error.

$ sudo dpkg --purge youtube-dl_2015.06.04.1-1~webupd8~trusty0_all.deb   
    dpkg: error: --purge needs a valid package name but 'youtube-dl_2015.06.04.1-1~webupd8~trusty0_all.deb' is not: illegal package name in specifier 'youtube-dl_2015.06.04.1-1~webupd8~trusty0_all.deb': character `~' not allowed (only letters, digits and characters `-+._')

I also tried with below command

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

How can I remove this?

Volker Siegel
  • 13,065
  • 5
  • 49
  • 65
  • Try sudo dpkg -r <Package_name> – Mitch Jun 11 '15 at 18:00
  • @VolkerSiegel It is not strange. Just a long package version. All deb files have 2 underscores ;-) – Pilot6 Jun 11 '15 at 19:01
  • @VolkerSiegel - fairly standard - it is sourced from the webupd8 PPA (see article here) – Wilf Jun 11 '15 at 19:04
  • @Pilot6 Oh, sorry, now I got it - was confused - I assumed the package is an alternative build of youtube-dl with a changed package name youtube-dl_... - I do not see deb file names often; and in my world, the underscore is by definition a name character... Learnded... thanks! – Volker Siegel Jun 11 '15 at 19:20

3 Answers3

7

Removing of packages is done by a package name, not by file name.

You can remove it by

 sudo dpkg --purge youtube-dl

This command will also remove configuration files of that package.

Just to remove the package and leave configs, run

sudo dpkg -r youtube-dl

If you deleted some files of the package manually, you can get an error messaage

package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: youtube-dl

In this case re-install it again and then remove

 sudo dpkg -i youtube-dl_2015.06.04.1-1~webupd8~trusty0_all.deb
 sudo dpkg -r youtube-dl

And in the future never delete any files installed by deb packages!

This can break the whole system

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • Why not? If OP wants to purge with configs. – Pilot6 Jun 11 '15 at 18:01
  • I gave both ways. But generally to completely remove "purge" is better. – Pilot6 Jun 11 '15 at 18:04
  • Thanks for your response, I tried with both command,I am getting below error sudo dpkg --purge youtube-dl [sudo] password for dharmendra: dpkg: error processing package youtube-dl (--purge): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: youtube-dl – dharmendra Jun 11 '15 at 18:11
  • Please add it to your question and I will update the answer. – Pilot6 Jun 11 '15 at 18:15
0

I've had the same problem. To get the package name from the .deb file run:

dpkg --info file.deb | grep Package

It will output something like:

Package: packageName-x.y

This is the name of the package. To remove it:

dpkg -r packageName-x.y
xdola
  • 180
0

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo dpkg -r --force <Package_name>

Then try:

sudo dpkg --configure -a
sudo apt-get -f install
Mitch
  • 107,631