Error after upgrade from influxdb 1.8 to 2.1

After upgrading my influxdb from 1.8 to 2.1 I‘m getting this strange error:

Recreating docker-compose_influxdb_1 ... done
Attaching to docker-compose_influxdb_1
influxdb_1                  | 2022-03-11T15:18:28.071939968Zinfofound existing boltdb file, skipping setup wrapper{"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | 2022-03-11T15:18:28.801228010Zinfofound existing boltdb file, skipping setup wrapper{"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | ts=2022-03-11T15:18:29.252795Z lvl=info msg="Welcome to InfluxDB" log_id=0_AOnnX0000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
influxdb_1                  | ts=2022-03-11T15:18:29.297807Z lvl=info msg="Resources opened" log_id=0_AOnnX0000 service=bolt path=/var/lib/influxdb2/influxd.bolt
influxdb_1                  | ts=2022-03-11T15:18:29.302683Z lvl=info msg="Resources opened" log_id=0_AOnnX0000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
influxdb_1                  | ts=2022-03-11T15:18:29.348913Z lvl=info msg="Bringing up metadata migrations" log_id=0_AOnnX0000 service="SQL migrations" migration_count=3
influxdb_1                  | ts=2022-03-11T15:18:34.372420Z lvl=error msg="Failed to apply SQL migrations" log_id=0_AOnnX0000 error="database is locked"
influxdb_1                  | Error: database is locked
influxdb_1                  | See 'influxd -h' for help

I have googled a lot, but it looks like nobody is experiencing this issue.
Please ask if you need more information!

I would say the most useful additional information would be to tell us
precisely the steps you followed (if documented, just post the URL) to perform
the upgrade.

Antony.

You’re right.
Before the update, my docker-compose file looked like this:

  influxdb:
    image: influxdb:1.8
    ports:
      - 8086:8086
    volumes:
      - /mnt/export/docker-compose_influxdb-storage/_data:/var/lib/influxdb
    environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_BIND_ADDRESS=:8088
      - INFLUXDB_MONITOR_STORE_ENABLED=FALSE
      - INFLUXDB_UDP_ENABLED=true
      - INFLUXDB_UDP_DATABASE=traefik

Then for the upgrade, I changed the docker-compose to this:

services:
  influxdb:
    image: influxdb:2.1
    ports:
      - 8086:8086
    volumes:
      - /mnt/export/docker-compose_influxdb-storage/_data:/var/lib/influxdb
      - /mnt/export/docker-compose_influxdb2-storage/_data:/var/lib/influxdb2
    environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_BIND_ADDRESS=:8088
      - INFLUXDB_MONITOR_STORE_ENABLED=FALSE
      - INFLUXDB_UDP_ENABLED=true
      - INFLUXDB_UDP_DATABASE=traefik
      - DOCKER_INFLUXDB_INIT_USERNAME=admin
      - DOCKER_INFLUXDB_INIT_PASSWORD=pass
      - DOCKER_INFLUXDB_INIT_ORG=default_org
      - DOCKER_INFLUXDB_INIT_BUCKET=default_bucket
      - DOCKER_INFLUXDB_INIT_MODE=upgrade

The logs are:

Attaching to docker-compose_influxdb_1
influxdb_1                  | {"level":"info","ts":1647034175.9243014,"caller":"upgrade/upgrade.go:402","msg":"Starting InfluxDB 1.x upgrade"}
influxdb_1                  | {"level":"info","ts":1647034175.9245882,"caller":"upgrade/upgrade.go:416","msg":"No InfluxDB 1.x config file specified, skipping its upgrade"}
influxdb_1                  | {"level":"info","ts":1647034175.9246473,"caller":"upgrade/upgrade.go:419","msg":"Upgrade source paths","meta":"/var/lib/influxdb/meta","data":"/var/lib/influxdb/data"}
influxdb_1                  | {"level":"info","ts":1647034175.9247005,"caller":"upgrade/upgrade.go:420","msg":"Upgrade target paths","bolt":"/var/lib/influxdb2/influxd.bolt","engine":"/var/lib/influxdb2/engine"}
influxdb_1                  | {"level":"info","ts":1647034176.0454903,"caller":"bolt/bbolt.go:83","msg":"Resources opened","service":"bolt","path":"/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | {"level":"info","ts":1647034176.0827873,"caller":"migration/migration.go:175","msg":"Bringing up metadata migrations","service":"migrations","migration_count":18}
influxdb_1                  | {"level":"info","ts":1647034180.9933364,"caller":"upgrade/setup.go:73","msg":"CLI config has been stored.","path":"/etc/influxdb2/influx-configs"}
influxdb_1                  | {"level":"info","ts":1647034180.993465,"caller":"upgrade/database.go:202","msg":"Checking available disk space"}
influxdb_1                  | {"level":"info","ts":1647034182.589874,"caller":"upgrade/database.go:223","msg":"Computed disk space","free":"720 GB","required":"6.9 GB"}
influxdb_1                  | {"level":"info","ts":1647034182.590177,"caller":"upgrade/database.go:51","msg":"Upgrading databases"}
^[influxdb_1                  | {"level":"info","ts":1647034389.611691,"caller":"upgrade/database.go:195","msg":"Database upgrade complete","upgraded_count":2}
influxdb_1                  | {"level":"info","ts":1647034389.6119316,"caller":"upgrade/security.go:45","msg":"Upgrading 1.x users"}
influxdb_1                  | {"level":"warn","ts":1647034389.6128318,"caller":"upgrade/security.go:50","msg":"User is admin and will not be upgraded","username":"admin"}
influxdb_1                  | {"level":"info","ts":1647034389.6130471,"caller":"upgrade/security.go:115","msg":"User upgrade complete","upgraded_count":0}
influxdb_1                  | {"level":"info","ts":1647034389.6146784,"caller":"upgrade/upgrade.go:489","msg":"Upgrade successfully completed. Start the influxd service now, then log in","login_url":"http://localhost:8086"}
influxdb_1                  | 2022-03-11T21:33:12.654893544Z    info    found existing boltdb file, skipping setup wrapper      {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | ts=2022-03-11T21:33:13.146784Z lvl=info msg="Welcome to InfluxDB" log_id=0_AjF6EW000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
influxdb_1                  | ts=2022-03-11T21:33:13.191596Z lvl=info msg="Resources opened" log_id=0_AjF6EW000 service=bolt path=/var/lib/influxdb2/influxd.bolt
influxdb_1                  | ts=2022-03-11T21:33:13.196853Z lvl=info msg="Resources opened" log_id=0_AjF6EW000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
influxdb_1                  | ts=2022-03-11T21:33:13.242402Z lvl=info msg="Bringing up metadata migrations" log_id=0_AjF6EW000 service="SQL migrations" migration_count=3
influxdb_1                  | ts=2022-03-11T21:33:18.285558Z lvl=error msg="Failed to apply SQL migrations" log_id=0_AjF6EW000 error="database is locked"
influxdb_1                  | Error: database is locked
influxdb_1                  | See 'influxd -h' for help
docker-compose_influxdb_1 exited with code 1

After the upgrade, I used this docker-compose:

  influxdb:
    image: influxdb:2.1
    ports:
      - 8086:8086
    volumes:
      - /mnt/export/docker-compose_influxdb2-storage/_data:/var/lib/influxdb2
    environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_BIND_ADDRESS=:8088
      - INFLUXDB_MONITOR_STORE_ENABLED=FALSE
      - INFLUXDB_UDP_ENABLED=true
      - INFLUXDB_UDP_DATABASE=traefik

But getting again only this error:

Attaching to docker-compose_influxdb_1
influxdb_1                  | 2022-03-11T21:37:38.800573527Z    info    found existing boltdb file, skipping setup wrapper      {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | 2022-03-11T21:37:39.546419886Z    info    found existing boltdb file, skipping setup wrapper      {"system": "docker", "bolt_path": "/var/lib/influxdb2/influxd.bolt"}
influxdb_1                  | ts=2022-03-11T21:37:39.998408Z lvl=info msg="Welcome to InfluxDB" log_id=0_AjVOcW000 version=2.1.1 commit=657e1839de build_date=2021-11-09T03:03:48Z
influxdb_1                  | ts=2022-03-11T21:37:40.093601Z lvl=info msg="Resources opened" log_id=0_AjVOcW000 service=bolt path=/var/lib/influxdb2/influxd.bolt
influxdb_1                  | ts=2022-03-11T21:37:40.098814Z lvl=info msg="Resources opened" log_id=0_AjVOcW000 service=sqlite path=/var/lib/influxdb2/influxd.sqlite
influxdb_1                  | ts=2022-03-11T21:37:40.183728Z lvl=info msg="Bringing up metadata migrations" log_id=0_AjVOcW000 service="SQL migrations" migration_count=3
influxdb_1                  | Error: database is locked
influxdb_1                  | See 'influxd -h' for help
influxdb_1                  | ts=2022-03-11T21:37:45.210252Z lvl=error msg="Failed to apply SQL migrations" log_id=0_AjVOcW000 error="database is locked"
docker-compose_influxdb_1 exited with code 1

I solved it with using a local volume on the Raspi instead of the path to my NAS. After the upgrade, I manually moved the data to the NAS and then Influxdb2 was also working from the NAS.

One last question, do this environment variables still have any effect in influxdb v2?

environment:
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_BIND_ADDRESS=:8088
      - INFLUXDB_MONITOR_STORE_ENABLED=FALSE
      - INFLUXDB_UDP_ENABLED=true
      - INFLUXDB_UDP_DATABASE=traefik