open balena cli login returns BalenaInvalidLoginCredentials

Hi - I’m working through the Getting Started guide which is well-written and easy to follow.

I’ve run the quickstart, started open balena, installed the cli and ca.cert to my local host, and can run reach the “ping” API endpoint with no problem, get a 200 OK.

Next I try “balena login”, and get

BalenaInvalidLoginCredentials: Invalid login credentials

BalenaInvalidLoginCredentials: Invalid login credentials
at authenticate (/usr/local/lib/balena-cli/node_modules/balena-sdk/es2018/auth.js:170:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async login (/usr/local/lib/balena-cli/node_modules/balena-sdk/es2018/auth.js:203:23)
From previous event:
at processImmediate (node:internal/timers:466:21)

I retried a few times making sure I’m entering the creds ok, and no luck, eventually getting BalenaTooManyRequests. I gave it some time to cool off.

I read another forum which suggested checking OPENBALENA_SUPERUSER_EMAIL and OPENBALENA_SUPERUSER_PASSWORD in config/activate. They were as I was using them, except, my password had a ‘!’ which was escaped with ‘!’. This is probably ok, but just to be safe, I removed the ‘!’ restarted the containers and tried without the ‘!’. No luck.

Looking at logs when I try to login, I see

May 25 18:45:35 ad6a3f096f5e api[1467]: SELECT “user”.“id”, “user”.“actor”, “user”.“username”, “user”.“password”
May 25 18:45:35 ad6a3f096f5e api[1467]: FROM “user”
May 25 18:45:35 ad6a3f096f5e api[1467]: WHERE (LOWER(“user”.“email”)) IS NOT NULL AND (LOWER($1)) IS NOT NULL AND (LOWER(“user”.“email”)) = (LOWER($1)) OR (LOWER(“user”.“email”)) IS NULL AND (LOWER($1)) IS NULL

Thinking my password is in a database rather than just the activate file, I wiped the open-balena directory entirely, started from scratch , ran quickstart again with a simple password (no special chars), installed the new ca.crt on the client, and still no luck! “Invalid Login Credentials” each time.

I’m not pasting my password, I read another form where someone had trouble with that. I’m typing it each time.


I’m not sure what’s going wrong on your end, maybe the special character as you suggested, but I’ll help you with resetting the instance and trying it without the special character.

You mention a few things and I’ll explain how it works in open-balena.

  1. The user/password combination is created in a database, this is the open-balena-db container. Changing the username/password in your config doesn’t change it in your open-balena instance afaik. So, first time starting open-balena, it’ll create a user with your specified username & password in the database.

  2. Wiping the open-balena directory doesn’t remove the docker volumes. It’ll only remove the config you’ve created, but the volumes will store data of your instance while running, such as the user, devices, fleets etc. You’ve to remove the volumes, where the most important volume is the db volume. This stores all data, including your user, and the API will probably create a new user with your new credentials on startup. But removing all volumes will be a “full reset”.

  3. Make sure you’re trying to login to your open-balena instance instead of cloudBalena (the default instance of Balena CLI). You mention you see logs when you’re trying to login, so you’re probably doing it right, but just make sure!

Please note Removing all volumes will remove all existing data of your open-balena instance. You’re probably trying to achieve this, but it’s worth mentioning.

Thank you! Removing the volumes worked (I should have thought of that).
Thanks again!