How to implement package install suggestion on Debian?
The reason that installing command-not-found
did not start providing suggestions for non-installed packages was that I had missed a small notification from dpkg as part of the install.
One is supposed to run the command update-command-not-found
immediately after running apt-get install command-not-found
. In fact dpkg prompts for running this command.
The debian package seems to be incomplete. The README says that you should source /etc/bash_command_not_found
in your .bashrc
. Strangely that file is not included in the package.
The debian command-not-found
package is based on the ubuntu package. The ubuntu package seems to be more complete in that regard.
Content of the ubuntu version of bash_command_not_found:
command_not_found_handle() {
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
else
return 127
fi
}
Add those lines to your ~/.bashrc
(or /etc/bash.bashrc
) and the command-not-found
feature should work.
I solve this problem by:
First install command-not-found
sudo apt update
sudo apt install command-not-found
After that
sudo update-command-not-found
sudo apt update