LoRa Server Installation on CentOS

Does it start when you manually do it via:

sudo systemctl start loraserver

then check it is running.
sudo systemctl status loraserver

Please check to ensure in your loraserver.service file property:
ExecStart=/opt/loraserver/loraserver
is pointing to the correct location of where you installed the loraserver

I have installed multiple times and the services work. Check the syslog to see if there are any errors in there that may help.

Gary

Hi Gary,

It’s OK now, I reinstalled the VM and now it’s OK, for information loraserver 3.0.2 works perfectly with centOS 7.6.

Thanks a lot for your support

Thomas

1 Like

Great guide, however i have a problem installing dirmngr.

followed the steps and got this error

[root@localhost ~]# yum install dirmngr
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirror.ppa.trinitydesktop.org/trinity/trinity/rpm/el7/trinity-r14-x86_64.list error was
14: HTTP Error 404 - Not Found

Any ideas?

Hi,
sorry for the late reply.

the full url mush have been cut off in the guide. You need to download the noarch.RPM then install it before trying to install the package.

Steps you should perform.

wget http://mirror.ppa.trinitydesktop.org/trinity/trinity/rpm/el7/trinity-r14/RPMS/noarch/trinity-repo-14.0.6-1.el7.noarch.rpm
sudo rpm -Uvh trinity-repo*rpm
sudo yum install dirmngr

Let me know how you get on.

CentOS 7.7 x64 here

rpm -Uvh trinity-repo*rpm

warning: trinity-repo-14.0.7-1.el7.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 2ab131c6: NOKEY
Preparing… ################################# [100%]
package trinity-repo-14.0.7-1.el7.noarch is already installed

sudo yum install dirmngr

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirror.layeronline
  • epel: d2lzkl7pfhq30w.cloudfront
  • extras: mirror.layeronline
  • trinity-r14: copernicus.mirrorservice
  • trinity-r14-noarch: copernicus.mirrorservice
  • updates: mirror.layeronline
    No package dirmngr available.
    Error: Nothing to do

<note: removed the TLD and replaced with because as a new user, only allowed 2 links apparently in my post…>

3 other issues:

1- Running ‘systemctl enable loraserver’ and then ‘journalctl –f –n 50 –u loraserver’ shows the following output:
Jan 10 22:06:56 localhost.localdomain systemd[1]: Started LoRa Server.
Jan 10 22:06:56 localhost.localdomain loraserver[10710]: time=“2020-01-10T22:06:56-05:00” level=info msg=“starting LoRa Server” band=EU_863_870 docs=“https:/www.loraserver.io/” net_id=000000 version=3.0.0
Jan 10 22:06:56 localhost.localdomain loraserver[10710]: time=“2020-01-10T22:06:56-05:00” level=info msg=“storage: setting up storage module”
Jan 10 22:06:56 localhost.localdomain loraserver[10710]: time=“2020-01-10T22:06:56-05:00” level=info msg=“storage: setting up Redis connection pool”
Jan 10 22:06:56 localhost.localdomain loraserver[10710]: time=“2020-01-10T22:06:56-05:00” level=info msg=“storage: connecting to PostgreSQL”
Jan 10 22:06:56 localhost.localdomain loraserver[10710]: time=“2020-01-10T22:06:56-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error="pq: role “root” does not exist"

Can’t seem to figure out how to get the PostgreSQL db to connect – the /etc/loraserver/loraserver.toml file contains (and ‘mypw’ is correct – I also previously set up the roles using ‘sudo –u postgres psql’ and then ‘create role loraserver_ns with login password ‘mypw’;’ & ‘create database loraserver_ns with owner loraserver_ns;):
dsn=“postgres://loraserver_ns:mypw@localhost/loraserver_ns?sslmode=disable”
automigrate=true
name=“EU_863_870”
timezone=“Local”
server=“tcp://127.0.0.1:1883”

2- For the lora-app-server:

systemctl start lora-app-server

systemctl status lora-app-server

â lora-app-server.service - LoRa App Server
Loaded: loaded (/usr/lib/systemd/system/lora-app-server.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Fri 2020-01-10 22:47:40 EST; 294ms ago
Docs: https://www.loraserver.io/
Process: 13280 ExecStart=/opt/lora-app-server/lora-app-server (code=exited, status=203/EXEC)
Main PID: 13280 (code=exited, status=203/EXEC)

Jan 10 22:47:40 localhost.localdomain systemd[1]: Unit lora-app-server.service entered failed state.
Jan 10 22:47:40 localhost.localdomain systemd[1]: lora-app-server.service failed.
Jan 10 22:47:40 localhost.localdomain systemd[1]: lora-app-server.service holdoff time over, scheduling restart.
Jan 10 22:47:40 localhost.localdomain systemd[1]: Stopped LoRa App Server.
Jan 10 22:47:40 localhost.localdomain systemd[1]: start request repeated too quickly for lora-app-server.service
Jan 10 22:47:40 localhost.localdomain systemd[1]: Failed to start LoRa App Server.
Jan 10 22:47:40 localhost.localdomain systemd[1]: Unit lora-app-server.service entered failed state.
Jan 10 22:47:40 localhost.localdomain systemd[1]: lora-app-server.service failed.

3- Nowhere in the instructions did I see it say to install ttn-gateway, but at the end, it says to run ‘systemctl status ttn-gateway’ to ‘ensure that all services are running’?

Hi,

sorry for late reply.

You are correct at the end of the instructions it should NOT have asked you to check the status of the ttn-gateway. I will remove this line.

Regarding the error you have highlighted " storage: ping PostgreSQL database error, will retry in 2s” error="pq: role “root” does not exist" this looks to be an error with your toml file.

Can you check the following:

  1. sudo vi /etc/postgresql/9.3/main/pg_hba.conf
    #ensure the 127.0.0.1/32 host entry is as follows:
    host all 127.0.0.1/32 trust
  2. Restart postgresql if need changed
  3. Try and login to postgresql using your credenticals:
    psql -h localhost -U loraserver_ns -W loraserver_ns
    #and also
    psql -h localhost -U loraserver_as -W loraserver_as
    #Ensure you are able to login with the password in the toml files.

Please note that loraserver has been updated to ChirpStack and the configuration files have changed names that the services pick up. Ensure once you perform the install the files are correct.

  • /etc/lora-gateway-bridge/lora-gateway-bridge.toml –> /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
  • /etc/lora-app-server/lora-app-server.toml –> /etc/chirpstack-application-server/chirpstack-application-server.toml
  • /etc/loraserver/loraserver.toml –> /etc/chirpstack-network-server/chirpstack-network-server.toml

Thanks for the reply!

My pg_hba.conf is at: /var/lib/pgsql/9.6/data/pg_hba.conf (instead of /etc/postgresql/9.3/main/pg_hba.conf) – yes, running 9.6 it seems, instead of 9.3 – could that be one cause?

These are the host entries in that file:

TYPE DATABASE USER ADDRESS METHOD

local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust

Logging into postgresql with my credentials works:

[root@localhost ~]# psql -h localhost -U loraserver_ns -W loraserver_ns
Password for user loraserver_ns:
psql (9.6.16)
Type “help” for help.

loraserver_ns=>

[root@localhost ~]# psql -h localhost -U loraserver_as -W loraserver_as
Password for user loraserver_as:
psql (9.6.16)

Funny though, just tried entering an INCORRECT password to login and it seemed to work? (no error shown)

Hi,

yes, it should be postgres 9.6, my mistake.

If you can check the toml files dsn entry and ensure it is correct, e.g. should look like
dsn="postgres://loraserver_as:YourPassword@localhost/loraserver_as?sslmode=disable"

Let me know how you get on.

I will also be redoing the how to guide based on the latest ChirpStack rpms.

Will keep you posted.
Gary

Gary, thanks so much for your guidance!

The toml files (/etc/lora-app-server/lora-app-server.toml && /etc/loraserver/loraserver.toml) both have dsn entries identical to the one you provided (with the correct password). It should be noted that my password has a hash ("#") in it - not sure if that might pose an issue?

Regardless of what I do, I continue to get the following error when I start the lora server:

[root@localhost ~]# systemctl status loraserver
â loraserver.service - LoRa Server
Loaded: loaded (/usr/lib/systemd/system/loraserver.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-01-10 22:24:29 EST; 4 days ago
Docs: https://www.loraserver.io/
Main PID: 11842 (loraserver)
Tasks: 12
Memory: 10.8M
CGroup: /system.slice/loraserver.service
ââ11842 /opt/loraserver/loraserver

Jan 15 13:12:30 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:30-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:32 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:32-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:34 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:34-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:36 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:36-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:38 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:38-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:40 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:40-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:42 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:42-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:44 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:44-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:46 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:46-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”
Jan 15 13:12:48 localhost.localdomain loraserver[11842]: time=“2020-01-15T13:12:48-05:00” level=warning msg=“storage: ping PostgreSQL database error, will retry in 2s” error=“pq: role “root” does not exist”

Hi Gary (and others) - any suggestions on my issue? Still stuck at the same place…

Hi Tsh,

this is related to postgres DNS assignment. Please see here for other users that have had this same issue.

Please ensure the dns is correct in your toml files. Note: they should be enclosed in " " e.g.

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

Let me know how you get on.
Gary

1 Like

Thanks Gary! For anyone else running into this issue, fixed it with:
sudo -u postgres createuser MISSINGROLE -d -P

I have re-generated the jwt_secret so many times, but same issue – it’s just not detecting it. Also tried to manually set the env variable for jwt_secret using the following, but same issue:
[root@localhost ~]# export jwt_secret=“U7Wt3woh12Ze7IdGKlJlRVi4oMG5UrFcnExPevKkNic=”
[root@localhost lora-app-server]# openssl rand -base64 32
cXVjfuoQzGq0MHvdRpWGRlvyS65ibf39cUcSTY382Ik=

[root@localhost lora-app-server]# cat lora-app-server.toml
dsn=“postgres://loraserver_as:******@localhost/loraserver_as?sslmode=disable”
jwt_secret=“cXVjfuoQzGq0MHvdRpWGRlvyS65ibf39cUcSTY382Ik=”
server=“tcp://localhost:1883”
public_host=“localhost:8001”

[root@localhost lora-app-server]# /opt/lora-app-server/lora-app-server --config /etc/lora-app-server/lora-app-server.toml
INFO[0000] starting LoRa App Server docs=“https://www.loraserver.io/” version=3.0.0
INFO[0000] storage: setting up storage package
INFO[0000] storage: setting up Redis pool
INFO[0000] storage: connecting to PostgreSQL database
INFO[0000] storage: applying PostgreSQL data migrations
INFO[0000] storage: PostgreSQL data migrations applied count=0
INFO[0000] integration/mqtt: TLS config is empty
INFO[0000] integration/mqtt: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] api/as: starting application-server api bind=“0.0.0.0:8001” ca_cert= tls_cert= tls_key=
INFO[0000] integration/mqtt: connected to mqtt broker
INFO[0000] integration/mqtt: subscribing to tx topic qos=0 topic=application/+/device/+/tx
FATA[0000] setup api error: setup external api error: jwt_secret must be set!

Any ideas?

Have you tried:

/opt/lora-app-server/lora-app-server configfile -c /etc/lora-app-server/lora-app-server.toml

That might be helpful when you have an error in your config (e.g. wrong name / section, …). It will generate a configfile with all the (detected) values from lora-app-server.toml.

Btw, have you tried to set it up using the provided RPM packages? Please see the downloads section in the documentation for each component :slight_smile:

This was supremely helpful, thank you! The -c output showed an empty jwt_secret:

JWT secret used for api authentication / authorization

You could generate this by executing ‘openssl rand -base64 32’ for example

jwt_secret=""

Why would that be? Any idea how I can get the jwt_secret to be properly populated from the toml/config file?

Solution described inside the .toml file, use this:

Most likely because the config key was in the wrong place and therefore was not interpreted. I recommend to use the output of configfile as a new start and fill in the missing bits :slight_smile:

Hi Tsh,

I am currently doing out a new wiki howto based on the RPM provide by Chirpstack. I will post it up once complete and fully tested.

It looks like your issues are steaming from the config file, please generate a new one as @brocaar has suggested then edit.

Gary