InfluxDB on Docker: Error: database is locked

Hi there,

I’m deployng influxdb on docker (on a Server) using as storage for the data a CIFS share on my Nas.

I get this error:

2024-02-06T13:23:31.518836197Z	info	booting influxd server in the background	{"system": "docker"}

ts=2024-02-06T13:23:31.633544Z lvl=info msg="Welcome to InfluxDB" log_id=0nBeFjhG000 version=v2.7.5 commit=09a9607fd9 build_date=2024-01-05T17:17:04Z log_level=info

ts=2024-02-06T13:23:31.633599Z lvl=warn msg="nats-port argument is deprecated and unused" log_id=0nBeFjhG000

ts=2024-02-06T13:23:31.680445Z lvl=info msg="Resources opened" log_id=0nBeFjhG000 service=bolt path=/var/lib/influxdb2/influxd.bolt

ts=2024-02-06T13:23:31.680598Z lvl=info msg="Resources opened" log_id=0nBeFjhG000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite

ts=2024-02-06T13:23:31.686747Z lvl=info msg="Bringing up metadata migrations" log_id=0nBeFjhG000 service="KV migrations" migration_count=20

ts=2024-02-06T13:23:32.460344Z lvl=info msg="Bringing up metadata migrations" log_id=0nBeFjhG000 service="SQL migrations" migration_count=8

2024-02-06T13:23:32.522061964Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "0"}

2024-02-06T13:23:33.532295259Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "1"}

2024-02-06T13:23:34.542014974Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "2"}

2024-02-06T13:23:35.552218675Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "3"}

2024-02-06T13:23:36.562369653Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "4"}

ts=2024-02-06T13:23:37.472605Z lvl=error msg="Failed to apply SQL migrations" log_id=0nBeFjhG000 error="database is locked"

Error: database is locked

See 'influxd -h' for help

2024-02-06T13:23:37.572233232Z	info	pinging influxd...	{"system": "docker", "ping_attempt": "5"}

/entrypoint.sh: line 284: kill: (101) - No such process

2024-02-06T13:23:37.580782226Z	error	influxd crashed during startup	{"system": "docker", "total_pings": "6"}

2024-02-06T13:23:37.582267348Z	warn	cleaning bolt and engine files to prevent conflicts on retry	{"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt", "engine_path": "/var/lib/influxdb2/engine"}

{

  "bolt-path": "/var/lib/influxdb2/influxd.bolt",

  "engine-path": "/var/lib/influxdb2/engine",

  "nats-port": 4222,

  "http-bind-address": ":9999"

}

This is my docker compose file:

version: "3"
services:
  influxdb:
    container_name: InfluxDb2
    image: influxdb:latest
    networks:
      - influxdb_grafana_net
    env_file:
      - influxv2.env
    volumes:
      - influxdb_cifs:/var/lib/influxdb2
      #- "/srv/docker/volumes/influxdb:/var/lib/influxdb2:rw"
    ports:
      - 8086:8086
    restart: always

volumes:
  influxdb_cifs:
    driver_opts:
      type: cifs
      o: username=influxdb,password=xxxxxx,uid=1000,gid=1000,vers=3.0
      device: //192.168.10.26/VM_Storage/InfluxDB

networks:
    influxdb_grafana_net:  
        name: influxdb_grafana_net

The container has access to the shared folder because I see this folder inside of network share:

  • Engine folder
  • influxd.sqlite

If I change the volume to one local volume with

- "/srv/docker/volumes/influxdb:/var/lib/influxdb2:rw"

everything works.

Any suggestion how to save the data on my NAS?

Thank you in advance!

Hello @fedex03,
I’m sorry I haven’t seen his error before.
Silly question but did you try :rw on the desired mount?
There’s these related issues:

https://www.reddit.com/r/prowlarr/comments/r2ncc2/database_locked/

It seems like its a nas share issue. I would consider reaching out for support through them.