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.