frigate icon indicating copy to clipboard operation
frigate copied to clipboard

[Support]: db migrate fails when moving frigate.db onto itself

Open lordbah opened this issue 1 year ago • 1 comments

Describe the problem you are having

Container doesn't start when trying to migrate from 0.12.? to 0.13.1.

Version

0.13.1

Frigate config file

N/A

Relevant log output

frigate              | 2024-02-14 21:03:16.354265981  [INFO] Moving db from '/media/frigate/frigate.db' to the '/config' dir...
frigate              | mv: '/media/frigate/frigate.db' and '/config/frigate.db' are the same file
frigate              | 2024-02-14 21:03:16.365470308  [INFO] Service Frigate exited with code 1 (by signal 0)
frigate              | s6-rc: info: service legacy-services: stopping

FFprobe output from your camera

N/A

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

N/A

Any other information that may be helpful

docker-compose.yaml volumes

      - /media/frigate/:/config/
      - /media/frigate:/media/frigate

On 0.12 the frigate.db was in /media/frigate while Frigate's config.yaml was elsewhere. (/media/frigate is an NFS mount on the NAS). With 0.13.1 we have to map the entire /config directory so it seemed easiest to me to move the config.yaml onto the NAS too.

The mv command fails because it is moving the frigate.db file on top of itself. This is not marked in the docker compose output with "[ERROR]" but it appears to be treated as an error because it exits, docker retries it, endless loop. However, if we can detect that it is in fact the same file we ought to treat it as successful (nothing to do) and continue.

lordbah avatar Feb 15 '24 02:02 lordbah

The change was specifically done so the the DB is but run on network storage, this causes issues. I'd suggest keeping the config directory local

NickM-27 avatar Feb 15 '24 04:02 NickM-27

I'm having this exact same error and my config directory is local.

This is the log:

s6-rc: info: service s6rc-fdholder: starting

s6-rc: info: service s6rc-oneshot-runner: starting

s6-rc: info: service s6rc-oneshot-runner successfully started

s6-rc: info: service fix-attrs: starting

s6-rc: info: service s6rc-fdholder successfully started

s6-rc: info: service fix-attrs successfully started

s6-rc: info: service legacy-cont-init: starting

s6-rc: info: service legacy-cont-init successfully started

s6-rc: info: service log-prepare: starting

s6-rc: info: service log-prepare successfully started

s6-rc: info: service nginx-log: starting

s6-rc: info: service go2rtc-log: starting

s6-rc: info: service frigate-log: starting

s6-rc: info: service nginx-log successfully started

s6-rc: info: service go2rtc-log successfully started

s6-rc: info: service go2rtc: starting

s6-rc: info: service frigate-log successfully started

s6-rc: info: service go2rtc successfully started

s6-rc: info: service go2rtc-healthcheck: starting

s6-rc: info: service frigate: starting

s6-rc: info: service frigate successfully started

s6-rc: info: service nginx: starting

s6-rc: info: service nginx successfully started

s6-rc: info: service go2rtc-healthcheck successfully started

s6-rc: info: service legacy-services: starting

2024-02-22 01:38:19.899134364 [INFO] Preparing new go2rtc config...

2024-02-22 01:38:19.900097215 [INFO] Starting NGINX...

2024-02-22 01:38:19.902746304 [INFO] Preparing Frigate...

2024-02-22 01:38:19.928509992 [INFO] Moving db from '/media/frigate/frigate.db' to the '/config' dir...

mv: '/media/frigate/frigate.db' and '/config/frigate.db' are the same file

s6-rc: info: service legacy-services successfully started

2024-02-22 01:38:19.941928333 [INFO] Service Frigate exited with code 1 (by signal 0)

s6-rc: info: service legacy-services: stopping

s6-rc: info: service legacy-services successfully stopped

s6-rc: info: service nginx: stopping

s6-rc: info: service go2rtc-healthcheck: stopping

2024-02-22 01:38:19.962387255 [INFO] The go2rtc-healthcheck service exited with code 256 (by signal 15)

s6-rc: info: service go2rtc-healthcheck successfully stopped

2024-02-22 01:38:20.007969555 [INFO] Service NGINX exited with code 0 (by signal 0)

s6-rc: info: service nginx successfully stopped

s6-rc: info: service nginx-log: stopping

s6-rc: info: service frigate: stopping

s6-rc: info: service frigate successfully stopped

s6-rc: info: service go2rtc: stopping

s6-rc: info: service frigate-log: stopping

s6-rc: info: service nginx-log successfully stopped

s6-rc: info: service frigate-log successfully stopped

2024-02-22 01:38:20.020580624 [INFO] The go2rtc service exited with code 256 (by signal 15)

s6-rc: info: service go2rtc successfully stopped

s6-rc: info: service go2rtc-log: stopping

s6-rc: info: service go2rtc-log successfully stopped

s6-rc: info: service log-prepare: stopping

s6-rc: info: service s6rc-fdholder: stopping

s6-rc: info: service log-prepare successfully stopped

s6-rc: info: service legacy-cont-init: stopping

s6-rc: info: service s6rc-fdholder successfully stopped

s6-rc: info: service legacy-cont-init successfully stopped

s6-rc: info: service fix-attrs: stopping

s6-rc: info: service fix-attrs successfully stopped

s6-rc: info: service s6rc-oneshot-runner: stopping

s6-rc: info: service s6rc-oneshot-runner successfully stopped

This is my docker compose:

version: "3.9" services: frigate: container_name: frigate restart: unless-stopped image: ghcr.io/blakeblackshear/frigate:stable volumes: - /home/xxxxx/frigate:/config # modify to match your setup - /home/xxxxx/frigate:/media/frigate - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear target: /tmp/cache tmpfs: size: 1000000000 ports: - "5000:5000" - "8554:8554" # RTSP feeds - "8555:8555/tcp" # WebRTC over tcp - "8556:8555/udp" # WebRTC over udp4"

Never had this issue until trying to pull version 13.

Suzano-Sho avatar Feb 22 '24 01:02 Suzano-Sho

it means you have a DB file in /config and /media/frigate. Delete one (the older one)

NickM-27 avatar Feb 23 '24 16:02 NickM-27

For Helm chart users with Kubernetes experiencing this error, make sure to upgrade your chart to the 7.3.0+ https://artifacthub.io/packages/helm/blakeblackshear/frigate and be careful with persistence.config and persistence.data PVCs, those were specifically updated to support this migration.

artem-zinnatullin avatar Feb 29 '24 08:02 artem-zinnatullin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 31 '24 00:03 github-actions[bot]