Originally Posted by murkyl
So there is a workaround fortunately! Calibre has the capability to have the metadata database in a different directory from the library itself. You need to set it with the full path including the name of the database file in an environment variable named:
This is documented here: http://manual.calibre-ebook.com/customize.html
This link here in the forums also helped: https://www.mobileread.com/forums/sho...d.php?t=190436
It turns out there is some incompatibility between SQLite and Samba. You can find a ton of posts about this if you search on 'sqlite cifs'. It looks like it is a form of file locking which is causing the problem. A full Microsoft client and server do no seem to have this problem. It seems to only occur if either the client or server is running Samba.
I've used the environment variable to move the DB and now the Calibre server updates properly when new books are added. The last step is to backup the metadata DB files now that they are no longer on the NAS.
Hope this helps someone else in the future.
Hi, I am having trouble making this work (having my library hosted on a NAS), and am hoping you can assist me. Calibre is installed to my machine (C:\Program Files\Calibre2), and my eBook files (organized by Calibre in directories with metadata.opf files and cover.jpg files) are stored on a NAS mapped to the N:\ drive.
I edited the calibre-portable.bat file to set the ebook location as follows:
IF EXIST N:\eBooks (
ECHO LIBRARY FILES: N:\eBooks
And I set my metadata database location as follows:
IF EXIST "C:\Documents and Settings\Administrator\Calibre Library\metadata.db" (
IF NOT "%CALIBRE_LIBRARY_DIRECTORY%" == "C:\Documents and Settings\Administrator\Calibre Library" (
SET CALIBRE_OVERRIDE_DATABASE_PATH="C:\Documents and Settings\Administrator\Calibre Library\metadata.db"
ECHO DATABASE: C:\Documents and Settings\Administrator\Calibre Library\metadata.db
ECHO ***CAUTION*** Library Switching will be disabled
so I have copied my metadata.db file from N:\eBooks (where it normally was) to C:\Documents and Settings\Administrator\Calibre Library.
However, when I launch the calibre-portable.bat file, I get the following error:
calibre, version 0.9.17
Corrupted database: The library database at N:\eBooks appears to be corrupted. Do you want calibre to try and rebuild it automatically? The rebuild may not be completely successful. If you say No, a new empty calibre library will be created.
Traceback (most recent call last):
File "site-packages\calibre\gui2\main.py", line 228, in initialize_db
File "site-packages\calibre\library\database2.py", line 166, in __init__
File "site-packages\calibre\library\database2.py", line 114, in connect
File "site-packages\calibre\library\sqlite.py", line 366, in connect
DatabaseException: unable to open database file
RemoteTraceback (most recent call last):
File "site-packages\calibre\library\sqlite.py", line 248, in run
File "site-packages\calibre\library\sqlite.py", line 225, in connect
OperationalError: unable to open database file
Trying to rebuild the library fails, so that will not work, unfortunately. I can confirm that my library is ok though, since I can launch Calibre normally with the metadata.db file that is on the NAS at N:\eBooks (but this takes a very long time, which is why I want to use the local copy of metadata.db).
Am I missing a step?
Thanks for the help!