Tried @reedy’s change and set my database to /media/frigate/frigate.db. I copied my /config/frigate.db* files to /media/frigate but my frigate now fails to start with an error like:
2025-03-08 21:20:08.634255940 Exception in thread Thread-3:
2025-03-08 21:20:08.634261607 Traceback (most recent call last):
2025-03-08 21:20:08.634263690 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3263, in connect
2025-03-08 21:20:08.635957187 self._state.set_connection(self._connect())
2025-03-08 21:20:08.635961919 File "/opt/frigate/frigate/db/sqlitevecq.py", line 14, in _connect
2025-03-08 21:20:08.636066990 conn: sqlite3.Connection = super()._connect(*args, **kwargs)
2025-03-08 21:20:08.636090665 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3607, in _connect
2025-03-08 21:20:08.636761365 self._add_conn_hooks(conn)
2025-03-08 21:20:08.636764433 File "/usr/local/lib/python3.9/dist-packages/playhouse/sqlite_ext.py", line 1084, in _add_conn_hooks
2025-03-08 21:20:08.637767847 super(SqliteExtDatabase, self)._add_conn_hooks(conn)
2025-03-08 21:20:08.637770577 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3617, in _add_conn_hooks
2025-03-08 21:20:08.638262712 self._set_pragmas(conn)
2025-03-08 21:20:08.638264764 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3632, in _set_pragmas
2025-03-08 21:20:08.638779976 cursor.execute('PRAGMA %s = %s;' % (pragma, value))
2025-03-08 21:20:08.638801719 pysqlite3.dbapi2.OperationalError: locking protocol
If I don’t copy over the DB, then it gets this error:
2025-03-08 21:26:18.757398055 Traceback (most recent call last):
2025-03-08 21:26:18.757401523 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3322, in execute_sql
2025-03-08 21:26:18.757402542 cursor.execute(sql, params or ())
2025-03-08 21:26:18.757405939 pysqlite3.dbapi2.OperationalError: database is locked
2025-03-08 21:26:18.757407014
2025-03-08 21:26:18.757407815 During handling of the above exception, another exception occurred:
2025-03-08 21:26:18.757425543
2025-03-08 21:26:18.757426383 Traceback (most recent call last):
2025-03-08 21:26:18.757427576 File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
2025-03-08 21:26:18.757428623 return _run_code(code, main_globals, None,
2025-03-08 21:26:18.757429397 File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
2025-03-08 21:26:18.757430171 exec(code, run_globals)
2025-03-08 21:26:18.757430970 File "/opt/frigate/frigate/__main__.py", line 64, in <module>
2025-03-08 21:26:18.757447949 main()
2025-03-08 21:26:18.757448888 File "/opt/frigate/frigate/__main__.py", line 60, in main
2025-03-08 21:26:18.757449648 FrigateApp(config).start()
2025-03-08 21:26:18.757450383 File "/opt/frigate/frigate/app.py", line 593, in start
2025-03-08 21:26:18.757458428 self.init_database()
2025-03-08 21:26:18.757459271 File "/opt/frigate/frigate/app.py", line 161, in init_database
2025-03-08 21:26:18.757459875 if len(router.diff) > 0:
2025-03-08 21:26:18.757460771 File "/usr/local/lib/python3.9/dist-packages/peewee_migrate/router.py", line 85, in diff
2025-03-08 21:26:18.757461444 done = set(self.done)
2025-03-08 21:26:18.757462293 File "/usr/local/lib/python3.9/dist-packages/peewee_migrate/router.py", line 80, in done
2025-03-08 21:26:18.757463237 return [mm.name for mm in self.model.select().order_by(self.model.id)]
2025-03-08 21:26:18.757464001 File "/usr/lib/python3.9/functools.py", line 969, in __get__
2025-03-08 21:26:18.757464719 val = self.func(instance)
2025-03-08 21:26:18.757474394 File "/usr/local/lib/python3.9/dist-packages/peewee_migrate/router.py", line 69, in model
2025-03-08 21:26:18.757475147 MigrateHistory.create_table(safe=True)
2025-03-08 21:26:18.757475954 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 7078, in create_table
2025-03-08 21:26:18.757476999 cls._schema.create_all(safe, **options)
2025-03-08 21:26:18.757477770 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 6171, in create_all
2025-03-08 21:26:18.757478474 self.create_table(safe, **table_options)
2025-03-08 21:26:18.757479273 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 6022, in create_table
2025-03-08 21:26:18.757490342 self.database.execute(self._create_table(safe=safe, **options))
2025-03-08 21:26:18.757491181 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3330, in execute
2025-03-08 21:26:18.757491904 return self.execute_sql(sql, params)
2025-03-08 21:26:18.757492690 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3322, in execute_sql
2025-03-08 21:26:18.757493472 cursor.execute(sql, params or ())
2025-03-08 21:26:18.757494268 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3088, in __exit__
2025-03-08 21:26:18.757494997 reraise(new_type, new_type(exc_value, *exc_args), traceback)
2025-03-08 21:26:18.757495770 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 196, in reraise
2025-03-08 21:26:18.757496429 raise value.with_traceback(tb)
2025-03-08 21:26:18.757510212 File "/usr/local/lib/python3.9/dist-packages/peewee.py", line 3322, in execute_sql
2025-03-08 21:26:18.757511052 cursor.execute(sql, params or ())
2025-03-08 21:26:18.757511792 peewee.OperationalError: database is locked
2025-03-08 21:26:19.053281530 2025/03/08 13:26:19 [error] 179#179: *6 connect() failed (111: Connection refused) while connecting to upstream
Did you guys do something different when moving the frigate.db?
Looking online I found this thread Database is locked · Issue #712 · blakeblackshear/frigate · GitHub which says sqlite doesn’t like being on a network share.