frigate: Can't start docker container: disk I/O error

Describe the bug A clear and concise description of what your issue is.

 * Starting nginx nginx
   ...done.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
peewee                         DEBUG   : ('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" INTEGER NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" DATETIME NOT NULL)', [])
disk I/O error

** docker script **

docker run -d \
  --privileged \
  --name frigate \
  --restart=unless-stopped \
  --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 \
  -v $CONF/media:/media/frigate \
  -v $CONF/config:/config \
  -v /etc/localtime:/etc/localtime:ro \
  -e FRIGATE_RTSP_PASSWORD='password' \
  -p 5000:5000 \
  -p 1935:1935 \
  blakeblackshear/frigate:stable-amd64

Version of frigate Output from /api/version

blakeblackshear/frigate:stable-amd64

Config file Include your full config file wrapped in triple back ticks.

logger:
  default: debug
detectors:
  cpu1:
    type: cpu
  cpu2:
    type: cpu
mqtt:
  host: duboce
cameras:
  back:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
          roles:
            - detect
            - rtmp
    width: 1280
    height: 720
    fps: 5

Frigate container logs

Include relevant log output here

Frigate stats

Output from frigate's /api/stats endpoint

FFprobe from your camera

Run the following command and paste output below

ffprobe <stream_url>

Screenshots If applicable, add screenshots to help explain your problem.

Computer Hardware

  • OS: MacOs
  • Install method: Docker Command
  • Virtualization:Virtualbox
  • Coral Version: None
  • Network Setup: Wifi

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (3 by maintainers)

Most upvoted comments

The folders are writable (as you can see) as there are some files in it.

I am having the same issue when using a 9p virtio filesystem in a VM (underlying filesystem being shared is BTRFS). Directory is fully writable, and every file is 777 permissions (for testing) but still no. I’ve used frigate in the past on the same exact underlying filesystem and directory, with a bind mount to LXC container (using proxmox).

By creating a new directory on the 9p filesystem and using that one instead, frigate will work exactly once for a little bit longer with the below error, then after a reboot of the container or VM leads to the same error again.

  File "/usr/local/lib/python3.8/dist-packages/flask_sockets.py", line 40, in __call__
    handler, values = adapter.match()
  File "/usr/local/lib/python3.8/dist-packages/werkzeug/routing.py", line 1945, in match
    raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3065, in connect
    self._state.set_connection(self._connect())
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3404, in _connect
    self._add_conn_hooks(conn)
  File "/usr/local/lib/python3.8/dist-packages/playhouse/sqlite_ext.py", line 965, in _add_conn_hooks
    super(SqliteExtDatabase, self)._add_conn_hooks(conn)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3414, in _add_conn_hooks
    self._set_pragmas(conn)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3429, in _set_pragmas
    cursor.execute('PRAGMA %s = %s;' % (pragma, value))
sqlite3.OperationalError: disk I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/gevent/pywsgi.py", line 999, in handle_one_response
    self.run_application()
  File "/usr/local/lib/python3.8/dist-packages/geventwebsocket/handler.py", line 87, in run_application
    return super(WebSocketHandler, self).run_application()
  File "/usr/local/lib/python3.8/dist-packages/gevent/pywsgi.py", line 945, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.8/dist-packages/flask_sockets.py", line 48, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1948, in full_dispatch_request
    rv = self.preprocess_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2242, in preprocess_request
    rv = func()
  File "/opt/frigate/frigate/http.py", line 89, in _db_connect
    database.connect()
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3068, in connect
    self._initialize_connection(self._state.conn)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 2902, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3065, in connect
    self._state.set_connection(self._connect())
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3404, in _connect
    self._add_conn_hooks(conn)
  File "/usr/local/lib/python3.8/dist-packages/playhouse/sqlite_ext.py", line 965, in _add_conn_hooks
    super(SqliteExtDatabase, self)._add_conn_hooks(conn)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3414, in _add_conn_hooks
    self._set_pragmas(conn)
  File "/usr/local/lib/python3.8/dist-packages/peewee.py", line 3429, in _set_pragmas
    cursor.execute('PRAGMA %s = %s;' % (pragma, value))
peewee.OperationalError: disk I/O error
2021-07-09T01:57:58Z {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '44802', 'HTTP_HOST': '192.168.1.28', (hidden keys: 28)} failed with OperationalError