Error: database file ***.db could not be opened

I tired to import new files and end up with the following error message:

beet import -i /home/matthias/Multimedia/Musik/flac/ 
error: database file /home/matthias/Multimedia/Musik/beets/beet_music_data.db could not be opened

Also an re-import of the already imported filed had the same error.

Even when I removed the existing database file (and I made of course a backup of it) and therefore force beets to create a new one showed the same error (the new database file has been created with the size 0).

I got the feeling that this correlates with the update from debian 9 to debian 10 I made a few weeks ago.

Weird! Is there any more useful output with -vvv?

No, I got exactly the same error message:

beet import -ivvv /home/matthias/Multimedia/Musik/flac/
error: database file /home/matthias/Multimedia/Musik/beets/beet_music_data.db could not be opened

The verbose flags need to go right after beet, before import.

Sorry, here in the correct form:

beet -vvv import -i /home/matthias/Multimedia/Musik/flac/
user configuration: /home/matthias/.config/beets/config.yaml
data directory: /home/matthias/.config/beets
plugin paths:
Sending event: pluginload
Traceback (most recent call last):
File “/usr/share/beets/beets/ui/init.py”, line 1193, in _open_library
get_replacements(),
File “/usr/share/beets/beets/library.py”, line 1281, in init
super(Library, self).init(path, timeout=timeout)
File “/usr/share/beets/beets/dbcore/db.py”, line 765, in init
self._make_table(model_cls._table, model_cls._fields)
File “/usr/share/beets/beets/dbcore/db.py”, line 860, in _make_table
tx.script(setup_sql)
File “/usr/share/beets/beets/dbcore/db.py”, line 731, in script
self.db._connection().executescript(statements)
sqlite3.OperationalError: database is locked

error: database file /home/matthias/Multimedia/Musik/beets/beet_music_data.db could not be opened

Weird! The important bit is:

Not sure why your system is doing this though. Is there anything odd about the filesystem this is on? Is it a network mount? Anything strange about the permissions on the enclosing directory? Can you create and edit a text file in that directory?

Pretty much stumped here!

The directory is indeed on a network mount. The rights in the directory are as they should be and I also can create text files in that directory.

I changed the directory where the database file is saved to a directory on a local partition and tried to redo a complete import with:

beet -vvv import -CAW ~/Multimedia/Musik/beets

Then it worked.

Afterwards I still had some problems with sticking beet jobs, duplicated files that could no deleted any more, but I assume that this could be a problem of the NAS. After I rebooted it also that problems were gone.

I also have the exacte same issue less the database locked, still cant make it work!!!

can you think of anything to help me, permissions for the whole volume are now set to “anyone”

LeFab@Gaston:~$ sudo docker exec -u abc -it beets /bin/bash -c ‘beet -vvv import -CAW /volume1/Musik’
user configuration: /config/config.yaml
data directory: /config
plugin paths:
/usr/lib/python3.8/site-packages/beets/mediafile.py:21: UserWarning: beets.mediafile is deprecated; use mediafile instead
warnings.warn(“beets.mediafile is deprecated; use mediafile instead”)
Sending event: pluginload
lyrics: Disabling google source: no API key configured.
inline: adding item field mySongartist
inline: adding item field isMultidisc
inline: adding item field myAlbumType
inline: adding item field myDisc
inline: adding album field bitrate
Traceback (most recent call last):
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 1020, in _make_table
rows = tx.query(‘PRAGMA table_info(%s)’ % table)
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 863, in query
cursor = self.db._connection().execute(statement, subvals)
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 947, in _connection
conn = self._create_connection()
File “/usr/lib/python3.8/site-packages/beets/library.py”, line 1439, in _create_connection
conn = super(Library, self)._create_connection()
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 961, in _create_connection
conn = sqlite3.connect(
sqlite3.OperationalError: unable to open database file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.8/site-packages/beets/ui/init.py”, line 1221, in _open_library
lib = library.Library(
File “/usr/lib/python3.8/site-packages/beets/library.py”, line 1430, in init
super(Library, self).init(path, timeout=timeout)
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 933, in init
self._make_table(model_cls._table, model_cls._fields)
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 1020, in _make_table
rows = tx.query(‘PRAGMA table_info(%s)’ % table)
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 855, in exit
self.db._connection().commit()
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 947, in _connection
conn = self._create_connection()
File “/usr/lib/python3.8/site-packages/beets/library.py”, line 1439, in _create_connection
conn = super(Library, self)._create_connection()
File “/usr/lib/python3.8/site-packages/beets/dbcore/db.py”, line 961, in _create_connection
conn = sqlite3.connect(
sqlite3.OperationalError: unable to open database file

error: database file /volume1/music/musiclibrary.blb cannot not be opened: unable to open database file