NebraLtd / hm-pktfwd

Helium Miner Packet Forwarder
https://nebra.io/hnt
MIT License
12 stars 25 forks source link

packet-forwarder unable to start if interface wlan0 is not present #140

Closed ctlynx closed 1 year ago

ctlynx commented 1 year ago

Problem: if /sys/class/net/wlan0/address does not exist, then pktfwd fails and is unable to start.

Error:

Traceback (most recent call last):
  File "/opt/pktfwd-dependencies/hm_pyhelper/miner_param.py", line 323, in get_ethernet_addresses
    diagnostics[key] = get_mac_address(path)
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/pktfwd-dependencies/hm_pyhelper/miner_param.py", line 350, in get_mac_address
    raise MinerFailedToFetchMacAddress("Failed to find file"
  File "/opt/pktfwd-dependencies/hm_pyhelper/miner_param.py", line 344, in get_mac_address
    file = open(path)
           ^^^^^^^^^^
hm_pyhelper.exceptions.MinerFailedToFetchMacAddress: Failed to find filecontaining miner mac address. Exception: [Errno 2] No such file or directory: '/sys/class/net/wlan0/address'

Log file: nebra-error-log.txt

Cause: Method get_ethernet_addresses raises MinerFailedToFetchMacAddress and populate_local_conf_template fails even if the MAC of eth0 could be obtained.

I suppose that get_ethernet_addresses should not fail and simply return the MAC addresses that do exist.

Expected behavior: Miner should be able to startup and operate using eth0 MAC address as before.

It may happen that wlan0 does not exist if wifi dongle is broken or unplugged. On the device I detected the problem, wlan0 does not exist because the dongle is broken. I have not replaced it with a new one because it does not use wifi. So far it was working well connected via ethernet. The dashboard showed that there was no MAC address for wifi, but it worked ok.

HelPi7 commented 1 year ago

Having the same issue!

shawaj commented 1 year ago

Thanks @HelPi7 @ctlynx we're working on a fix.

Also related to https://github.com/NebraLtd/hm-diag/issues/557

robputt commented 1 year ago

See https://nebraltd.atlassian.net/browse/NEBD-181

robputt commented 1 year ago

https://github.com/NebraLtd/hm-pyhelper/pull/253