Network server and application server cannot see configuration files on Ubuntu

Hi everyone,
I have a problem during the configuration of the network and application server.

I recently installed all the Chirpstack components on my Raspberry Pi 4. I had a small problem fixed thanks to your support on this forum and everything works now.

Yesterday I tried to help a friend installing Chirpstack on his Ubuntu machine, following exactly all the steps that I took during my installation, but we encountered some difficulties. In particular:

  • we placed the configuration file in the .config/chirpstack-network-server/ and .config/chirpstack-application-server/ directories since on my Raspberry I found that it encountered difficulties in accessing the file inside the /etc/ folder;
  • we named the PostgreSQL databases like on the installation guide, using the exact same password;
  • I gave him exactly my config files, copy-pasting them in the .config respective directories

Nonetheless, once the service is started we find the following message in the log (example from the network server log):

chirpstack-network-server[17109]: time="2020-04-10T09:49:09+02:00" level=warning msg="storage: ping PostgreSQL database error, will retry in 2s" error="pq: password authentication failed for user \"networkserver\""

We have never defined a networkserver user, and the dsn in our configuration file is defined as

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

This is suggesting me that, when the service is started using sudo systemctl start chirpstack-network-server it cannot find the configuration file and it starts with a default value.

We also tried to give all the permissions to all the configuration files using sudo chmod 777 chirpstack-network-server.toml but the warning is still there.

Finally, we also tried stopping the service and starting it with chirpstack-network-server --config .config/chirpstack-network-server/chirpstack-network-server.toml and everything worked with no warning messages, so the file was read at start.

Had you got a similar problem and do you know how to solve it?
Thank you in advance for your help,
Damiano

1 Like

The correct locations are /etc/chirpstack-network-server/chirpstack-network-server.toml and /etc/chirpstack-application-server/chirpstack-application-server.toml. The $HOME/.config/chirpstack-network- ... works, on the $HOME variable of the user under which the server is started.

2 Likes

Hello Everyone,

I have attempted to install the Chirpstack server on to my Ubuntu 20.04 server with the directions provided.

The /etc/chirpstack-network-server directory was placed under the networkserver user, not sure where that user was created. I created a user for my postgres however it was not “networkserver”.

I am having the same issue as @damianolodi which is "error=“pq: password authentication failed for user “networkserver””.

I am unable to even list the directory /etc/chirpstack-network-server because it is owned by the “networkserver” user.

I have placed my file in my home directory $HOME/.config/chirpstack-network-server/chirpstack-network-server.toml

Any suggestions would be greatly appreciated!!
Thanks & Regards
Allan F. Gagnon

use su/sudo commands to edit this files

@eugenev Does the “networkserver” user need to be added to postgres or do I just need to create a user in Ubuntu that will take ownership of the /etc/chirpstack-network-server directory?

system user and database user - different users. to /etc/ directory can have access the users with root priveleges. I told you, use su/sudo to make changes inside this catalogues.
if you carefully read the installation instructions, they describe the steps for creating a postgreSQL user for the corresponding database.

@eugenev Thank you very much for your help so far. I have read the instructions carefully and have created a database user. However the instructions do not say anything about “networkserver” user. I created a chirpstack_ns user in the database. I am wondering how I can get the error fixed do I create a sql user named “networkserver” or do I change ownership of the folder to the user I created in the database?

you not need to create “networkserver” user inside postgresql.
you need to make changes in dsn in .toml files with right username and pass which you create in postgresql while installation process, which you carefully read :slight_smile:

1 Like

@eugenev Again Thank you for your help!! I am sure I have not read anywhere of the particular user “networkserver” in any of the instructions… Am I missing that? or do you make the sql user after you have installed and discovered the user that is created?

just forget about this user. this is linux system user not an postgresql.
just edit .toml files with correct postgresql users credentials which you are created in process of postgresql installation and database creation, in corresponding dsn string.

1 Like

@eugenev - Honestly I want to thank you very much for your help today I have successfully got this working now. thank you again!!

Hello everyone, by the way I had the same problem that is reported here and more than a problem it is a detail when configuring the server.

As in a web page server that uses Apache, every time a configuration file is edited like any of the .toml files, the server must be reloaded again (sudo systemctl restart chirpstack-network-server) so that the new configuration is applied Otherwise, only the previous configuration will remain loaded on the server and it will appear that the changes we make in the system do not apply.

Cheers

Hi Allan,

Sorry for the inconvenience. How did you solve this issue? I get something similar "role "\networkserver\" does not exist"` and `"role "\appserver\" does not exist". I also followed the chirpstack steps to create a database for each and although the services are active, I can’t connect to the app server because I am getting this errors from postgresql. Thank you!