Calibre-web sqlalchemy.exc.OperationalError

Hello,

I just updated the Calibre-web container

version: ‘2.1’
services:
calibre-web:
image: lscr.io/linuxserver/calibre-web:0.6.20
container_name: calibre-web
dns:
- 192.168.1.137
- 8.8.8.8
ports:
- 8083:8083
volumes:
- /volume1/calibre/Library:/books
- /volume1/calibre/Data:/config
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC

restart: unless-stopped
network_mode: "bridge"


sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: Error Messages — SQLAlchemy 1.4 Documentation)
Traceback (most recent call last):
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py”, line 3371, in _wrap_pool_connect
return fn()
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 327, in connect
return _ConnectionFairy._checkout(self)
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 894, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 493, in checkout
rec = pool._do_get()
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/impl.py”, line 256, in _do_get
return self._create_connection()
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 273, in _create_connection
return _ConnectionRecord(self)
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 388, in init
self.__connect()
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 690, in connect
with util.safe_reraise():
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py”, line 70, in exit
compat.raise
(
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/util/compat.py”, line 211, in raise

raise exception
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/pool/base.py”, line 686, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/create.py”, line 574, in connect
return dialect.connect(*cargs, **cparams)
File “/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/default.py”, line 598, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlite3.OperationalError: unable to open database file

It’s docker on Synology NAS.

you’re either missing the required database or have a permissions issue with accessing it.
Confirm your calibre database file exists in /volume1/calibre/Library and confirm you told calibre-web to find it in /books

Yes, I checked with Calibre app and I can open the database in

/volume1/calibre/Library

I tell Calibre-web to find it in /books by:

volumes:

  • /volume1/calibre/Library:/books

The DB permissions:

-rwxrwxrwx+ 1 1000 1000 3649536 Oct 6 12:32 metadata.db

is /volume a local or remote mount?
in calibre-web, have you selected /books/metadata.db as the database location?
image

/volume1 is local mount

Initially yes, I’ve selected /books. The configuration was working with older version of the calibre-web container.
The issue occur when I updated the container.
Currently I can’t go to web to see the configuration - web interface is not accessible because of this error (I guess)

what is the output of uname -mr && docker version

$ uname -mr
4.4.302+ x86_64

$ sudo docker version
Client:
Version: 20.10.23
API version: 1.41
Go version: go1.19.1
Git commit: 876964a
Built: Fri Sep 8 08:19:48 2023
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.23
API version: 1.41 (minimum version 1.12)
Go version: go1.19.1
Git commit: 5fcb1cf
Built: Fri Sep 8 08:18:18 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.6.15
GitCommit: b23a389d8c181697302d163356e97dec04eb8d88
runc:
Version: v1.1.4
GitCommit: 5af893d
docker-init:
Version: 0.19.0
GitCommit: ed96d00

your docker version is fine, but your kernel went end of life the beginning of 2022. Im not saying this is definitely the problem, but I have pretty much the same setup as you, with a supported kernel, and i have no issues.

I am encountering the same issue. I use Synology and have virtually the same compose, and the same Docker and kernel versions. (Yes, the kernel is old, but why do you say it is past EOL? Wikipedia seems to indicate 4.4 should be supported till end of 2026, but i might definitely be misreading this.). Unlike @nchokoev, I haven’t run Calibre-Web before, so there is no pre-existing configuration.

Interestingly, it appears that the problem is not directly caused by calibre-web itself, but by some of the utilities used to launch it. When I use “docker exec” to enter the running container, kill all the running processes, and then directly run “/app/calibre-web/cps.py” using the lsiopy venv, everything seems to work fine. After doing this, I had no issues logging into the web UI (which was previously inaccessible), loading the existing library, reading books, etc. Unfortunately, I have absolutely no idea how should all the s6 utilities used there work, so this is as far as I got.

When the common thing between the only 2 users I’ve seen report the issue is a kernel that hasn’t been supported in over a year (Wikipedia is not a valid source… For literally anything) I’m more and more sure the kernel is related.

https://lkml.iu.edu/hypermail/linux/kernel/2202.0/02625.html

I would ask that either of you recreate the issue with a supported kernel and report back. Unfortunately we can only offer best effort help for something that is not supported in general.