So the latest version doesn't have the same error message (with "cnf" variable being unbound) but it still doesn't fail gracefully when the database is not available.
Instead of asking to file bug reports, it should tell them to run "apt update". This bad behaviour is now generating quite some noise in the Debian bug tracker because we have enabled command-not-found in Kali and when they get it installed during upgrade (as opposed to during a fresh installation), the database is not created during the same apt run and they get this error message when they run a missing command: > $ lsio > > Sorry, command-not-found has crashed! Please file a bug report at: > http://www.debian.org/Bugs/Reporting > Please include the following information with the report: > > command-not-found version: 0.3 > Python version: 3.9.2 final 0 > Distributor ID: Kali > Description: Kali GNU/Linux Rolling > Release: 2021.1 > Codename: kali-rolling > Exception information: > > unable to open database file > Traceback (most recent call last): > File "/usr/share/command-not-found/CommandNotFound/util.py", line 23, in > crash_guard > callback() > File "/usr/lib/command-not-found", line 90, in main > cnf = CommandNotFound.CommandNotFound(options.data_dir) > File "/usr/share/command-not-found/CommandNotFound/CommandNotFound.py", > line 79, in __init__ > self.db = SqliteDatabase(dbpath) > File "/usr/share/command-not-found/CommandNotFound/db/db.py", line 12, in > __init__ > self.con = sqlite3.connect(filename) > sqlite3.OperationalError: unable to open database file This is clearly counter-productive. I would either suggest to ignore the failure entirely and behave as if command-not-found was not installed, or to print a better error message driving users towards "apt update". And maybe if it's run as root, then directly propose to run "apt update". Cheers, - Raphaƫl Hertzog