Hub Pod not creating a new sqlite DB

Hi

I’m using sqlite db with JupyterHub with a PV for the hub pod. When i delete the jupyterhub.sqlite db and restart the hub pod doesn’t create a new db. It throws unable to open database file.

Please let me if someone know’s the solution for it.

/usr/local/lib/python3.12/site-packages/jupyter_events/schema.py:68: JupyterEventsVersionWarning: The `version` property of an event schema must be a string. It has been type coerced, but in a future version of this library, it will fail to validate. Please update schema: https://schema.jupyter.org/jupyterhub/events/server-action
  validate_schema(_schema)
[D 2025-08-26 21:37:18.189 JupyterHub app:1998] Connecting to db: sqlite:///jupyterhub.sqlite
[E 2025-08-26 21:37:18.196 JupyterHub app:3912]
    Traceback (most recent call last):
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/app.py", line 3909, in launch_instance_async
        await self.initialize(argv)
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/app.py", line 3388, in initialize
        self.init_db()
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/app.py", line 2000, in init_db
        dbutil.upgrade_if_needed(self.db_url, log=self.log)
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/dbutil.py", line 113, in upgrade_if_needed
        orm.check_db_revision(engine)
      File "/usr/local/lib/python3.12/site-packages/jupyterhub/orm.py", line 1461, in check_db_revision
        current_table_names = set(inspect(engine).get_table_names())
                                  ^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/inspection.py", line 140, in inspect
        ret = reg(subject)
              ^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/reflection.py", line 313, in _engine_insp
        return Inspector._construct(Inspector._init_engine, bind)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/reflection.py", line 246, in _construct
        init(self, bind)
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/reflection.py", line 257, in _init_engine
        engine.connect().close()
        ^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3274, in connect
        return self._connection_cls(self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 148, in __init__
        Connection._handle_dbapi_exception_noconnection(
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 2439, in _handle_dbapi_exception_noconnection
        raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 146, in __init__
        self._dbapi_connection = engine.raw_connection()
                                 ^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3298, in raw_connection
        return self.pool.connect()
               ^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 449, in connect
        return _ConnectionFairy._checkout(self)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
        fairy = _ConnectionRecord.checkout(pool)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
        rec = pool._do_get()
              ^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
        with util.safe_reraise():
             ^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
        raise exc_value.with_traceback(exc_tb)
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
        return self._create_connection()
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
        return _ConnectionRecord(self)
               ^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
        self.__connect()
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
        with util.safe_reraise():
             ^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
        raise exc_value.with_traceback(exc_tb)
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
        self.dbapi_connection = connection = pool._invoke_creator(self)
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/create.py", line 646, in connect
        return dialect.connect(*cargs, **cparams)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 622, in connect
        return self.loaded_dbapi.connect(*cargs, **cparams)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
    (Background on this error at: https://sqlalche.me/e/20/e3q8)

[D 2025-08-26 21:37:18.200 JupyterHub application:1060] Exiting application: jupyterhub

Thanks

Maybe the permissions on your volume don’t allow JupyterHub to create the database. How did you deploy JupyterHub? How is your storage managed?