Database is locked on container instance installation

I have set up InfluxDB 2.1.1 in an Azure Container Instance and have mounted a new Azure FileShare to /var/lib/influxdb2 .
On starting the pod, it terminates and I see the following logs appear.

2021-12-01T01:37:38.294145622Z	warn	boltdb not found at configured path, but DOCKER_INFLUXDB_INIT_MODE not specified, skipping setup wrapper	{"system": "docker", "bolt_path": ""}
ts=2021-12-01T01:37:38.484185Z lvl=info msg="Welcome to InfluxDB" log_id=0Y8v50hl000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
ts=2021-12-01T01:37:38.532866Z lvl=info msg="Resources opened" log_id=0Y8v50hl000 service=bolt path=/var/lib/influxdb2/influxd.bolt
ts=2021-12-01T01:37:38.532954Z lvl=info msg="Resources opened" log_id=0Y8v50hl000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
ts=2021-12-01T01:37:38.545548Z lvl=info msg="Bringing up metadata migrations" log_id=0Y8v50hl000 service="KV migrations" migration_count=18
ts=2021-12-01T01:37:39.855620Z lvl=info msg="Bringing up metadata migrations" log_id=0Y8v50hl000 service="SQL migrations" migration_count=3
Error: database is locked
See 'influxd -h' for help
ts=2021-12-01T01:37:44.890982Z lvl=error msg="Failed to apply SQL migrations" log_id=0Y8v50hl000 error="database is locked"

In the file share the file influxd.sqlite has been created with 0 B along with the bolt file and engine directory.

I had set up an Azure FileShare with 100Gb with SMB protocol and used the following command to create the ACI (with identifiers removed). The FileShare and the ACI are located in the same resource group and location (West Europe)

az container create \
    --resource-group <group> \
    --name <name> \
    --image influxdb:2.1.1 \
    --restart-policy OnFailure \
    --memory 8 \
    --dns-name-label <label> \
    --ports 80 8086 \
    --azure-file-volume-account-name <account> \
    --azure-file-volume-account-key <key> \
    --azure-file-volume-share-name <share name> \
    --azure-file-volume-mount-path /var/lib/influxdb2

The details of the file share are below

SIZE AND PERFORMANCE
Used capacity	:	64 KiB
Provisioned capacity	:	100 GiB
Maximum IO/s	:	500
Burst IO/s	:	4000
Throughput rate	:	70.0 MiBytes / s

I note that this error occurs using the Influx 2.1.1 image. The previous version 2.0.9 (image given was at quay.io) worked with no issue (mount point was at /root, new one is at /var/lib/influxdb2), but it does not have the SQL migrations appear in the logs.

Have I missed something during the setup?

Same here. I found this in an article:

Unfortunately, due to some limitations, it was not possible to persist on Azure Files the SQLite database (embarked by default in Grafana) (a dark story about locks) or to use the Docker image provided by PostgreSQL (a dark story about files and their owner).

It seems that sqlite cannot run properly on azure fs because some features are missing.
Have you found a workaround ?

Regards

I did see that, but didn’t think it would be the same issue since the system did create a file.

Sadly I have not been able to find a work around.
I have been continuing to work with InfluxDB 2.0.9 for the time being.

I had the same issue. But I resolved it by using NFS file shares instead of SMB.
This is a bit more complex to setup in Azure but once done it works really well =)

Things you need:

  • VNet
  • SubNet
  • Premium Storage Account + SubNet ACL
  • NFS File Share
  • Managed Container Env + NFS Azure File Share

From there it’s no difference to mount these inside the container app