Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to start systemd service when there's no network to allow version checking #585

Open
dfgg12 opened this issue Nov 13, 2021 · 0 comments

Comments

@dfgg12
Copy link

dfgg12 commented Nov 13, 2021

If script is started through auto_rx.service file enabled in systemd, it fails due to lack of network connection with following output:

Nov 10 11:20:45 alarm systemd[1]: Started auto_rx.
Nov 10 11:20:58 alarm auto_rx[220]: 2021-11-10 11:20:58,828 INFO:Reading configuration file...
Nov 10 11:20:58 alarm auto_rx[220]: 2021-11-10 11:20:58,875 WARNING:Config - APRS Update Rate clipped to minimum of 30 seconds. Please be respectful of other users of APRS-IS.
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,275 INFO:Config - Tested SDR #0 OK
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,307 INFO:Started Flask server on http://0.0.0.0:5000
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,315 INFO:Telemetry Logger - Started Telemetry Logger Thread.
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,338 ERROR:APRS-IS - Connection to APRS-IS Failed - [Errno -2] Name or service not known
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,347 INFO:APRS-IS - APRS Uploader Started.
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,351 INFO:OziMux - Started OziMux / Payload Summary Exporter
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,357 INFO:Sondehub Uploader - Started Sondehub Uploader Thread.
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,455 ERROR:Sondehub Uploader - Upload Failed: HTTPSConnectionPool(host='api.v2.sondehub.org', port=443): Max retries exceeded with url: /listeners (Caused by NewConnectionError('
Nov 10 11:21:02 alarm auto_rx[220]: --- Logging error ---
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
Nov 10 11:21:02 alarm auto_rx[220]: conn = connection.create_connection(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
Nov 10 11:21:02 alarm auto_rx[220]: for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/socket.py", line 954, in getaddrinfo
Nov 10 11:21:02 alarm auto_rx[220]: for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
Nov 10 11:21:02 alarm auto_rx[220]: socket.gaierror: [Errno -2] Name or service not known
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
Nov 10 11:21:02 alarm auto_rx[220]: httplib_response = self._make_request(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
Nov 10 11:21:02 alarm auto_rx[220]: self._validate_conn(conn)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
Nov 10 11:21:02 alarm auto_rx[220]: conn.connect()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
Nov 10 11:21:02 alarm auto_rx[220]: conn = self._new_conn()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
Nov 10 11:21:02 alarm auto_rx[220]: raise NewConnectionError(
Nov 10 11:21:02 alarm auto_rx[220]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xb43ac0d0>: Failed to establish a new connection: [Errno -2] Name or service not known
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
Nov 10 11:21:02 alarm auto_rx[220]: resp = conn.urlopen(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
Nov 10 11:21:02 alarm auto_rx[220]: retries = retries.increment(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
Nov 10 11:21:02 alarm auto_rx[220]: raise MaxRetryError(_pool, url, error or ResponseError(cause))
Nov 10 11:21:02 alarm auto_rx[220]: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/master/auto_rx/autorx/init.py (C>
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 71, in get_autorx_version
Nov 10 11:21:02 alarm auto_rx[220]: _r = requests.get(version_url, timeout=5)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/api.py", line 75, in get
Nov 10 11:21:02 alarm auto_rx[220]: return request('get', url, params=params, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request
Nov 10 11:21:02 alarm auto_rx[220]: return session.request(method=method, url=url, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
Nov 10 11:21:02 alarm auto_rx[220]: resp = self.send(prep, **send_kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
Nov 10 11:21:02 alarm auto_rx[220]: r = adapter.send(request, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
Nov 10 11:21:02 alarm auto_rx[220]: raise ConnectionError(e, request=request)
Nov 10 11:21:02 alarm auto_rx[220]: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/master/auto_rx/autorx/init.py>
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 1083, in emit
Nov 10 11:21:02 alarm auto_rx[220]: msg = self.format(record)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 927, in format
Nov 10 11:21:02 alarm auto_rx[220]: return fmt.format(record)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 663, in format
Nov 10 11:21:02 alarm auto_rx[220]: record.message = record.getMessage()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 367, in getMessage
Nov 10 11:21:02 alarm auto_rx[220]: msg = msg % self.args
Nov 10 11:21:02 alarm auto_rx[220]: TypeError: not all arguments converted during string formatting
Nov 10 11:21:02 alarm auto_rx[220]: Call stack:
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/auto_rx.py", line 1011, in
Nov 10 11:21:02 alarm auto_rx[220]: main()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/auto_rx.py", line 974, in main
Nov 10 11:21:02 alarm auto_rx[220]: version_startup_check()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 132, in version_startup_check
Nov 10 11:21:02 alarm auto_rx[220]: _newer_version = check_autorx_versions()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 100, in check_autorx_versions
Nov 10 11:21:02 alarm auto_rx[220]: _main_branch_version = get_autorx_version(AUTORX_MAIN_VERSION_URL)
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 73, in get_autorx_version
Nov 10 11:21:02 alarm auto_rx[220]: logging.exception(
Nov 10 11:21:02 alarm auto_rx[220]: Message: 'Version - Error determining version from URL https://raw.githubusercontent.com/projecthorus/radiosonde_auto_rx/master/auto_rx/autorx/__init__.py'
Nov 10 11:21:02 alarm auto_rx[220]: Arguments: (ConnectionError(MaxRetryError("HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/master/auto_rx/autorx/__ini>
Nov 10 11:21:02 alarm auto_rx[220]: --- Logging error ---
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
Nov 10 11:21:02 alarm auto_rx[220]: conn = connection.create_connection(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
Nov 10 11:21:02 alarm auto_rx[220]: for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/socket.py", line 954, in getaddrinfo
Nov 10 11:21:02 alarm auto_rx[220]: for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
Nov 10 11:21:02 alarm auto_rx[220]: socket.gaierror: [Errno -2] Name or service not known
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
Nov 10 11:21:02 alarm auto_rx[220]: httplib_response = self._make_request(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
Nov 10 11:21:02 alarm auto_rx[220]: self._validate_conn(conn)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
Nov 10 11:21:02 alarm auto_rx[220]: conn.connect()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
Nov 10 11:21:02 alarm auto_rx[220]: conn = self._new_conn()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
Nov 10 11:21:02 alarm auto_rx[220]: raise NewConnectionError(
Nov 10 11:21:02 alarm auto_rx[220]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0xb440e898>: Failed to establish a new connection: [Errno -2] Name or service not known
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
Nov 10 11:21:02 alarm auto_rx[220]: resp = conn.urlopen(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
Nov 10 11:21:02 alarm auto_rx[220]: retries = retries.increment(
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
Nov 10 11:21:02 alarm auto_rx[220]: raise MaxRetryError(_pool, url, error or ResponseError(cause))
Nov 10 11:21:02 alarm auto_rx[220]: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/testing/auto_rx/autorx/init.py (>
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 71, in get_autorx_version
Nov 10 11:21:02 alarm auto_rx[220]: _r = requests.get(version_url, timeout=5)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/api.py", line 75, in get
Nov 10 11:21:02 alarm auto_rx[220]: return request('get', url, params=params, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/api.py", line 61, in request
Nov 10 11:21:02 alarm auto_rx[220]: return session.request(method=method, url=url, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
Nov 10 11:21:02 alarm auto_rx[220]: resp = self.send(prep, **send_kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
Nov 10 11:21:02 alarm auto_rx[220]: r = adapter.send(request, **kwargs)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
Nov 10 11:21:02 alarm auto_rx[220]: raise ConnectionError(e, request=request)
Nov 10 11:21:02 alarm auto_rx[220]: requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/testing/auto_rx/autorx/init.p>
Nov 10 11:21:02 alarm auto_rx[220]: During handling of the above exception, another exception occurred:
Nov 10 11:21:02 alarm auto_rx[220]: Traceback (most recent call last):
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 1083, in emit
Nov 10 11:21:02 alarm auto_rx[220]: msg = self.format(record)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 927, in format
Nov 10 11:21:02 alarm auto_rx[220]: return fmt.format(record)
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 663, in format
Nov 10 11:21:02 alarm auto_rx[220]: record.message = record.getMessage()
Nov 10 11:21:02 alarm auto_rx[220]: File "/usr/lib/python3.9/logging/init.py", line 367, in getMessage
Nov 10 11:21:02 alarm auto_rx[220]: msg = msg % self.args
Nov 10 11:21:02 alarm auto_rx[220]: TypeError: not all arguments converted during string formatting
Nov 10 11:21:02 alarm auto_rx[220]: Call stack:
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/auto_rx.py", line 1011, in
Nov 10 11:21:02 alarm auto_rx[220]: main()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/auto_rx.py", line 974, in main
Nov 10 11:21:02 alarm auto_rx[220]: version_startup_check()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 132, in version_startup_check
Nov 10 11:21:02 alarm auto_rx[220]: _newer_version = check_autorx_versions()
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 101, in check_autorx_versions
Nov 10 11:21:02 alarm auto_rx[220]: _testing_branch_version = get_autorx_version(AUTORX_TESTING_VERSION_URL)
Nov 10 11:21:02 alarm auto_rx[220]: File "/root/radiosonde_auto_rx/auto_rx/autorx/utils.py", line 73, in get_autorx_version
Nov 10 11:21:02 alarm auto_rx[220]: logging.exception(
Nov 10 11:21:02 alarm auto_rx[220]: Message: 'Version - Error determining version from URL https://raw.githubusercontent.com/projecthorus/radiosonde_auto_rx/testing/auto_rx/autorx/__init__.py'
Nov 10 11:21:02 alarm auto_rx[220]: Arguments: (ConnectionError(MaxRetryError("HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /projecthorus/radiosonde_auto_rx/testing/auto_rx/autorx/__in>
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,582 ERROR:Version - Could not determine latest versions.
Nov 10 11:21:02 alarm auto_rx[220]: 2021-11-10 11:21:02,584 INFO:Task Manager - SDR #0 has been allocated to Scanner.
Nov 10 11:21:05 alarm auto_rx[220]: 2021-11-10 11:21:05,927 INFO:Scanner #0 - Starting Scanner Thread
Nov 10 11:21:05 alarm auto_rx[220]: 2021-11-10 11:21:05,934 INFO:Scanner #0 - Running frequency scan.
Nov 10 11:21:18 alarm auto_rx[220]: 2021-11-10 11:21:18,719 INFO:Sondehub Uploader - Uploaded station information to Sondehub.

Thankfully - solution to that is to add After=network.target to service file to allow network interfaces to get up properly.

Therefore, I've prepared patch for this, which should follow this report with PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant