Package: command-not-found
Version: 18.04.5-1

When trying to execute a non-existent command, command-not-found crashes

$ not-a-command
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.6.8 candidate 1
Distributor ID: Debian
Description:    Debian GNU/Linux buster/sid
Release:        testing
Codename:       buster
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, do_raise=True)
File "/usr/share/command-not-found/CommandNotFound/CommandNotFound.py", line 86, 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
$

Here are the permissions of the database file at the time:
$ ls -l /var/lib/command-not-found
total 2776
-rw-r----- 1 root root 2834432 Dec 18 05:25 commands.db
-rw-r----- 1 root root    4712 Dec 18 05:25 commands.db.metadata
$

I ran update-command-not-found and no change. I then removed the files and ran update-command-not-found again. The files were recreated with the same permissions.

As a workaround, I gave read permissions to all users for both files and it seems to work fine now.
$ sudo chmod o+r /var/lib/command-not-found/commands.db*

--
Andrew

Reply via email to