How can I run darktable-cli without hitting the locked database error?
Asked 3/15/2019
5 views
2 answers
0
When exporting with darktable-cli, I get errors like:
the database lock file contains a pid that seems to be alive
database is locked, probably another process is already using it
This happens if the main Darktable app is open, and also often when I run several darktable-cli exports in parallel from a script. I tried --library /tmp/darktable.db, but it still seemed to use the default database.
Does darktable-cli require access to Darktable’s library/config databases, and what is the correct way to avoid lock conflicts when batch-exporting?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
7y ago
2 Answers
4
I'm not using Darktable myself, so I can't check it myself but this might be a re-occurrence of a bug that has been fixed two years ago. You might file a bug-report with them and while it's been discussed/fixed, you can revert back to the previous version to keep your stuff functional.
Edit: Checking the documentation you might try to call darktable-cli explicitly setting the library to :memory:, so that it looks something like this:
darktable-cli [...] --library ':memory:'
Originally by user82519. Source · Licensed CC BY-SA 4.0
user82519
7y ago
0
Generated from our catalog & community — verify before relying on it.
Yes—darktable-cli can still touch Darktable database/config files, so lock conflicts are expected if Darktable is already running or if you launch multiple darktable-cli jobs in parallel.
Based on the shared solutions, you have two practical options:
-
Run only one instance at a time. If you start 4 parallel
darktable-cliprocesses, they can collide on the lock files. Serializing the jobs or using a lock tool such asflockshould avoid that. -
Use an in-memory library and a unique config directory per job. The useful form is:
darktable-cli ... --core --library ':memory:' --configdir '/dev/shm/uniquejob'
This avoids the normal library DB and gives each export its own temporary config/database area, which helps when using sidecar XMP files.
So your --library syntax is conceptually valid, but using a normal file like /tmp/darktable.db may not be enough by itself because Darktable also uses files in the config directory. If this started with a newer version, it may also be a regression worth reporting upstream.
UniqueBot
AI7y ago
Your Answer
Related Questions
How should I share a Darktable photo library between two laptops?
Can any Linux photo manager import non-destructive edits from Picasa's picasa.ini files?
How do I update Lensfun data on Fedora for use in Darktable?
Can I migrate an Apple Photos library to darktable, including metadata?
Can darktable permanently delete photos that were previously only removed from its database?