Upgrading from influxdb to influxdb2 with Docker still fails

I have tried it several times but with no success sofar. I’m running a Docker container with currently Influx 1.8.10, Grafana 9.2.0 and Telegraf 1.24.2. I’m maintaining the image and upgrading it occassionally when Grafana or Telegraf has been upgraded. This works like a charm.
But as Influx 1.x is very outdated I wanted to give it a try to upgrade this to version 2.x. Created a new image with Influx 2.x and the latest Grafana and Telegraf. Tried starting it up initially through the following command:

docker run
-p 3003:3003
-p 3004:8083
-p 8086:8086
-p 22022:22
-v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro
-v influxdb1_data:/var/lib/influxdb
-v influxdb_log:/var/log/influxdb
-v influxdb2_data:/var/lib/influxdb2
-v influxdb2_log:/var/log/influxdb2
-v grafana_data:/var/lib/grafana
-v grafana_log:/var/log/grafana
-v telegraf_log:/var/log/telegraf
-e DOCKER_INFLUXDB_INIT_MODE=upgrade
-e DOCKER_INFLUXDB_INIT_USERNAME=admin
-e DOCKER_INFLUXDB_INIT_PASSWORD=xxxxx
-e DOCKER_INFLUXDB_INIT_ORG=myorg
-e DOCKER_INFLUXDB_INIT_BUCKET=mybucket
-e DOCKER_INFLUXDB_INIT_UPGRADE_V1_CONFIG=/etc/influxdb/influxdb.conf
-e INFLUXD_CONFIG_PATH=/etc/influxdb2/config.toml
-e INFLUXD_BOLT_PATH=/etc/influxdb2/influxdb.bolt
-e INFLUXD_ENGINE_PATH=/etc/influxdb2/engine
-e "GF_SECURITY_ADMIN_USER=xxxx
-e “GF_SECURITY_ADMIN_PASSWORD=xxxxxxx”
pluim003/influxdb2-grafana-telegraf:dev

Followed also the suggestion to chown /var/lib/influxdb to the influxdb-user (chown -R influxdb:influxdb instead of chown -R 1000:1000 as the influxdb-user in this image has PUID and GUID 999.
Unfortunately no logging but the only thing shown is:

pi@raspberrypi:~/influxdb2 $ ./influx_upgrade.sh
/usr/lib/python3/dist-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a “-c” argument specifying an absolute path to a configuration file for improved security.
self.warnings.warn(
2022-10-17 08:57:35,925 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2022-10-17 08:57:35,926 INFO Included extra file “/etc/supervisor/conf.d/supervisord.conf” during parsing
2022-10-17 08:57:35,936 INFO RPC interface ‘supervisor’ initialized
2022-10-17 08:57:35,936 CRIT Server ‘unix_http_server’ running without any HTTP authentication checking
2022-10-17 08:57:35,937 INFO supervisord started with pid 1
2022-10-17 08:57:36,945 INFO spawned: ‘influxdb’ with pid 7
2022-10-17 08:57:36,954 INFO spawned: ‘telegraf’ with pid 8
2022-10-17 08:57:36,965 INFO spawned: ‘grafana’ with pid 9
2022-10-17 08:57:38,103 INFO success: influxdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-10-17 08:57:38,103 INFO success: telegraf entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-10-17 08:57:38,103 INFO success: grafana entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-10-17 08:57:38,116 INFO exited: influxdb (exit status 1; not expected)
2022-10-17 08:57:39,120 INFO spawned: ‘influxdb’ with pid 32
2022-10-17 08:57:40,152 INFO success: influxdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-10-17 08:57:40,165 INFO exited: influxdb (exit status 1; not expected)
2022-10-17 08:57:41,169 INFO spawned: ‘influxdb’ with pid 49
2022-10-17 08:57:42,201 INFO success: influxdb entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

What can cause this?

No clues yet? Seems that I already had an account but created (with the same emailaddress) a new one (linked to github).

I can upgrade my Influxdb 1.8 to 2.5 with

docker run -d -p 8086:8086 \
  --name influxdb2_upgrade \
  -v influxdb_data:/var/lib/influxdb \
  -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
  -v influxdb2_data:/var/lib/influxdb2 \
  -e DOCKER_INFLUXDB_INIT_MODE=upgrade \
  -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=xxxxxx \
  -e DOCKER_INFLUXDB_INIT_ORG=my-org \
  -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
  influxdb:latest

Noticed that it also creates a file called influx-configs with the following contents:

[default]
  url = "http://localhost:8086"
  token = "qfankGtJuZlPweyVALODrnXMtvEmLYwYZdKgQCWUgWhI04uippNFvsyEAdbHUysK4oqqEVxT1dhNgIX7ulsacw=="
  org = "my-org"
  active = true
#
# [eu-central]
#   url = "https://eu-central-1-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
#
# [us-central]
#   url = "https://us-central1-1.gcp.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""
#
# [us-west]
#   url = "https://us-west-2-1.aws.cloud2.influxdata.com"
#   token = "XXX"
#   org = ""

I copy this part with the token in config.toml to be used in my container.

After this I want to fire up my combined container (with telegraf and grafana) and using the same config

docker run -d \
  --name influxdb2-grafana-dev \
  -p 3003:3003 \
  -p 3004:8083 \
  -p 8086:8086 \
  -p 22022:22 \
  -v influxdb1_data:/var/lib/influxdb \
  -v influxdb1_log:/var/log/influxdb \
  -v influxdb2_data:/var/lib/influxdb2 \
  -v influxdb2_log:/var/log/influxdb2 \
  -v influxdb2_etc:/etc/influxdb \
  -v grafana_data:/var/lib/grafana \
  -v grafana_log:/var/log/grafana \
  -v telegraf_log:/var/log/telegraf \
  -e DOCKER_INFLUXDB_INIT_USERNAME=admin \
  -e DOCKER_INFLUXDB_INIT_PASSWORD=xxxxx \
  -e DOCKER_INFLUXDB_INIT_ORG=my-org \
  -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
  -e INFLUXD_CONFIG_PATH=/etc/influxdb2/config.toml \
  -e INFLUXD_BOLT_PATH=/var/lib/influxdb2/influxd.bolt \
  -e INFLUXD_ENGINE_PATH=/var/lib/influxdb2/engine \
  -e "GF_SECURITY_ADMIN_USER=Dick" \
  -e "GF_SECURITY_ADMIN_PASSWORD=xxxxx" \
  pluim003/influxdb2-grafana-telegraf:dev

Starts up nicely.
But entering a command like auth list gives me constantly an error:

root@f14a321d8351:/var/log/influxdb# influx auth list
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access

The searches have unfortunately not found a clue.
And sofar (and I’ve been trying this every now and then since February) I can’t get this to work. Can’t see what I’m missing here.
I also tried to do the upgrade from within this last container which also succeeds (after having entered some credentials) but still every command I give results in the 401.

Any help would be appreciated.

Thanx in advance.

O hold on. I might have found something. A default config.toml is copied in my docker-image during creation, but that is a V1. Although I use the created config.toml which is present in my influxdb2_grafana-container which has only these 3 lines:

bolt-path = “/var/lib/influxdb2/influxd.bolt”
engine-path = “/var/lib/influxdb2/engine”
storage-series-id-set-cache-size = 100

A new influx-configs seems to be recreated when running the upgrade-container.

But the influxdb2-grafana-dev-container uses the same config.toml (probably double-up) as bolt and engine are also to be found in the docker-run-command

But in this influxdb2_upgrade-container I get results with influx auth list, showing me the admin-user with the mentioned token. And influx bucket list gives me the list of the buckets which corresponds the v1-databases

And a bit later. Thought to do inside the container to enter the following command:

export INFLUX_TOKEN= and that did it

Hi, I’m also trying to upgrade from 1.8 to 2.6 using the following code for the docker container:

Blockquote
sudo docker run -d -p 8076:8086
–name influxdb2_upgrade
-v influxdb_data:/var/lib/influxdb/meta
-v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro
-v influxdb2_data:/var/lib/influxdb2
-e DOCKER_INFLUXDB_INIT_MODE=upgrade
-e DOCKER_INFLUXDB_INIT_USERNAME=admin
-e DOCKER_INFLUXDB_INIT_PASSWORD=xxxxx
-e DOCKER_INFLUXDB_INIT_ORG=Andreas
-e DOCKER_INFLUXDB_INIT_BUCKET=homeassistant
influxdb:latest

and I’m getting the follwing error message in the 2.6 container:

Error: 1.x meta.db ‘/var/lib/influxdb/meta/meta.db’ does not exist: stat /var/lib/influxdb/meta/meta.db: no such file or directory See ‘influxd -h’ for help 2023-02-21T11:24:26.838713274Z 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”}

However If I look in the 1.8 folder, there is the following:

root@e7c6c0cf2b95:/# ls /var/lib/influxdb/meta
meta.db

Any ideas, what’s wrong here ?