I have set up two Debian Stretch systems, one new installation by 'netinst' CD, one upgraded from Jessie.

After that, I have installed the command-not-found package.

apt install command-not-found

The installation ran smoothly, with neither errors nor warnings. As suggested in the installation process output, I ran update-command-not-found subsequently. This command does not give any output at all and returns with exit code 0 - no errors.

However, when I type some non-existing command, I get an error nevertheless:

Could not find the database of available applications, run update-command-not-found as root to fix this
foobarbaz: command not found

This happens on both systems. I have no clue how to fix this issue. What have I missed?

UPDATE: For some reason update-command-not-found worked on my local system just now. It shows some download URLs fetching data from. Now, the console works as expected. I did nothing since this morning, the system had gone in sleep mode while I was absent.

On the remote system the issue is remaining.

1 Answer 1


The solution:

There were wrong entries in the /etc/apt/sources.list file. The package needs to be updated via the update repository. There has been a wrong entry derived from the provider's local Jessie mirror repository. I have changed the URLs to the original Stretch reporitory but missed to replace a slash by a dash (stretch/updates => stretch-updates).

Add to file /etc/apt/sources.list:

# stretch-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stretch-updates main contrib non-free


apt update
  • 2
    The interesting thing is: You can spend hours or days without finding an answer. Just after posting a question you get the sudden inspiration. :) Commented Jul 23, 2017 at 20:45
  • 3
    Actually, it was the apt update command that did the trick. Editing the sources.list was likely incorrect. Commented Apr 19, 2018 at 12:57
  • Indeed the apt update was the important key step I was missing. It's funny, I run that almost religiously every few days, but I didn't think to do it after installing command-not-found until I read this. It would be nice if the little helper message that says "run update-command-not-found" also mentioned updating your apt repos... or perhaps the update-cnf command just did it for you... Commented May 16, 2018 at 23:56
  • @NonnyMoose Actually there had been remaining incorrect entries in the sources.list. I routinely updated the repositories every time before changing any package installation. The differences between the local network mirror storage and public repositories caused the error in that case. Commented May 26, 2018 at 3:30
  • Asked for sudo here, sudo apt-file update; sudo update-command-not-found Commented Jul 27, 2021 at 4:36

You must log in to answer this question.

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