Can't run `influx backup` or create recovery operator token

I no longer have the root account for my Influx database. The whole install was messed up from being upgraded from v1 to v2 by over-eager Ubuntu repo maintainers a while back but it has continued to "work (read/write). Now I want to migrate to a container-based database and cannot run influx backup due to having no “operator” tokens. There only seems to be one user according to sudo influxd recovery auth list --bolt-path /var/lib/influxdb/influxd.bolt and it does not have any operator tokens.

If I try to create a recovery operator token, I get this error:

> sudo influxd recovery auth create-operator --bolt-path /var/lib/influxdb2/influxd.bolt --org myorg --username telegraf
2023-01-06T16:43:50.662557Z     info    Resources opened        {"log_id": "0fD~K41W000", "system": "bolt-kvstore", "path": "/var/lib/influxdb2/influxd.bolt"}
Error: bucket "authorizationsv1": bucket not found
See 'influxd -h' for help

So I can’t backup the database and I can’t create new users and I can’t create a recovery operator token. How do I migrate my database?

If anyone else has this issue, I solved it by following the steps in this post except for the file /var/lib/influxdb/influxd.bolt. I had problems getting boltbroswer installing via go so had to find a pre-built binary. I needed to add quite a lot of permissions to my already “admin” token to get influx backup to run correctly. I’m guessing only the “read” ones were available but given how arduous this process was I didn’t want to take chances:

{“action”:“read”,“resource”:{“type”:“authorizations”}},{“action”:“write”,“resource”:{“type”:“authorizations”}},{“action”:“read”,“resource”:{“type”:“buckets”}},{“action”:“write”,“resource”:{“type”:“buckets”}},{“action”:“read”,“resource”:{“type”:“dashboards”}},{“action”:“write”,“resource”:{“type”:“dashboards”}},{“action”:“read”,“resource”:{“type”:“orgs”}},{“action”:“write”,“resource”:{“type”:“orgs”}},{“action”:“read”,“resource”:{“type”:“sources”}},{“action”:“write”,“resource”:{“type”:“sources”}},{“action”:“read”,“resource”:{“type”:“tasks”}},{“action”:“write”,“resource”:{“type”:“tasks”}},{“action”:“read”,“resource”:{“type”:“telegrafs”}},{“action”:“write”,“resource”:{“type”:“telegrafs”}},{“action”:“read”,“resource”:{“type”:“users”}},{“action”:“write”,“resource”:{“type”:“users”}},{“action”:“read”,“resource”:{“type”:“variables”}},{“action”:“write”,“resource”:{“type”:“variables”}},{“action”:“read”,“resource”:{“type”:“scrapers”}},{“action”:“write”,“resource”:{“type”:“scrapers”}},{“action”:“read”,“resource”:{“type”:“secrets”}},{“action”:“write”,“resource”:{“type”:“secrets”}},{“action”:“read”,“resource”:{“type”:“labels”}},{“action”:“write”,“resource”:{“type”:“labels”}},{“action”:“read”,“resource”:{“type”:“views”}},{“action”:“write”,“resource”:{“type”:“views”}},{“action”:“read”,“resource”:{“type”:“documents”}},{“action”:“write”,“resource”:{“type”:“documents”}},{“action”:“read”,“resource”:{“type”:“notificationRules”}},{“action”:“write”,“resource”:{“type”:“notificationRules”}},{“action”:“read”,“resource”:{“type”:“notificationEndpoints”}},{“action”:“write”,“resource”:{“type”:“notificationEndpoints”}},{“action”:“read”,“resource”:{“type”:“checks”}},{“action”:“write”,“resource”:{“type”:“checks”}},{“action”:“read”,“resource”:{“type”:“dbrp”}},{“action”:“write”,“resource”:{“type”:“dbrp”}},{“action”:“read”,“resource”:{“type”:“notebooks”}},{“action”:“write”,“resource”:{“type”:“notebooks”}},{“action”:“read”,“resource”:{“type”:“annotations”}},{“action”:“write”,“resource”:{“type”:“annotations”}},{“action”:“read”,“resource”:{“type”:“remotes”}},{“action”:“write”,“resource”:{“type”:“remotes”}},{“action”:“read”,“resource”:{“type”:“replications”}},{“action”:“write”,“resource”:{“type”:“replications”}}

@DragonQ,
Thank you for sharing your question and answer with the community!