Error, will retry in 2s: pq: password authentication failed for user “loraserver”"

brocaar,thank you for your help with me ! I am so stupid:sob:

Hi guys, please help me on this. I have exactly followed the instructions of quick install given on https://www.loraserver.io/install/quick-install/. But when I try to reboot the lora server and try to see the logs then it gives me this error. I tried all sorts of online resources but couldn’t resolve it. could anyone help me on where i’m going wrong.

I have created loraserver_ns and loraserver_as as databases for the lora server.I have set two different passwords for lora_ns and lora_as.

– set up the users and the passwords
– (note that it is important to use single quotes and a semicolon at the end!)
create role loraserver_as with login password ‘ABC’;
create role loraserver_ns with login password ‘XYZ’;

– create the database for the servers
create database loraserver_as with owner loraserver_as;
create database loraserver_ns with owner loraserver_ns;

– change to the LoRa App Server database
\c loraserver_as

– enable the pq_trgm extension
– (this is needed to facilidate the search feature)
create extension pg_trgm;

– exit psql
\q

MY DSN CONFIG IN POSTGRES is as follows:
dsn=“postgres:loraserver_ns:XYZ@localhost/loraserver_ns?sslmode=disable”

The DB user trying to connect is wrong (it says loraserver instead of loraserver_ns), which is probably due to a wrong dsn. At your loraserver.toml you should have something like this (following your given steps):

[postgresql]
dsn="postgres://loraserver_ns:XYZ@localhost/loraserver_ns?sslmode=disable"

The same advice goes for lora-app-server if you have a similar problem.

Thanks for quick response. As i have posted in my question the dsn is already configured as you said . Still it says loraserver instead of loraserver_ns.

I have configure it as follows.

Then check the location of your toml file is correct. Also, if you modify it, you need to restart the service for it to pick up any changes.

I have restarted it many times but still got the same error. That means i might be wrong with the location of toml file.
Could you please expand on what exactly you mean by the location of toml file?. Thanks a lot.

You may see where the conf file may be located (or how to define a location) here: https://www.loraserver.io/loraserver/install/config/. The other modules (app server and gateway bridge) have analogous docs.

my message is:
level=error msg=“ping database error, will retry in 2s: dial tcp [::1]:5432: connect: connection refused”

what’s wrong?

Maybe an answer here:

https://forum.loraserver.io/t/error-msg-ping-database-error-will-retry-in-2/134

Hi!

After doing all the changes in config files, my error is:

Nov 07 17:22:18 CMTJM42 systemd[1]: loraserver.service: Scheduled restart job, restart counter is at 4.
Nov 07 17:22:18 CMTJM42 systemd[1]: Stopped LoRa Server.
Nov 07 17:22:18 CMTJM42 systemd[1]: Started LoRa Server.
Nov 07 17:22:18 CMTJM42 loraserver[1603]: time="2018-11-07T17:22:18Z" level=fatal msg="read configuration file error" error="While parsing config: (38, 14): keys cannot contain : character"

This error brings me to the DSN line on every config, but I don’t understand why it displays this error, because I haven’t any " : " character on my password…

In loraserver.toml the config is:

POSTGRES_DSN=postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable

And in lora-app-server.toml the config is:

POSTGRES_DSN=postgres://loraserver_as:dbpassword@localhost/loraserver_as?sslmode=disable

It may be catching “ns:dbpassword” and “as:dbpassword” as the complete passwords?
I haven’t /etc/default/loraserver file neither folder… is anything wrong in my configuration?

Thanks in advance

Please see the configuration example, the above configuration line does not match the expected syntax: https://www.loraserver.io/loraserver/install/config/.

Hi All,
I am also facing the same problem and tried all the suggested solutions. Still, I am facing the same issues. Moreover, I could not access the UI interface by host address. Here I have attached required images. If anyone can help me to fix those issue, it will be really helpful for me.

Thanks it helped me in solving authentication problem

Now I got the new one that stated as

Thanks in advance

Try starting loraserver manually (sudo loraserver --config /path/to/your/conf_file.toml) to see the error directly on the output, or check the logs (sudo journalctl -u loraserver -f -n 50).

It gives error
FATA[0000] error loading config file config=/path/to/your/conf_file.toml error=“open /path/to/your/conf_file.toml: no such file or directory”

Well, of course, that’s a fake path, you need to change it for yours.

Oh that was my mistake

Now It gives that error

**INFO[0000] starting LoRa App Server docs=“https://www.loraserver.io/” version=2.5.1
INFO[0000] connecting to postgresql
ERRO[0000] ping database error, will retry in 2s: pq: password authentication failed for user “root”
ERRO[0002] ping database error, will retry in 2s: pq: password authentication failed for user “root”
ERRO[0004] ping database error, will retry in 2s: pq: password authentication failed for user “root”
**

¿Did you read https://www.loraserver.io/loraserver/install/config/? Because it seems you didn’t configure Postgre’s DSN. In short, loraserver is trying to connect as the running user, in this case root because it was ran with sudo, and that’s because the DSN doesn’t mention any user (which you should have already configured when creating the databases). So you should change this:

dsn="postgres://localhost/loraserver_ns?sslmode=disable"

To this:

dsn="postgres://user:password@hostname/database_name?sslmode=disable"

It’s either that or you are starting loraserver without passing a conf file so it uses defaults.

Thanks for your reply it is helping me solving the issue

Configuration of dns is ok now
it gives that error now

The user that’s connecting to the database (the one mentioned in the DSN) doesn’t have permissions to read or write to the gorp_migrations table. Please read the docs again and redo the Postgres steps (drop the databases and users that you created for loraserver and lora-app-server before redoing them, check Postgres’ docs if you are not familiar with the syntax), your users and databases are not correctly set.