Login Error Problem in Lora App Server

Hello!

Today, after many weeks, i tried to log into Lora Server and seem to have incorrect username or password.

Any idea?

Thanks in advance.

Enter the correct password? :grin:

Hello brocaar…of course…i had by default admin/admin…is any way to change it, or i need to reinstall lora server?

No need for reinstallation, just connect to your lora-app-server DB, check that the admin user is there and change its password_hash to this:

PBKDF2$sha512$100000$4u3hL8krvlMIS0KnCYXeMw==$G7c7tuUYq2zSJaUeruvNL/KF30d3TVDORVD56wzvJYmc3muWjoaozH8bHJ7r8zY8dW6Pts2bWyhFfkb/ubQZsA==

In more detail, first run this command:

psql -U lora-app-server-user -d lora-app-server-db

You’ll get prompted for your password and then connect to the DB. On psql, check that the user exists:

select * from "user" where username = 'admin';

Now reset the user’s password and exit psql:

update "user" set password_hash = 'PBKDF2$sha512$100000$4u3hL8krvlMIS0KnCYXeMw==$G7c7tuUYq2zSJaUeruvNL/KF30d3TVDORVD56wzvJYmc3muWjoaozH8bHJ7r8zY8dW6Pts2bWyhFfkb/ubQZsA==' where username = 'admin';
\q

Thanks @iegomez…but after disabling admin account, how can be possibly to log into lora server?

I’m not sure what you mean by that. Did you delete the user?

I mean that, after deleting, as which user will i log into lora server?

But why did you delete it? Didn’t you create other users before doing so? In any case, you could just insert one manually (I’ll go with admin/admin just for simplicity) at the DB with is_admin set to true so that you can use that user to login and later create other users.

insert into "user"(created_at, updated_at, username, password_hash, session_ttl, is_active, is_admin, email, note) 
values(now(), now(), 'admin', 'PBKDF2$sha512$100000$4u3hL8krvlMIS0KnCYXeMw==$G7c7tuUYq2zSJaUeruvNL/KF30d3TVDORVD56wzvJYmc3muWjoaozH8bHJ7r8zY8dW6Pts2bWyhFfkb/ubQZsA==', 0, true, true, 'some@email.com', 'some_note');

Hello

I also had this issue with my login. After many days working with no problems now I can not login anymore. I reset the admin/admin password in my db but still not working.

This is the fail after a login try in the browser
{“error”:“authentication failed: validator func error: select error: pq: invalid page in block 0 of relation base/16710/16982”,“message”:“authentication failed: validator func error: select error: pq: invalid page in block 0 of relation base/16710/16982”,“code”:16,“details”:[]}

I can see in the journalctrl -f -n 50 -u lora-app-server the same message each second.
May 07 12:38:37 BSQ-LoRa lora-app-server[1524]: time=“2020-05-07T12:38:37+02:00” level=error msg=“send gateway ping error: get gateway for ping error: select error: pq: invalid page in block 0 of relation base/16710/16982”
May 07 12:38:38 BSQ-LoRa lora-app-server[1524]: time=“2020-05-07T12:38:38+02:00” level=error msg=“send gateway ping error: get gateway for ping error: select error: pq: invalid page in block 0 of relation base/16710/16982”

Any clue in how to solve it?

After many tries I suspected the problem came from postgres and database. I finally decided to drop the table and recreate it, as I had no important information there. Now the login is working again, however I’m worried if this happen again, when critical information is stored.

Possibly a corrupted database. Any clue in what happened and how to recover from this?

invalid page in block 0 of relation base/16710/16982

That is a PostgreSQL error. I have not seen this error myself, but if you search (Google) on “invalid page in block 0 of relation” you will find some similar cases. Maybe it helps to find more about the root cause.

Yes thanks, I did but it was quicker to recreate the database. Now it works fine. It looks like it could be a corrupted file due a loss in power or hard reboot. It is a prototype and subjected to mistreatment from my side, however it is the first time to happen.

For those who cannot affor the lose of the database here is a suitable solution that I didn’t test. I thought it could be useful information to the forum.

https://pganalyze.com/docs/log-insights/server/S6

1 Like