question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Database is locked

See original GitHub issue

Hello, I am getting an error stating “database is locked”. My clips, config, and recordings folders are all mapped to a samba share on an openmediavault NAS that is mounted via my fstab file to “/media/10tbextsmb/”. This config works fine when the docker bind mounts are pointed to a local hard drive for testing. I have added the path to my database file in my config as the docs state, but can’t seem to get past this. I have used the path below, and “/media/10tbextsmb/bigserver/frigate/clips/frigate.db” as the path in the config.

Config:

mqtt:
  host: 192.168.1.205
  port: 1883
  user: clayton
  password: XXXXXXX
database: 
  path: /media/frigate/clips/frigate.db
ffmpeg:
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p
cameras:
  driveway:
    ffmpeg:
      inputs:
        - path: 'rtmp://192.168.1.19/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password=liza2056'
          roles:
            - clips
        - path: 'rtmp://192.168.1.19/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password=liza2056'
          roles:
            - detect
          input_args:
            - -avoid_negative_ts
            - make_zero
            - -fflags
            - nobuffer
            - -flags
            - low_delay
            - -strict
            - experimental
            - -fflags
            - +genpts+discardcorrupt
            - -rw_timeout
            - '5000000'
            - -use_wallclock_as_timestamps
            - '1'
    width:  640
    height: 480
    fps:  7
    motion:
      mask:
        - 256,97,640,111,640,0,316,0,0,0,0,189,0,355
objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - car
    - truck
    - cat
    - dog    

Docker Command:

clayton@bigserver:~$ sudo docker run --rm --name frigate8 --privileged --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 -v /dev/bus/usb:/dev/bus/usb -v /media/10tbextsmb/bigserver/frigate/clips:/media/frigate/clips -v /media/10tbextsmb/bigserver/frigate/recordings:/media/frigate/recordings -v /media/10tbextsmb/bigserver/frigate/config:/config:ro -v /etc/localtime:/etc/localtime:ro -p 5000:5000 -p 1935:1935 blakeblackshear/frigate:0.8.1-amd64
 * Starting nginx nginx
   ...done.
frigate.app                    WARNING : Camera driveway has clips assigned to an input, but clips is not enabled.
frigate.app                    WARNING : Camera driveway has rtmp enabled, but rtmp is not assigned to an input.
Starting migrations
peewee_migrate                 INFO    : Starting migrations
database is locked

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
blakeblackshearcommented, Feb 4, 2021

sqlite doesnt like being on a network share. You can customize the location here: https://blakeblackshear.github.io/frigate/configuration/advanced#database

1reaction
dcgrovecommented, Feb 4, 2021

Thanks that fixed it. I am relatively new to docker so I am learning on the fly. This is my new docker command for future reference.

sudo docker run --rm --name frigate8 --privileged --mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000 -v /dev/bus/usb:/dev/bus/usb -v /media/10tbextsmb/bigserver/frigate/clips:/media/frigate/clips -v /media/10tbextsmb/bigserver/frigate/recordings:/media/frigate/recordings -v /mnt/tvshows/frigate/database:/media/frigate/database -v /media/10tbextsmb/bigserver/frigate/config:/config:ro -v /etc/localtime:/etc/localtime:ro -p 5000:5000 -p 1935:1935 blakeblackshear/frigate:0.8.1-amd64
Read more comments on GitHub >

github_iconTop Results From Across the Web

OperationalError: database is locked - python - Stack Overflow
OperationalError: database is locked errors indicate that your application is experiencing more concurrency than sqlite can handle in default ...
Read more >
Fix SQLite Database File is Locked Error - Kernel Data Recovery
Normally, the error occurs when two users try to run transactions on the same tables and change the content. SQLite engine finds it...
Read more >
How to Fix SQLite Error Database is Locked - Error Code 5
This error code occurs when the user tries to perform two inappropriate operations on a database at the same detail and on the...
Read more >
sqlite3.OperationalError: database is locked - Pyrogram
This error occurs when more than one process is using the same session file, that is, when you run two or more clients...
Read more >
Fixing the 'Database is locked' error - YouTube
Fixing the ' Database is locked ' error. 4.1K views 4 years ago. EyeSpace Lenses. EyeSpace Lenses. 135 subscribers. Subscribe.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found