Love to have nmap on my #raspberrypi, but:

root@qwers:/home/pi# apt-get update
Hit:1 http://archive.raspberrypi.org/debian stretch InRelease
Hit:2 https://deb.nodesource.com/node_9.x stretch InRelease
Reading package lists... Done
root@qwers:/home/pi# apt-get install nmap
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nmap
  1. apt-cache search nmap has no result:
  2. and /etc/apt/sources.list: No such file or directory

Went trough these steps without any result: apt - "E: Unable to locate package update" when I try to update my system, why? - Ask Ubuntu

Ended up here to: Apt "could not find a distribution template" error - Ask Ubuntu with the result of:

aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch

2 Answers 2


Old question, but if anyone have the same problem, here is my solution:

I had the same problem not being able to find the repositories on just one of my Raspberry Pis. The solution was to add the following to /etc/dhcpcd.conf

static domain_name_servers=

These are Google's DNS IPs but you can change them to any valid DNS

After rebooting everything is great.


Raspbian - unable to locate package mysql-server-5.6 after adding repo - Raspberry Pi Stack Exchange led me to the solution after realized

  1. the /etc/apt/sources.list was a broken symlink to /etc/apt/sources.list.d/official-package-repositories.list
  2. solution: cp /etc/apt/sources.list.d/nodesource.list /etc/apt/sources.list
  3. then deb http://archive.raspbian.org/raspbian/ stretch main added to the list
  4. apt-get update
  5. apt-get install nmap
  6. Success
  • seems like the issue is that your /etc/apt/sources.list file was missing/corrupt/compelte garbage ... changing that file to be the node source list is not really a solution - because now you have no way to update raspbian ... also, /etc/apt/sources.list.d/nodesource.list is not part of the standard raspbian distro. Clearly when you configured your system to access node repositories, you messed things up badly! Jun 12, 2018 at 0:06
  • 2
    This is an absolutely horrible answer Jun 12, 2018 at 12:58
  • raspbian updating well after this.. what can be the solution then @JaromandaX
    – eapo
    Jun 13, 2018 at 2:59
  • Is it? You must have an odd setup in /etc/apt Jun 13, 2018 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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