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

Solution 1:

  • 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.