1

I have installed emacs with apt-get. I tried to remove it later on, but the binary is left.

root@ionian:/home/gauthier# apt-get --purge remove emacs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'emacs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ionian:/home/gauthier# which emacs
/usr/bin/emacs
root@ionian:/home/gauthier# 

(the purge shown above is not the first attempt, this is just to show that the package was already removed.)

emacs was not installed before I did apt-get install emacs.

Any idea what is going on? Why doesn't apt-get see the binary, why does it think emacs is already uninstalled? What would have been a clean way to uninstall emacs completely?

13
  • What happens if you run dpkg -S /usr/bin/emacs?
    – Joseph R.
    Jul 24, 2013 at 21:35
  • Packages own files but files do not belong to packages. A system usually determines whether or not a package is installed by looking at a database, not by looking for the files the package would own.
    – user26112
    Jul 24, 2013 at 21:37
  • dpkg-query: no path found matching pattern /usr/bin/emacs
    – Gauthier
    Jul 24, 2013 at 21:37
  • @EvanTeitelman: ok, but then why didn't my first attempt of purge clean the binary? Unfortunately I don't have the result of the (most) successful purge anymore.
    – Gauthier
    Jul 24, 2013 at 21:41
  • ...and file $(which emacs)?
    – Joseph R.
    Jul 24, 2013 at 21:41

2 Answers 2

5

Removing "emacs" do not clean /usr/bin/emacs because the latter is not provided by "emacs" package.

On Debian there are different flavours of emacs so /usr/bin/emacs is a symlink to particular executable that is used by default. You can choose which application to use by running command:

sudo update-alternatives --config emacs

Also package "galternatives" provides nice GUI application to manage alternatives.

If you run aptitude show emacs you may see that "emacs" is a metapackage which merely depends on some other packages that provide emacs executable. When you purged "emacs" it was fully uninstalled but its dependency package(s) may be still present on your system. You can remove them with

sudo apt-get autoremove

or if you use aptitude it will automatically suggest to remove automatically installed packages.

To get rid of /usr/bin/emacs you will have to uninstall all emacs alternatives such as "emacs23" or "emacs24" or any "emacs-*" packages.

Run the following command to find which executables are available as emacs alternatives

update-alternatives --list emacs

Also you may find dlocate utility useful to find which package provides a particular file.

Read more about alternatives in

1
  • Thanks for this. I remember that some kind of lucid flavour left, although I did run autoremove. This is what I don't understand, autoremove did not seem to remove all dependencies.
    – Gauthier
    Jul 27, 2013 at 12:48
0

You may still have emacs23 and friends installed.

sudo apt-get remove emacs*

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .