Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Whenever I type into the terminal the command:

sudo dpkg -r '/home/brentonhorne/Downloads/virtualbox.deb'

I receive the error:

dpkg: error: --remove needs a valid package name but '/home/brentonhorne/Downloads/virtualbox.deb' is not: illegal package name in specifier '/home/brentonhorne/Downloads/virtualbox.deb': must start with an alphanumeric character

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;

Options marked [*] produce a lot of output - pipe it through `less' or `more' !

How do I get around this problem?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You're not supposed to pass a deb file to dpkg -r. You should specify only package names to be removed. Once you've install a deb file, information about it is included in dpkg database (/var/lib/dpkg/), and you can use dpkg -r package-name or apt-get remove package-name.

Try:

sudo dpkg -r virtualbox-4.1

or

sudo apt-get remove virtualbox-4.1

Replace "4.1" with the actual VirtualBox version.

share|improve this answer
    
OK, but this is a deb file not provided in the software centre, this is one I downloaded from the net. I ran it (your code) and it failed –  Brenton Horne Dec 15 '12 at 16:02
    
It doesn't matter. dpkg -i takes a full filename. dpkg -r takes the package name. For example, if you had a package called foo_bar_0.2-0ubuntu1.deb, "dpkg -i foo_bar_0.2-0ubuntu1.deb" and "dpkg -r foo_bar". –  mfisch Dec 15 '12 at 16:04
    
Once you've install a deb file, information about it is included in dpkg database. You should remove ANY package using dpkg -r or apt-get remove. –  Eric Carvalho Dec 15 '12 at 16:05
    
Oh it seems it did work earlier when I removed virtualbox when I installed it by means of the software centre so thanks I'll accept your answer. –  Brenton Horne Dec 15 '12 at 16:08
1  
@BrentonHorne VirtualBox's package names includes version numbers so you have to specify it, like: dpkg -r virtualbox-4.1. Run dpkg -l | grep virtualbox to check the exact package name. –  Eric Carvalho Dec 15 '12 at 16:14
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.