InfluxDb2 backup fails: failed to backup metadata...401 Unauthorized: unauthorized access

Hi, I’m trying to backup my influxdb2 data to restore onto another server. I’m following the docs and using the command:

influx backup -t xxxx backupfile.bak 

I get the following response:

2022/03/12 20:17:30 INFO: Downloading metadata snapshot
Error: failed to backup metadata: failed to download metadata snapshot: InfluxDB OSS-only command failed: 401 Unauthorized: unauthorized access

I’m using the token auto-generated for user “admin” when the influxdb2 instance was created. I’m assuming that’s what they mean by the root token. The token allows me to login successfully as admin in the web UI. The command “influx ping” returns OK for the active config.

Any ideas what I’m doing wrong here?

1 Like

Ok I found an API token in the default org called “admin’s token” and thought I’d try that. It worked! Would be good if the docs were a bit clearer on where to find that information.

3 Likes

Same issue, I am using a config with an newly generated all access token.

influx bucket list

ID                      Name                                            Retention       Shard group duration    Organization ID         Schema Type
f04592181d6d8ab0        _monitoring                                     168h0m0s        24h0m0s                 2e9e6fd557cf47b4        implicit
b8e9184cefd3cf21        _tasks                                          72h0m0s         24h0m0s                 2e9e6fd557cf47b4        implicit
and a few more ..

influx backup ./influx-dump
Error: failed to backup metadata: failed to download metadata snapshot: 401 Unauthorized: read:authorizations is unauthorized

I have the same issue with version:
Influx CLI v2.7.5 (git: a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:35:09Z

The access works whith the commands: influx auth list and influx bucket list

But why the backup command does not work ?

Hi gsmackers, you wrote, that you found the API token, but where? I have the same problem, the new generated admin token would not work:

influx backup -t xy test.bak
INFO: Downloading metadata snapshot
Error: failed to backup metadata: failed to download metadata snapshot: 401 Unauthorized: read:authorizations is unauthorized

Try influx auth list on the influx CLI and see what you get.

I try it from Docker → Influx Container Console, with root. The same response.
Is there any difference between CLI and Container command console?

root@5aca1b24a575:/# influx auth list
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access

Here’s what I did:

$ docker exec -it influxdb bash
root@influxdb:/# influx config list
Active  Name            URL                     Org
        scrutiny        http://localhost:8086   scrutiny
*       default         http://localhost:8086   instantdreams
        homeassistant   http://localhost:8086   homeassistant
root@influxdb:/# influx auth list
ID                      Description     Token                                                                                           User Name       User ID                     Permissions
0acbf650a257e000        instantdreams   [redacted]        admin           0aa65c66faa7d000    [read:orgs/b962535ddb0d5f55/annotations write:orgs/b962535ddb0d5f55/annotations read:orgs/b962535ddb0d5f55/authorizations write:orgs/b962535ddb0d5f55/authorizations read:orgs/b962535ddb0d5f55/buckets write:orgs/b962535ddb0d5f55/buckets read:orgs/b962535ddb0d5f55/checks write:orgs/b962535ddb0d5f55/checks read:orgs/b962535ddb0d5f55/dashboards write:orgs/b962535ddb0d5f55/dashboards read:orgs/b962535ddb0d5f55/dbrp write:orgs/b962535ddb0d5f55/dbrp read:orgs/b962535ddb0d5f55/documents write:orgs/b962535ddb0d5f55/documents read:orgs/b962535ddb0d5f55/labels write:orgs/b962535ddb0d5f55/labels read:orgs/b962535ddb0d5f55/notebooks write:orgs/b962535ddb0d5f55/notebooks read:orgs/b962535ddb0d5f55/notificationEndpoints write:orgs/b962535ddb0d5f55/notificationEndpoints read:orgs/b962535ddb0d5f55/notificationRules write:orgs/b962535ddb0d5f55/notificationRules read:/orgs/b962535ddb0d5f55 read:orgs/b962535ddb0d5f55/remotes write:orgs/b962535ddb0d5f55/remotes read:orgs/b962535ddb0d5f55/replications write:orgs/b962535ddb0d5f55/replications read:orgs/b962535ddb0d5f55/scrapers write:orgs/b962535ddb0d5f55/scrapers read:orgs/b962535ddb0d5f55/secrets write:orgs/b962535ddb0d5f55/secrets read:orgs/b962535ddb0d5f55/sources write:orgs/b962535ddb0d5f55/sources read:orgs/b962535ddb0d5f55/tasks write:orgs/b962535ddb0d5f55/tasks read:orgs/b962535ddb0d5f55/telegrafs write:orgs/b962535ddb0d5f55/telegrafs read:/users/0aa65c66faa7d000 write:/users/0aa65c66faa7d000 read:orgs/b962535ddb0d5f55/variables write:orgs/b962535ddb0d5f55/variables read:orgs/b962535ddb0d5f55/views write:orgs/b962535ddb0d5f55/views]

You could also try this:

root@influxdb:/# influx auth list --token [redacted]
ID                      Description     Token                                                                                           User Name       User ID                     Permissions
0acbf650a257e000        instantdreams   [redacted]        admin           0aa65c66faa7d000    [read:orgs/b962535ddb0d5f55/annotations write:orgs/b962535ddb0d5f55/annotations read:orgs/b962535ddb0d5f55/authorizations write:orgs/b962535ddb0d5f55/authorizations read:orgs/b962535ddb0d5f55/buckets write:orgs/b962535ddb0d5f55/buckets read:orgs/b962535ddb0d5f55/checks write:orgs/b962535ddb0d5f55/checks read:orgs/b962535ddb0d5f55/dashboards write:orgs/b962535ddb0d5f55/dashboards read:orgs/b962535ddb0d5f55/dbrp write:orgs/b962535ddb0d5f55/dbrp read:orgs/b962535ddb0d5f55/documents write:orgs/b962535ddb0d5f55/documents read:orgs/b962535ddb0d5f55/labels write:orgs/b962535ddb0d5f55/labels read:orgs/b962535ddb0d5f55/notebooks write:orgs/b962535ddb0d5f55/notebooks read:orgs/b962535ddb0d5f55/notificationEndpoints write:orgs/b962535ddb0d5f55/notificationEndpoints read:orgs/b962535ddb0d5f55/notificationRules write:orgs/b962535ddb0d5f55/notificationRules read:/orgs/b962535ddb0d5f55 read:orgs/b962535ddb0d5f55/remotes write:orgs/b962535ddb0d5f55/remotes read:orgs/b962535ddb0d5f55/replications write:orgs/b962535ddb0d5f55/replications read:orgs/b962535ddb0d5f55/scrapers write:orgs/b962535ddb0d5f55/scrapers read:orgs/b962535ddb0d5f55/secrets write:orgs/b962535ddb0d5f55/secrets read:orgs/b962535ddb0d5f55/sources write:orgs/b962535ddb0d5f55/sources read:orgs/b962535ddb0d5f55/tasks write:orgs/b962535ddb0d5f55/tasks read:orgs/b962535ddb0d5f55/telegrafs write:orgs/b962535ddb0d5f55/telegrafs read:/users/0aa65c66faa7d000 write:/users/0aa65c66faa7d000 read:orgs/b962535ddb0d5f55/variables write:orgs/b962535ddb0d5f55/variables read:orgs/b962535ddb0d5f55/views write:orgs/b962535ddb0d5f55/views]

Do you have your token?

Thank you for your message. Yes, I have my admin token (not the original, but the newly created admin token that works with Nodered and Grafana).

root@7021514ea053:/# influx config list
Active Name URL Org

  •   influxtobi      http://localhost:8086   privat
    

root@7021514ea053:/# influx auth list
ID Description Token >User Name User ID Permissions
0e182a6b2df9c000 admin >xxxx admin 0e04898d8208d000 [read:orgs/6a228787c823bbb2/annotations write:orgs/6a228787c823bbb2/annotations read:orgs/6a228787c823bbb2/authorizations write:orgs/6a228787c823bbb2/authorizations read:orgs/6a228787c823bbb2/buckets write:orgs/6a228787c823bbb2/buckets read:orgs/6a228787c823bbb2/checks write:orgs/6a228787c823bbb2/checks read:orgs/6a228787c823bbb2/dashboards write:orgs/6a228787c823bbb2/dashboards read:orgs/6a228787c823bbb2/dbrp write:orgs/6a228787c823bbb2/dbrp read:orgs/6a228787c823bbb2/documents write:orgs/6a228787c823bbb2/documents read:orgs/6a228787c823bbb2/labels write:orgs/6a228787c823bbb2/labels read:orgs/6a228787c823bbb2/notebooks write:orgs/6a228787c823bbb2/notebooks read:orgs/6a228787c823bbb2/notificationEndpoints write:orgs/6a228787c823bbb2/notificationEndpoints read:orgs/6a228787c823bbb2/notificationRules write:orgs/6a228787c823bbb2/notificationRules read:/orgs/6a228787c823bbb2 read:orgs/6a228787c823bbb2/remotes write:orgs/6a228787c823bbb2/remotes read:orgs/6a228787c823bbb2/replications write:orgs/6a228787c823bbb2/replications read:orgs/6a228787c823bbb2/scrapers write:orgs/6a228787c823bbb2/scrapers read:orgs/6a228787c823bbb2/secrets write:orgs/6a228787c823bbb2/secrets read:orgs/6a228787c823bbb2/sources write:orgs/6a228787c823bbb2/sources read:orgs/6a228787c823bbb2/tasks write:orgs/6a228787c823bbb2/tasks read:orgs/6a228787c823bbb2/telegrafs write:orgs/6a228787c823bbb2/telegrafs read:/users/0e04898d8208d000 write:/users/0e04898d8208d000 read:orgs/6a228787c823bbb2/variables write:orgs/6a228787c823bbb2/variables read:orgs/6a228787c823bbb2/views write:orgs/6a228787c823bbb2/views]
0e18393323f9f000 onboarding-cliWizard-token-1733839776108 xxx admin 0e04898d8208d000 [read:orgs/6a228787c823bbb2/annotations write:orgs/6a228787c823bbb2/annotations read:orgs/6a228787c823bbb2/authorizations write:orgs/6a228787c823bbb2/authorizations read:orgs/6a228787c823bbb2/buckets write:orgs/6a228787c823bbb2/buckets read:orgs/6a228787c823bbb2/checks write:orgs/6a228787c823bbb2/checks read:orgs/6a228787c823bbb2/dashboards write:orgs/6a228787c823bbb2/dashboards read:orgs/6a228787c823bbb2/dbrp write:orgs/6a228787c823bbb2/dbrp read:orgs/6a228787c823bbb2/documents write:orgs/6a228787c823bbb2/documents read:orgs/6a228787c823bbb2/labels write:orgs/6a228787c823bbb2/labels read:orgs/6a228787c823bbb2/notebooks write:orgs/6a228787c823bbb2/notebooks read:orgs/6a228787c823bbb2/notificationEndpoints write:orgs/6a228787c823bbb2/notificationEndpoints read:orgs/6a228787c823bbb2/notificationRules write:orgs/6a228787c823bbb2/notificationRules read:/orgs/6a228787c823bbb2 read:orgs/6a228787c823bbb2/remotes write:orgs/6a228787c823bbb2/remotes read:orgs/6a228787c823bbb2/replications write:orgs/6a228787c823bbb2/replications read:orgs/6a228787c823bbb2/scrapers write:orgs/6a228787c823bbb2/scrapers read:orgs/6a228787c823bbb2/secrets write:orgs/6a228787c823bbb2/secrets read:orgs/6a228787c823bbb2/sources write:orgs/6a228787c823bbb2/sources read:orgs/6a228787c823bbb2/tasks write:orgs/6a228787c823bbb2/tasks read:orgs/6a228787c823bbb2/telegrafs write:orgs/6a228787c823bbb2/telegrafs read:/users/0e04898d8208d000 write:/users/0e04898d8208d000 read:orgs/6a228787c823bbb2/variables write:orgs/6a228787c823bbb2/variables read:orgs/6a228787c823bbb2/views write:orgs/6a228787c823bbb2/views]
0e183e8b93f9f000 onboarding-cliWizard-token-1733841177377 xxxx admin 0e04898d8208d000 [read:orgs/6a228787c823bbb2/annotations write:orgs/6a228787c823bbb2/annotations read:orgs/6a228787c823bbb2/authorizations write:orgs/6a228787c823bbb2/authorizations read:orgs/6a228787c823bbb2/buckets write:orgs/6a228787c823bbb2/buckets read:orgs/6a228787c823bbb2/checks write:orgs/6a228787c823bbb2/checks read:orgs/6a228787c823bbb2/dashboards write:orgs/6a228787c823bbb2/dashboards read:orgs/6a228787c823bbb2/dbrp write:orgs/6a228787c823bbb2/dbrp read:orgs/6a228787c823bbb2/documents write:orgs/6a228787c823bbb2/documents read:orgs/6a228787c823bbb2/labels write:orgs/6a228787c823bbb2/labels read:orgs/6a228787c823bbb2/notebooks write:orgs/6a228787c823bbb2/notebooks read:orgs/6a228787c823bbb2/notificationEndpoints write:orgs/6a228787c823bbb2/notificationEndpoints read:orgs/6a228787c823bbb2/notificationRules write:orgs/6a228787c823bbb2/notificationRules read:/orgs/6a228787c823bbb2 read:orgs/6a228787c823bbb2/remotes write:orgs/6a228787c823bbb2/remotes read:orgs/6a228787c823bbb2/replications write:orgs/6a228787c823bbb2/replications read:orgs/6a228787c823bbb2/scrapers write:orgs/6a228787c823bbb2/scrapers read:orgs/6a228787c823bbb2/secrets write:orgs/6a228787c823bbb2/secrets read:orgs/6a228787c823bbb2/sources write:orgs/6a228787c823bbb2/sources read:orgs/6a228787c823bbb2/tasks write:orgs/6a228787c823bbb2/tasks read:orgs/6a228787c823bbb2/telegrafs write:orgs/6a228787c823bbb2/telegrafs read:/users/0e04898d8208d000 write:/users/0e04898d8208d000 read:orgs/6a228787c823bbb2/variables write:orgs/6a228787c823bbb2/variables read:orgs/6a228787c823bbb2/views write:orgs/6a228787c823bbb2/views]

root@7021514ea053:/# influx auth list --token [redacted]
Error: could not find authorization with given parameters: 401 Unauthorized: unauthorized access

You might want to delete that message, we can see your tokens

Thanks for the tip, it’s in the test environment, but I still removed the token

What I found out isn’t really new: If I reinstall Influx, the first token works fine. if I delete that and create a new admin token. This doesn’t work and the first token no longer works either

Same issue here. influx CLI v2.7.5, OSS server running on 2.7.10. Fresh new admin tokens, works fine for other commands it seems except for backup.

I am an occasional user, so not in the weeds of what’s going on with influx.

http-debug output:

$ influx backup --bucket "home_assistant" ./test.backup --http-debug
2024/12/14 14:20:22
GET /health HTTP/1.1
Host: 192.168.10.206:8086
User-Agent: influx/2.7.5 (darwin) Sha/a79a2a1b82 Date/2024-04-16T14:32:10Z
Accept: application/json
Authorization: Token [redacted]
Accept-Encoding: gzip


2024/12/14 14:20:22
HTTP/1.1 200 OK
Content-Length: 138
Content-Type: application/json; charset=utf-8
Date: Sat, 14 Dec 2024 13:20:22 GMT
X-Influxdb-Build: OSS
X-Influxdb-Version: v2.7.10

{"name":"influxdb", "message":"ready for queries and writes", "status":"pass", "checks":[], "version": "v2.7.10", "commit": "f302d9730c"}

2024/12/14 14:20:22 INFO: Downloading metadata snapshot
2024/12/14 14:20:22
GET /api/v2/backup/metadata HTTP/1.1
Host: 192.168.10.206:8086
User-Agent: influx/2.7.5 (darwin) Sha/a79a2a1b82 Date/2024-04-16T14:32:10Z
Accept: application/json
Accept-Encoding: gzip
Authorization: Token [redacted]


2024/12/14 14:20:22
HTTP/1.1 401 Unauthorized
Content-Length: 71
Content-Type: application/json; charset=utf-8
Date: Sat, 14 Dec 2024 13:20:22 GMT
Vary: Accept-Encoding
X-Influxdb-Build: OSS
X-Influxdb-Version: v2.7.10
X-Platform-Error-Code: unauthorized

{"code":"unauthorized","message":"read:authorizations is unauthorized"}
Error: failed to backup metadata: failed to download metadata snapshot: 401 Unauthorized: read:authorizations is unauthorized

My token, being a full access one (like others) has a long list of permissions, but oddly enough not one that says “read:authorizations”. Or I guess the read:orgs/302de4aae2d3d1ff/authorizations would the one to be taken into account. Bear in mind this is a token created through the UI with all permissions. So not sure what else can be done, looks like a bug to me.

0e1d4c62bd554000        FBI-M4 client                   [redacted]        my_user_name         0a34a14631ced000        [read:orgs/302de4aae2d3d1ff/annotations write:orgs/302de4aae2d3d1ff/annotations read:orgs/302de4aae2d3d1ff/authorizations write:orgs/302de4aae2d3d1ff/authorizations read:orgs/302de4aae2d3d1ff/buckets write:orgs/302de4aae2d3d1ff/buckets read:orgs/302de4aae2d3d1ff/checks write:orgs/302de4aae2d3d1ff/checks read:orgs/302de4aae2d3d1ff/dashboards write:orgs/302de4aae2d3d1ff/dashboards read:orgs/302de4aae2d3d1ff/dbrp write:orgs/302de4aae2d3d1ff/dbrp read:orgs/302de4aae2d3d1ff/documents write:orgs/302de4aae2d3d1ff/documents read:orgs/302de4aae2d3d1ff/labels write:orgs/302de4aae2d3d1ff/labels read:orgs/302de4aae2d3d1ff/notebooks write:orgs/302de4aae2d3d1ff/notebooks read:orgs/302de4aae2d3d1ff/notificationEndpoints write:orgs/302de4aae2d3d1ff/notificationEndpoints read:orgs/302de4aae2d3d1ff/notificationRules write:orgs/302de4aae2d3d1ff/notificationRules read:/orgs/302de4aae2d3d1ff read:orgs/302de4aae2d3d1ff/remotes write:orgs/302de4aae2d3d1ff/remotes read:orgs/302de4aae2d3d1ff/replications write:orgs/302de4aae2d3d1ff/replications read:orgs/302de4aae2d3d1ff/scrapers write:orgs/302de4aae2d3d1ff/scrapers read:orgs/302de4aae2d3d1ff/secrets write:orgs/302de4aae2d3d1ff/secrets read:orgs/302de4aae2d3d1ff/sources write:orgs/302de4aae2d3d1ff/sources read:orgs/302de4aae2d3d1ff/tasks write:orgs/302de4aae2d3d1ff/tasks read:orgs/302de4aae2d3d1ff/telegrafs write:orgs/302de4aae2d3d1ff/telegrafs read:/users/0a34a14631ced000 write:/users/0a34a14631ced000 read:orgs/302de4aae2d3d1ff/variables write:orgs/302de4aae2d3d1ff/variables read:orgs/302de4aae2d3d1ff/views write:orgs/302de4aae2d3d1ff/views]

2.7.11 is out, I’ll check it out.

Ya’ll go put a thumb up over there, despite the fact that I think, with 2K open issues…

Hello, I think the problem is the influxd.bolt file in /var/lib/inlufxdb2. I don’t know how exactly in this file. But I think if we generate a new full admin token and delete the original token, the new token will not definitely have all the rights. We can also call it an Influx software bug.

I have a workaround. I used Grafana to read out the data, have a look to the resolution and adjusting it so that it is usable. The exported data (time stamp corrected to 19 digits with a excel vbs script) with line protocol into the newly installed influx transferred, where the admin can now make backups etc. again.

An example from the line protocol:
tempmax value=13.4 1732789235064000000
tempmax value=24.7 1732838400000000000
tempmax value=21.2 1732924800000000000