Suppose I download a .deb package from a website and install it. (I assume that when I double click the .deb file, the package is installed through a GUI that interfaces with dpkg right?)
How can I uninstall it?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityManually installed packages appear in the Software Centre, along with all the others. Just search the software centre for your package and remove it there.
You may have to click on "Show N technical items"
Along with this, there are a few other methods:
Synaptic:
Click the Apply button.
This will have the benefit of listing all of your manually installed packages:
Command Line
You can either use sudo apt-get remove packagename
if you know the name of the package, or if you don't, search for it using apt-cache search crazy-app
and then remove it using apt get
You can also use dpkg --remove packagename
.
This will also let you know if there are any unneeded packages left on your system, which were possibly installed as dependencies of your .deb package. Use sudo apt-get autoremove
to get rid of them.
aerofs-installer-0
(aerofs.com) did not appear in U.S.C., only in the command line and in synaptic. Any idea why?
Oct 20, 2013 at 5:51
To remove package_name
, use dpkg
with the -r
(or --remove
) flag:
sudo dpkg -r package_name
If you have to force-remove it, add --force-all
:
sudo dpkg -r --force-all pkg_name
Use -P
(or --purge
) instead of -r
if you want to remove the configuration files as well.
Every solution here assumes you know or can find the name of the package, but none provide how to remove a package if all you have is the deb. To that end, the below command will extract the package name from the deb and remove that package name.
dpkg -r $(dpkg -f your-file-here.deb Package)
NB: this does not confirm that the package being removed is the exact version described by the deb - be careful.
for PPP in *.deb ; do sudo dpkg -r $(dpkg -f "$PPP" Package) ; done
Open up Ubuntu Software Center (Applications -> Ubuntu Software Center) and search for the package you want to uninstall, and click on the Remove button:
Or from the command line:
sudo apt-get remove <package-name>
If your want to remove the package and all configuration files related to it:
sudo aptitude purge packagename
apt-get -y
Potentially Dangerous:Although it's true that- sans GUI- our choices are:
Where dpkg
can be executed from a script without the equivalent of a " -y " switch, apt
requires this to avoid user input. The consequences are that apt
could automatically resolve package dependencies and remove packages other than the target supplied to the command.
apt
:Note when I remove iptables that lxd and ufw also removed. But what if I didn't want lxd removed? Well, it's gone now:
apt-get -y purge iptables
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
iptables* lxd* ubuntu-standard* ufw*
0 upgraded, 0 newly installed, 4 to remove and 54 not upgraded.
After this operation, 23.2 MB disk space will be freed.
(Reading database ... 90906 files and directories currently installed.)
Removing ubuntu-standard (1.417.3) ...
Removing ufw (0.36-0ubuntu0.18.04.1) ...
Skip stopping firewall: ufw (not enabled)
Removing lxd (3.0.3-0ubuntu1~18.04.1) ...
Removing lxd dnsmasq configuration
Removing iptables (1.6.1-2ubuntu2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
(Reading database ... 90627 files and directories currently installed.)
Purging configuration files for ufw (0.36-0ubuntu0.18.04.1) ...
Purging configuration files for lxd (3.0.3-0ubuntu1~18.04.1) ...
Processing triggers for systemd (237-3ubuntu10.38) ...
Processing triggers for rsyslog (8.32.0-1ubuntu4) ...
Processing triggers for ureadahead (0.100.0-21) ...
dpkg
:Note dpkg
stops me from potentially altering the system in an unintended way if I were to use it in a scripted execution and refusing to remove both ufw and lxd:
dpkg -r iptables
dpkg: dependency problems prevent removal of iptables:
lxd depends on iptables.
ufw depends on iptables.
dpkg: error processing package iptables (--remove):
dependency problems - not removing
Errors were encountered while processing:
iptables
So although it's true we like to ensure our scripts complete successfully and not exit in error, it might be desirable for a script to fail than complete by modifying the system outside of the target of the command. Such a use-case makes dpkg -r
more desirable for scripted execution.
You can use the remove and force flags:
$ sudo dpkg -r --force-all pkg_name
Alternatively, if you installed it through Ubuntu Package Manager, you can remove it with apt:
$ sudo apt remove --purge pgk_name
Here is a user-friendly approach if you still got the .deb:
The installed package will be visible in both Synaptics and software center. In the former one, it will appear under local packages and in the latter one under other.
obviously, You can use the remove and force flags:
sudo dpkg -r --force-all 'some_bad_package'
but in very many cases that won't help at all. Neither will it help in case of dpkg breakage to try any of the GUI tools like synaptic or even worse ones, since they all depend on dpkg . This is because dpkg is very opinionated on those often-occurring errors, leaving many users marooned. Here is an example where a .deb was sideloaded and Ubuntu does not offer a GUI way nor CLI way to solve the problem:
LANG=en sudo dpkg --purge 'brmfc7440nlpr:i386'
dpkg: error processing package brmfc7440nlpr:i386 (--purge): package is in a very bad inconsistent state; you should reinstall it before attempting a removal Errors were encountered while processing: brmfc7440nlpr:i386
And yes, the lead to "reinstall it before attempting..." is of course utterly futile and redundant, since it just runs into the same error with another flavour.
And yes, adding " --force-all " just is as futile as without, obviously.
This already will lead many users to reinstall Ubuntu in hopes of betterment, taking many, many hours of extra work. The package from the real-world example above is a laserprinter (lpr) driver for a brother MFC model 7440N.
First, check the application that you want to uninstall with below command.
find /usr/share/applications -maxdepth 1 -type f -exec basename {} .desktop \; | sort
Once you find the application name in the above list, run the below command
sudo apt remove your_application_name