For my home network, I’ve been trying to transitioning to using an Infrastructure-as-code (IaC) approach based on a terraform and the terraform esxi provider plugin. I maintain a few “gold images” of the base line systems, then clone and provision as needed.
I’m not sure where the root cause of this issue is, but I’ve seen it pop up a few times now so I figured I’d write down how I’ve fixed it.
On Ubuntu, when I mistype a command, I get a command-not-found, sqlite error message. Something to this effect
unable to open database file Traceback (most recent call last): File "/usr/lib/python3/dist-packages/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/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 79, in __init__ self.db = SqliteDatabase(dbpath) File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 12, in __init__ self.con = sqlite3.connect(filename) sqlite3.OperationalError: unable to open database file
Reinstalling the command-not-found package and adjusting the permissions seems to fix it. You can do this on Ubuntu with the following 2 commands.
sudo apt install --reinstall command-not-found sudo chmod -R o+r /var/lib/command-not-found/
If I ever find out what is causing this, I’ll update this post. Or if anyone reading this knows, feel free to leave it in the comments.