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

what about the version of postgres? try to answer all the questions

On upgrading Postgresql I am having that issue

In my loraserver.toml this is written:

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

When running following command , I’m asked to write password for user ‘loraserver_ns’

psql -U loraserver_ns -d loraserver_ns

Above command works. But still I receive this message:

maj 06 17:04:30 diplom-e18 loraserver[1949]: time="2019-05-06T17:04:30+02:00" level=warning msg="storage: ping PostgreSQL database error, will retry in 2s" error="pq: password authentication failed for user \"loraserver\""`

Can’t understand why it says "… failed for user “loraserver”, when in my toml it’s loraserver_ns

Your toml conf file is probably not getting picked up by loraserver because it’s either on an incorrect location or you’re passing another path to loraserver on start. You can check it works by running it manually with your toml path as seen in the docs:

loraserver --config /path/to/your/conf.toml

Thanks for the reply. When running: “sudo loraserver --config /etc/loraserver/loraserver.toml”

I receive this message:

FATA[0000] error loading config file  config=/etc/loraserver/loraserver.toml error="While parsing config: (1, 1): unexpected token"

What does this mean?

I’d need to see your file to check what’s exactly wrong, but the message is pretty clear: there’s an incorrect token on the first line, first column of your file, i.e., there’s some symbol at the start of the file that shouldn’t be there.

Thanks, @iegomez . As you said there was a wrong symbol on first line…

When running this command:

sudo journalctl -u loraserver -f -n 50

I still receive the same error:

But now this command works:

sudo loraserver --config /etc/loraserver/loraserver.toml

Response:

WHAT I’VE ALREADY DONE:

Changed dsn to:

dsn=“postgres://loraserver_ns:dbpassword@localhost/loraserver_ns?sslmode=disable”


Path to loraserver.toml:

/etc/loraserver/loraserver.toml


psql:

psql -h localhost -d loraserver_ns -U loraserver_ns

Works, and asking for password. Password: “dbpassword”. Also works and I’m logged in.


Changed pg_hba.conf:

postgres auth was set as peer, but was changed to md5

Please avoid going off topic, this topic is about the PostgreSQL password authentication error.

1 Like

@iegomez I’ve done everything in this thread, but still doesn’t work… Maybe you can help?

Just noticed this:

loraserver toml is in following paths:

  • /etc/loraserver/loraserver.toml
  • $HOME/.config/loraserver/loraserver.toml

Copied from /etc/loraserver/loraserver.toml to $HOME/.config/loraserver/loraserver.toml

As Orne said, this if off topic and it’s probably already covered in the forum: https://forum.loraserver.io/search?q=no%20configuration%20file%20found

The postgresql installation default has the listener commented out in postgresql.conf.
Uncomment the listener to enable localhost.

Hi everyone,

I am also facing the problem.
getting error when using
docker-compose run --rm loraserver bash
and cd build
./loraserver
this is the output of ./loraserver

But i want to know how to configure dsn in loraserver

i went to cd loraserver/cmd/loraserver/cmd
in this i got configfile.go


i am confused whether to paste it here or in some other file which is in loraserver or to create a new .toml file and do it.

also getting **authentication failed **error without using docker-compose


please help me in doing this.
@brocaar and @shuangcai_huang

I’m not sure what you are trying to do, but the docker-compose.yml file in each source repository is intended for development and running the (automated) tests. It will not work to run the services as configuration is missing.

Please take a look at the available guides: https://www.loraserver.io/guides/.

Actually I am trying to build loraserver manually. Now, make build is successfully compiled but when i do ./filename for Example: ./loraserver I am getting
ping PostgreSQL database error, will retry in 2s error: password authrentication failed for user "root"

what is the mistake i am doing @brocaar sir???
Please help me in completinf this project manually without docker

Thanks & Regards,
Sadashiv