5

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.

9

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

Run:

apt update
update-command-not-found
  • 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. :) – Quasimodo's clone Jul 23 '17 at 20:45
  • 2
    Actually, it was the apt update command that did the trick. Editing the sources.list was likely incorrect. – Nonny Moose Apr 19 '18 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... – Adam Plocher May 16 '18 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. – Quasimodo's clone May 26 '18 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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