Unable to uninstall package with error "Unable to locate package"

18,591
  • apt can only uninstall packages that where installed by apt or applications that use apt as a back-end like Ubuntu Software or Synaptic. The results of apt policy searchsploit snmp-check ssltrip thcping6 show that none of these 4 packages are from the default Ubuntu repositories. These packages were installed by Katoolin, which is a script that helps to install Kali Linux tools on Ubuntu and other Linux distributions. Katoolin adds its own repositories to Ubuntu's software sources, so it is possible that these 4 packages were installed by apt anyway, but Katoolin can also install packages from GitHub and other sources that do not always provide .deb files that apt can install in which case check this question: If I build a package from source how can I uninstall or remove completely?.

  • Even if a package was installed with apt, it can only be uninstalled by running a command which includes its exact package name. Package names in Ubuntu are case sensitive and pieces of package names are not interpreted by apt to be exact package names. However if you know a piece of a package's name, you can easily find the full package name by running a command like this:

     apt search ^rhythymb 
    

    This command returns packages that start with the string rhythmb, for example rhythmbox. Alternatively you can run a command like this:

    apt search "5.4.0-48.*"
    

    This command returns packages that contain the 5.4.0-48 string (a Linux kernel version) anywhere in their names.

  • Do not assume that any feature is provided by a package that has the same name as that feature. Multiple commands may be provided by the same package which has a different name than any of the programs and commands that it provides.

    However you can easily find the package name from the exact name of a command as follows. Here is an example using the xdg-open command which opens a file or URL in the user's preferred application .

      which xdg-open  
    

    The above command returns /usr/bin/xdg-open.

      dpkg -S /usr/bin/xdg-open  
    

    The above command returns xdg-utils: /usr/bin/xdg-open which shows that the xdg-open command is provided by the xdg-utils package.

Share:
18,591

Related videos on Youtube

Roman Kobzan
Author by

Roman Kobzan

Updated on September 18, 2022

Comments

  • Roman Kobzan
    Roman Kobzan almost 2 years

    I installed several Kali tools using the Katoolin script. After a while I tried to uninstall these tools, I was able to remove most of them but several apps won't uninstall using sudo apt-get remove <package name> command.

    I get: E: Unable to locate package <package name>.

    Also tried using sudo apt autoremove <package name> with same result.

    I'm assuming the actual package installed under a different name from the one I'm seeing in the Applications window. How can I remove these packages or find their actual name?

    • N0rbert
      N0rbert almost 6 years
      Are you really trying to install package named <package name>? I think it is placeholder for real package name. Check package names on packages.ubuntu.com.
    • Roman Kobzan
      Roman Kobzan almost 6 years
      I'm trying to uninstall several packages: 1. searchsploit 2. snmp-check 3. ssltrip 4. thcping6
    • N0rbert
      N0rbert almost 6 years
      Then please edit your question and place here all needed information for clarification. There is no searchsploit in Ubuntu repositories. So possibly off-topic.
    • karel
      karel almost 6 years
      @N0rbert He didn't install searchsploit from the Ubuntu repositories. He didn't installed searchsploit through a package manager called Katoolin. Katoolin is a script that helps to install Kali Linux tools on Ubuntu and other Linux distributions. Hover the mouse over the Katoolin tag below the question.
    • karel
      karel almost 6 years
      Read this Meta post Question about Katoolin is being close voted as off-topic because it's “not about Ubuntu”. This meta post is essential reading for every Katoolin question reviewer.