Failed to apply SQL migrations - database is locked

Hey :slight_smile:

I am using a helm chart (influxdata/influxdb2) to install my InfluxDB, with these custom values:

image:
  repository: influxdb
  tag: 2.7.4-alpine
  pullPolicy: IfNotPresent

service:
  type: LoadBalancer

persistence:
  enabled: true
  storageClass: "smb-sc"
  accessMode: ReadWriteOnce
  size: 15Gi
  mountPath: /var/lib/influxdb2

Once installed, everything gets provisioned (Persitentvolume, PVC, pods, etc) - but the pod is in a crash loop, because the database is locked during the installation.

{                                                                                                                                                                                                                                                        β”‚
β”‚   "bolt-path": "/var/lib/influxdb2/influxd.bolt",                                                                                                                                                                                                        β”‚
β”‚   "engine-path": "/var/lib/influxdb2/engine",                                                                                                                                                                                                            β”‚
β”‚   "nats-port": 4222,                                                                                                                                                                                                                                     β”‚
β”‚   "http-bind-address": ":9999"                                                                                                                                                                                                                           β”‚
β”‚ }                                                                                                                                                                                                                                                        β”‚
β”‚ 2024-12-04T13:16:07.    info    booting influxd server in the background    {"system": "docker"}                                                                                                                                                         β”‚
β”‚ ts=2024-12-04T13:16:07.187954Z lvl=info msg="Welcome to InfluxDB" log_id=0tGSrj_l000 version=v2.7.4 commit=19e5c0e1b7 build_date=2023-11-08T17:07:39Z log_level=info                                                                                     β”‚
β”‚ ts=2024-12-04T13:16:07.187974Z lvl=warn msg="nats-port argument is deprecated and unused" log_id=0tGSrj_l000                                                                                                                                             β”‚
β”‚ ts=2024-12-04T13:16:07.198003Z lvl=info msg="Resources opened" log_id=0tGSrj_l000 service=bolt path=/var/lib/influxdb2/influxd.bolt                                                                                                                      β”‚
β”‚ ts=2024-12-04T13:16:07.198070Z lvl=info msg="Resources opened" log_id=0tGSrj_l000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite                                                                                                                  β”‚
β”‚ ts=2024-12-04T13:16:07.199500Z lvl=info msg="Bringing up metadata migrations" log_id=0tGSrj_l000 service="KV migrations" migration_count=20                                                                                                              β”‚
β”‚ ts=2024-12-04T13:16:07.347685Z lvl=info msg="Bringing up metadata migrations" log_id=0tGSrj_l000 service="SQL migrations" migration_count=8                                                                                                              β”‚
β”‚ 2024-12-04T13:16:08.    info    pinging influxd...    {"system": "docker", "ping_attempt": "0"}                                                                                                                                                          β”‚
β”‚ 2024-12-04T13:16:09.    info    pinging influxd...    {"system": "docker", "ping_attempt": "1"}                                                                                                                                                          β”‚
β”‚ 2024-12-04T13:16:10.    info    pinging influxd...    {"system": "docker", "ping_attempt": "2"}                                                                                                                                                          β”‚
β”‚ 2024-12-04T13:16:11.    info    pinging influxd...    {"system": "docker", "ping_attempt": "3"}                                                                                                                                                          β”‚
β”‚ 2024-12-04T13:16:12.    info    pinging influxd...    {"system": "docker", "ping_attempt": "4"}                                                                                                                                                          β”‚
β”‚ Error: database is locked                                                                                                                                                                                                                                β”‚
β”‚ See 'influxd -h' for help                                                                                                                                                                                                                                β”‚
β”‚ ts=2024-12-04T13:16:12.363407Z lvl=error msg="Failed to apply SQL migrations" log_id=0tGSrj_l000 error="database is locked"                                                                                                                              β”‚
β”‚ 2024-12-04T13:16:13.    info    pinging influxd...    {"system": "docker", "ping_attempt": "5"}                                                                                                                                                          β”‚
β”‚ /entrypoint.sh: line 285: kill: (92) - No such process                                                                                                                                                                                                   β”‚
β”‚ 2024-12-04T13:16:13.    error    influxd crashed during startup    {"system": "docker", "total_pings": "6"}                                                                                                                                              β”‚
β”‚ 2024-12-04T13:16:13.    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"}

I have found several blogpost now, describing that moving the volumeMount to a local path, rather than a network CSI (SMB, NFS, etc) it works - which i can confirm, even though the files are provisioned correctly on the SMB share.

Error after upgrade from influxdb 1.8 to 2.1 - InfluxDB 2 - InfluxData Community Forums

InfluxDB on Docker: Error: database is locked - InfluxDB 2 - InfluxData Community Forums

I have PostgreSQL, Grafana, CheckMK and similar services running on the same storageclass (smb-sc), and they are working without any issues.

My question is:
Can i skip the SQL migration scripts somehow, or even better - get InfluxDB to natively work on network attached storage?

Hello @ksl28,
I’m not sure. I’m asking around. Thanks for your patience.

Hello @ksl28,
This probably has something to do with the volume being read only. Since accessMode: ReadWriteOnce , you might want to check that another InfluxDB deployment is not already using that persistent volume.

Also, FWIW, Google AI claims that influxd upgrade --skip-migrations and an associated env var exist, but I can’t find any evidence that they actually do.