mpous / helium-data-hotspot

12 stars 16 forks source link

Packet-forwarder unable to find _conf.json #8

Closed bi-sn closed 2 years ago

bi-sn commented 2 years ago

I tried to create a miner. I used both ways. Balena deploy and then I tried to create my own release (both according to the guide in the readme) Both times I get the same error.

packet-forwarder ERROR: [main] failed to find any configuration file named global_conf.json, local_conf.json OR debug_conf.json

I use a Raspberry Pi4 with a RAK shield.

Complete Log:

 packet-forwarder  Starting
 packet-forwarder  SX1301
 packet-forwarder  Frequency EU868
 packet-forwarder  *** Beacon Packet Forwarder for Lora Gateway ***
 packet-forwarder  Version: 4.0.1
 packet-forwarder  *** Lora concentrator HAL library version info ***
 packet-forwarder  Version: 5.0.1;
 packet-forwarder  ***
 packet-forwarder  INFO: Little endian host
 packet-forwarder  ERROR: [main] failed to find any configuration file named global_conf.json, local_conf.json OR debug_conf.json
 packet-forwarder  Software crashed, restarting
Bjoerns-TB commented 2 years ago

Hi,

open a terminal sesion to the packet-forwarder and copy both files from the sx1301 folder to /opt/iotloragateway/packet_forwarder

mpous commented 2 years ago

@Bjoerns-TB @bi-sn could you please try now to deploy the newest version? Let me know if you have any issue now!

bi-sn commented 2 years ago

@mpous Build fails [helium-miner] Step 12/14 : COPY keys.py . [helium-miner] COPY failed: stat /var/lib/balena32/tmp/docker-builder550136731/keys.py: no such file or directory

mpous commented 2 years ago

Apologizes for that @bi-sn i solved that! Try again!

bi-sn commented 2 years ago

Seems like it's still the original problem

 packet-forwarder  2022-02-18 13:26:12,520 - [DEBUG] - __main__ - (__main__.py).validate_env -- /opt/pktfwd/__main__.py:(63) - Starting with the following ENV:
 packet-forwarder          VARIANT=DIY-RAK2287
 packet-forwarder          REGION_OVERRIDE=EU868
 packet-forwarder          REGION_FILEPATH=/var/pktfwd/region
 packet-forwarder          SX1301_REGION_CONFIGS_DIR=opt/iotloragateway/packet_forwarder/sx1301
 packet-forwarder          SX1302_REGION_CONFIGS_DIR=/opt/pktfwd/config/lora_templates_sx1302
 packet-forwarder          SENTRY_KEY=False
 packet-forwarder          BALENA_ID=089980aee83f6dd58ca113a54eeb1f1c
 packet-forwarder          BALENA_APP=helium-data-hotspot
 packet-forwarder          DIAGNOSTICS_FILEPATH=/var/pktfwd/diagnostics
 packet-forwarder          AWAIT_SYSTEM_SLEEP_SECONDS=5
 packet-forwarder          RESET_LGW_FILEPATH=/opt/reset_lgw.sh
 packet-forwarder          UTIL_CHIP_ID_FILEPATH=/opt/sx1302/chip_id
 packet-forwarder          ROOT_DIR=/opt
 packet-forwarder          SX1302_LORA_PKT_FWD_FILEPATH=/opt/sx1302/lora_pkt_fwd
 packet-forwarder          SX1301_LORA_PKT_FWD_DIR=/opt/sx1301
 packet-forwarder  
 packet-forwarder  2022-02-18 13:26:12,521 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).set_variant_attributes -- /opt/pktfwd/pktfwd_app.py:(91) - Variant DIY-RAK2287 set with reset_pin 17 and spi_bus spidev0.0
 packet-forwarder  2022-02-18 13:26:12,521 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).start -- /opt/pktfwd/pktfwd_app.py:(39) - STARTING PKTFWD
 packet-forwarder  2022-02-18 13:26:12,522 - [DEBUG] - hm_pyhelper.miner_param - (miner_param.py).await_spi_available -- /opt/pktfwd-dependencies/hm_pyhelper/miner_param.py:(217) - SPI bus spidev0.0 Configured Correctly
 packet-forwarder  2022-02-18 13:26:12,523 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).prepare_to_start -- /opt/pktfwd/pktfwd_app.py:(73) - Region set to EU868
 packet-forwarder  2022-02-18 13:26:12,523 - [DEBUG] - pktfwd.utils - (utils.py).await_system_ready -- /opt/pktfwd/utils.py:(53) - Waiting 5 seconds for systems to be ready
 packet-forwarder  2022-02-18 13:26:17,528 - [DEBUG] - pktfwd.utils - (utils.py).await_system_ready -- /opt/pktfwd/utils.py:(55) - System now ready
 packet-forwarder  2022-02-18 13:26:17,529 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).prepare_to_start -- /opt/pktfwd/pktfwd_app.py:(76) - Finished preparing pktfwd
 packet-forwarder  2022-02-18 13:26:18,617 - [DEBUG] - pktfwd.utils - (utils.py).is_concentrator_sx1302 -- /opt/pktfwd/utils.py:(82) - Command '['/opt/sx1302/chip_id', '-d', '/dev/spidev0.0']' returned non-zero exit status 1.
 packet-forwarder  2022-02-18 13:26:18,617 - [DEBUG] - pktfwd.utils - (utils.py).replace_sx1301_global_conf_with_regional -- /opt/pktfwd/utils.py:(131) - Copying SX1301 global conf from opt/iotloragateway/packet_forwarder/sx1301/EU-global_conf.json to /opt/global_conf.json
 packet-forwarder  2022-02-18 13:26:18,618 - [ERROR] - __main__ - (__main__.py).start -- /opt/pktfwd/__main__.py:(104) - __main__ failed for unknown reason
 packet-forwarder  Traceback (most recent call last):
 packet-forwarder    File "/opt/pktfwd/__main__.py", line 100, in start
 packet-forwarder      pktfwd_app.start()
 packet-forwarder    File "/opt/pktfwd/pktfwd_app.py", line 45, in start
 packet-forwarder      update_global_conf(is_sx1302, self.root_dir,
 packet-forwarder    File "/opt/pktfwd/utils.py", line 109, in update_global_conf
 packet-forwarder      replace_sx1301_global_conf_with_regional(root_dir,
 packet-forwarder    File "/opt/pktfwd/utils.py", line 133, in replace_sx1301_global_conf_with_regional
 packet-forwarder      copyfile(region_config_filepath, global_config_filepath)
 packet-forwarder    File "/usr/local/lib/python3.10/shutil.py", line 254, in copyfile
 packet-forwarder      with open(src, 'rb') as fsrc:
 packet-forwarder  FileNotFoundError: [Errno 2] No such file or directory: 'opt/iotloragateway/packet_forwarder/sx1301/EU-global_conf.json'
 packet-forwarder  2022-02-18 13:26:18,625 - [INFO] - __main__ - (__main__.py).start -- /opt/pktfwd/__main__.py:(106) - Stopping and cleaning up pktfwd
 packet-forwarder  2022-02-18 13:26:18,625 - [DEBUG] - pktfwd.pktfwd_app - (pktfwd_app.py).stop -- /opt/pktfwd/pktfwd_app.py:(79) - STOPPING PKTFWD
Service exited 'packet-forwarder sha256:6d753968c6b408b078235bef284f84aa05fb643878356d4002cd4adfd4ac9a57'
mpous commented 2 years ago

@bi-sn are you using SX1301 LoRa concentrator? I haven't tried myself however try this VARIANT Device Variable --> https://github.com/NebraLtd/hm-pyhelper/blob/f8b2d8ceb90cfcd1da658a73e3741cc6de2ff1ff/hm_pyhelper/hardware_definitions.py#L223

bi-sn commented 2 years ago

Yes I use a SX1301. Changing the Variant into DIY-PISLGH did not change the outcome. Seems like the problem is: FileNotFoundError: [Errno 2] No such file or directory: 'opt/iotloragateway/packet_forwarder/sx1301/EU-global_conf.json'

mpous commented 2 years ago

i don't have right now with my a SX1301! i will test next week a SX1301 myself! apologizes for that @bi-sn

shawaj commented 2 years ago

@bi-sn what sx1301 concentrator are you using? do you have the exact model number?

mpous commented 2 years ago

@shawaj some people is using the RAK2245!

bi-sn commented 2 years ago

Oh .. I'm sorry I did not answer. Did overlook your Question. I use a RAK 2245 Pi Shield 868mhz https://store.rakwireless.com/products/rak2245-pi-hat?variant=39946145792198

mpous commented 2 years ago

@bi-sn is this the USB or SPI version?

shawaj commented 2 years ago

I don't understand why it's looking for the file at opt/iotloragateway/packet_forwarder/sx1301/EU-global_conf.json

It should be looking for it at /opt/pktfwd/config/lora_templates_sx1301/EU-global_conf.json

As per: https://github.com/mpous/helium-data-hotspot/blob/f54226a27179cf010319127beba03c8146434858/hm-pktfwd/Dockerfile#L42

It looks like from the debug output you have something overriding the SX1301_REGION_CONFIGS_DIR environment variable to an incorrect value:

SX1301_REGION_CONFIGS_DIR=opt/iotloragateway/packet_forwarder/sx1301

Have you set a fleet or device environment variable setting this value somewhere?

shawaj commented 2 years ago

P.S. our Nebra packet forwarder codebase definitely works with rak2245 as I've tasted it multiple times (including just today) so it must be a local issue with how you've deployed it @bi-sn

bi-sn commented 2 years ago

I'm puzzled. I don't know where the override came from but @shawaj is correct. I removed the override and it seems to work Thank you