Calibre-Web sqlalchemy error

Hi all,
Having an issue trying to get the calibre-web container up and running. I started the container with the following docker run command:

docker run -d \
  --name=calibre-web \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -p 8083:8083 \
  -v /home/ubuntu/calibre-files/calibre-config:/config \
  -v /home/ubuntu/calibre-files:/books \
  --restart unless-stopped \

In the docker logs, I am getting the following error:

Traceback (most recent call last):
  File "/app/calibre-web/", line 31, in <module>
  File "/app/calibre-web/cps/", line 31, in main
    app = create_app()
  File "/app/calibre-web/cps/", line 115, in create_app
  File "/app/calibre-web/cps/", line 834, in init_db
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/", line 4930, in create_all
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3237, in _run_ddl_visitor
    with self.begin() as conn:
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3153, in begin
    conn = self.connect(close_with_result=close_with_result)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3325, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 96, in __init__
    else engine.raw_connection()
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3404, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3374, in _wrap_pool_connect
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 2208, in _handle_dbapi_exception_noconnection
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 3371, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 327, in connect
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 894, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 493, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 256, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 273, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 388, in __init__
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 690, in __connect
    with util.safe_reraise():
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/", line 70, in __exit__
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/", line 211, in raise_
    raise exception
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/pool/", line 686, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 574, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/", line 598, in connect
    return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) disk I/O error

Running docker on Ubuntu 22.04
I am not at all familiar with sqlalchemy. Does anyone have any idea what might be going on here?

The issue isn’t caused by SQLAlchemy, it is caused by your volume (or the physical disk)
What is the output of ls -asln /home/ubuntu/calibre-files/

drwxrwxr-x 1 1000 1000 0 Aug 15 04:25 calibre-files

there should’ve been a . as well?

O sorry, I just copied the level above it.

   0 drwxrwxr-x 1 1000 1000       0 Aug 15 04:25  .
   4 drwxr-x--- 8 1000 1000    4096 Aug 15 11:29  ..
   0 drwxrwxr-x 1 1000 1000       0 May  9 03:06  .caltrash
   0 drwxrwxr-x 1 1000 1000       0 Feb 17  2022 'Books'
   0 drwxrwxr-x 1 1000 1000       0 Aug 15 04:16  calibre-config
  98 -rw-rw-r-- 1 1000 1000   99950 Mar 15  2022  calibre-web.log
   1 -rw-rw-r-- 1 1000 1000     444 Mar 15  2022  client_secrets.json
   0 drwxrwxr-x 1 1000 1000       0 Feb 19  2022  custom-cont-init.d
   0 drwxrwxr-x 1 1000 1000       0 Feb 19  2022  custom-services.d
 404 -rw-rw-r-- 1 1000 1000  413696 Aug 15 11:52  metadata.db
2764 -rw-rw-r-- 1 1000 1000 2830336 Jun 28 23:12  metadata.db.bak
  19 -rw-rw-r-- 1 1000 1000   19043 Jun 28 23:07  metadata_db_prefs_backup.json

this looks good. Is this a synology unit by any chance? if not, what is it

It’s not. Just a box I installed Ubuntu on.

what is the filesystem of your disks, ext4?? are you using a remote mount or a local disk?

It is a remote mount with rclone. I can see all the files fine from within the container though. And calibre-web was able to generate the app.db and secrets json files, so it is able to write.

this very much explains an I/O disk error. test by using a local disk and I bet it will work.

It does indeed.
Any tips on getting it to work with rclone?

I’ve the exact same issue with a Synology server.

databases don’t support being on file based remote mounts. If you want/need the db on a remote mount, use block based remote mounts, such as iscsi.

It’s not remote mount, it’s on local storage - RAID. It was working with an older version of this container… I just updated the container with ‘latest’.

Then you don’t have the exact same problem, I would suggest opening your own thread. I wasn’t replying to you anyway, I was replying to the person it indicates I replied to :stuck_out_tongue: