[Bug 1875760] Re: /usr/lib/cnf-update-db:sqlite3.OperationalError:/usr/lib/cnf-update-db at 26:create
Lukas Märdian
1875760 at bugs.launchpad.net
Thu Aug 27 07:19:15 UTC 2020
Hello Lukasz,
I could successfully verify this SRU inside a Focal LXD container for command-not-found 20.04.4:
root at f:~# dpkg -l | grep command-not-found
ii command-not-found 20.04.4 all Suggest installation of packages in interactive bash sessions
ii python3-commandnotfound 20.04.4 all Python 3 bindings for command-not-found.
root at f:~# apt update
...
root at f:~# cp /var/lib/command-not-found/commands.db /var/lib/command-not-found/commands.db.tmp
root at f:~# ll /var/lib/command-not-found/
total 6064
drwxr-xr-x 2 root root 4096 Aug 27 07:11 ./
drwxr-xr-x 24 root root 4096 Aug 27 07:08 ../
-rw-r--r-- 1 root root 3096576 Aug 27 07:11 commands.db
-rw-r--r-- 1 root root 3634 Aug 27 07:11 commands.db.metadata
-rw-r--r-- 1 root root 3096576 Aug 27 07:11 commands.db.tmp
root at f:~# sqlite3 /var/lib/command-not-found/commands.db.tmp
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> PRAGMA locking_mode = EXCLUSIVE;
exclusive
sqlite> BEGIN EXCLUSIVE;
sqlite>
root at f:~# rm /var/lib/command-not-found/commands.db.metadata
root at f:~# /usr/lib/cnf-update-db --verbose
WARNING:root:/var/lib/command-not-found/commands.db.tmp is locked by another process. Ignoring.
root at f:~# echo $?
0
After the database is unlocked, the application runs as expected:
root at f:~# /usr/lib/cnf-update-db --verbose
INFO:root:processed 14855 packages in 1.45s
** Tags removed: verification-needed-focal
** Tags added: verification-done-focal
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to command-not-found in Ubuntu.
https://bugs.launchpad.net/bugs/1875760
Title:
/usr/lib/cnf-update-db:sqlite3.OperationalError:/usr/lib/cnf-update-
db at 26:create
Status in command-not-found package in Ubuntu:
Fix Released
Status in command-not-found source package in Focal:
Fix Committed
Bug description:
[Impact]
The Ubuntu Error Tracker has been receiving reports about a problem
regarding command-not-found. c-n-f- crashes when there are two
parallel processes trying to update the tmpdb via its 'cnf-update-db'
script. Only the first process can lock the sqlite3 database, the 2nd
one will crash.
There is no impact on users, but we want to avoid the noise about
those crashes in the Ubuntu Error Tracker.
This update ignores the update-db operation, if the database is
already locked and logs a warning message.
[Test Case]
* Manually lock the database
* Run 'cnf-update-db'
* Verify it is not crashing
sudo cp /var/lib/command-not-found/commands.db /var/lib/command-not-found/commands.db.tmp
sudo sqlite3 /var/lib/command-not-found/commands.db.tmp
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> PRAGMA locking_mode = EXCLUSIVE;
exclusive
sqlite> BEGIN EXCLUSIVE;
sqlite>
sudo rm /var/lib/command-not-found/commands.db.metadata
sudo sudo /usr/lib/cnf-update-db --verbose
echo $?
[Regression Potential]
This changes touches the 'cnf-update-db' script which creates or
updates the sqlite database containing the mappings between
executables and its corresponding packages. It it regresses the
database might not be correctly updated anymore and thus users might
not get proper package recommendations when they try to execute a non-
installed application.
[Original Bug Description]
The Ubuntu Error Tracker has been receiving reports about a problem regarding command-not-found. This problem was most recently seen with package version 20.04.2, the problem page at https://errors.ubuntu.com/problem/e1fb83cff555154efc036bf0674053c5e555d96b contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/1875760/+subscriptions
More information about the foundations-bugs
mailing list