command-not-found has crashed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
command-not-found |
New
|
Undecided
|
Unassigned |
Bug Description
robert@saaz:~$ s
Sorry, command-not-found has crashed! Please file a bug report at:
https:/
Please include the following information with the report:
command-not-found version: 0.3
Python version: 3.9.5 final 0
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Exception information:
unable to open database file
Traceback (most recent call last):
File "/usr/lib/
callback()
File "/usr/lib/
cnf = CommandNotFound
File "/usr/lib/
self.db = SqliteDatabase(
File "/usr/lib/
self.con = sqlite3.
sqlite3.
So I tried reinstalling it:
robert@saaz:~$ sudo apt-get purge -f command-not-found
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
command-
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 36.9 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 560379 files and directories currently installed.)
Removing command-not-found (20.10.1) ...
(Reading database ... 560373 files and directories currently installed.)
Purging configuration files for command-not-found (20.10.1) ...
dpkg: warning: while removing command-not-found, directory '/var/lib/
robert@saaz:~$ ls -la /var/lib/
total 3.2M
drwxr-xr-x 2 root root 4.0K 2021-06-25 00:27 .
drwxr-xr-x 102 root root 4.0K 2021-06-18 15:18 ..
-rw-r----- 1 root root 3.2M 2021-06-25 00:27 commands.db
-rw-r----- 1 root root 2.5K 2021-06-25 00:27 commands.
...and removed the files that it left behind (shouldn't the uninstall step take care of this?):
robert@saaz:~$ sudo rm -rf /var/lib/
robert@saaz:~$ sudo apt-get install command-not-found
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
command-not-found
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5,236 B of archives.
After this operation, 36.9 kB of additional disk space will be used.
Selecting previously unselected package command-not-found.
(Reading database ... 560371 files and directories currently installed.)
Preparing to unpack .../command-
Unpacking command-not-found (20.10.1) ...
Setting up command-not-found (20.10.1) ...
Then it looks like its post-install script is broken. At least I think it should set up command-not-found without me having to run another command.
robert@saaz:~$ s
Could not find command-not-found database. Run 'sudo apt update' to populate it.
s: command not found
robert@saaz:~$ sudo apt update
Hit:1 http://
Get:2 http://
Get:3 http://
Get:4 http://
Hit:5 http://
Hit:6 http://
Get:7 http://
Fetched 232 kB in 1s (295 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Now it's kind of installed... at least it doesn't crash anymore, but doesn't produce helpful output either:
robert@saaz:~$ s
s: command not found
Version information:
robert@saaz:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
I had the same issue a few days ago and reinstalling fixed it. Not sure why it got in that bad state again.
I've upgraded my system a few times from previous Ubuntu versions; maybe it's time to do a fresh installation.