danielfernau / unifi-protect-video-downloader

Tool for downloading footage from a local UniFi Protect system
https://ui-protect-dl-docs.danielfernau.com/
MIT License
469 stars 53 forks source link

No Route to host errno 113 #327

Open Excesstomatos opened 1 year ago

Excesstomatos commented 1 year ago

Having kind of a strange issue here any help would be appreciated. here is the logged error text with the command I am using to connect and download

docker run --volume /ui:/downloads unifitoolbox/protect-archiver download --address="IP" --username=UN --password=PW --cameras=ID --start=2023-05-28T12:00:00 --end=2023-05-31T16:01:00 --touch-files /downloads

UNIFI OS 2.4.8 PROTECT 2.2.11

on a UNVR box dedicated to protect. Please let me know if there are any other details you may need. I apologize in advance for my ignorance as I am not anywhere close to a programmer. just an accidental admin

latest: Pulling from unifitoolbox/protect-archiver 42c077c10790: Pull complete f63e77b7563a: Pull complete 5215613c2da8: Pull complete 9ca2d4523a14: Pull complete e97cee5830c4: Pull complete f9b5187272e9: Pull complete 4f4fb700ef54: Pull complete fb6a4b25d9b9: Pull complete f339459fe5cc: Pull complete Digest: sha256:22d8f56ae7f92ae670ecf4bbc1815035cdc70beab58f589d378a77c83626fea5 Status: Downloaded newer image for unifitoolbox/protect-archiver:latest Getting camera list Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1040, in _validate_conn conn.connect() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 358, in connect self.sock = conn = self._new_conn() File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fb816f08220>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxx.xxx.xxx.xxx', port=443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb816f08220>: Failed to establish a new connection: [Errno 113] No route to host'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/download.py", line 211, in download camera_list = client.get_camera_list() File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/init.py", line 87, in get_camera_list return Downloader.get_camera_list(self.session) File "/usr/local/lib/python3.8/site-packages/protect_archiver/downloader/init.py", line 33, in get_camera_list return get_camera_list(session) File "/usr/local/lib/python3.8/site-packages/protect_archiver/downloader/get_camera_list.py", line 19, in get_camera_list cookies={"TOKEN": session.get_api_token()}, File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/unifi_os.py", line 61, in get_api_token self._api_token = self.fetch_session_cookie_token() File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/unifi_os.py", line 36, in fetch_session_cookie_token response = requests.post( File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 565, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xxx.xxx.xxx.xxx', port=443): Max retries exceeded with url: /api/auth/login (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb816f08220>: Failed to establish a new connection: [Errno 113] No route to host'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/protect-archiver", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/init.py", line 21, in main cli.main() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, *ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/download.py", line 238, in download except Errors.ProtectError as e: TypeError: catching classes that do not inherit from BaseException is not allowed

danielfernau commented 1 year ago

Hi @Excesstomatos and sorry for the delayed response, I rarely find time to work on my projects these days...

To me it looks like your machine might be on a different VLAN / network / subnet than your UNVR. If there's no route between these two networks (i.e. you can't open the UNVR's IP address in a browser on that machine or ping it via command line) then the tool cannot connect to the UNVR either.

Additionally, double check that the IP address parameter is set to the correct value (eg. 10.20.100.1), and that it's reachable from the machine you're running the Docker image on. Also check if your Docker network config is correct and not, for example, using another network interface than intended.

If you can reach the UNVR from your Docker host but the tool still won't connect, feel free to add another comment and I'll try to help further.