aws / aws-iot-device-sdk-arduino-yun

SDK for connecting to AWS IoT from an Arduino Yún.
Apache License 2.0
163 stars 77 forks source link

Setup failed! -1 #50

Closed skrixx closed 6 years ago

skrixx commented 7 years ago

Hello, I want to use Amazon AWS IoT with my Arduino Yun, but it failed still after 4 Days working. I got some fails and follows instruktions from #28 and #25 but no success. fresh openWRT is installed.

First I got this:

root@ichair:~/AWS-IoT-Python-Runtime/runtime# /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied Linux /

I T

G T

Connect failed! -1

Then I installed the python SDK and let basicPubSub sample running and got this:

root@Arduino:~/aws-iot-device-sdk-python-master/samples/basicPubSub# python basicPubSub.py -e .iot.eu-central-1.amazonaws.com -r /root/AWS-IoT- Python-Runtime/certs/rootCA.crt -c /root/AWS-IoT-Python-Runtime/certs/-certificate.pem.crt -k /root/AWS-IoT-Python-Runtime/certs/-private .pem.key 2017-06-23 13:04:22,960 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Paho MQTT Client init. 2017-06-23 13:04:22,963 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - ClientID: basicPubSub 2017-06-23 13:04:22,967 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Protocol: MQTTv3.1.1 2017-06-23 13:04:22,970 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Register Paho MQTT Client callbacks. 2017-06-23 13:04:22,974 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - mqttCore init. 2017-06-23 13:04:22,978 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load CAFile from: /root/AWS-IoT-Python-Runtime/certs/rootCA.crt 2017-06-23 13:04:22,981 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Key from: /root/AWS-IoT-Python-Runtime/certs/454c742925-private.pem.key 2017-06-23 13:04:22,985 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Load Cert from: /root/AWS-IoT-Python-Runtime/certs/454c742925-certificate.pem.crt 2017-06-23 13:04:22,988 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: baseReconnectTime = 1 sec 2017-06-23 13:04:22,992 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: maximumReconnectTime = 32 sec 2017-06-23 13:04:22,996 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for backoff timing: minimumConnectTime = 20 sec 2017-06-23 13:04:23,000 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: queueSize = -1 2017-06-23 13:04:23,003 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for publish queueing: dropBehavior = Drop Newest 2017-06-23 13:04:23,007 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Custom setting for draining interval: 0.5 sec 2017-06-23 13:04:23,011 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum connect/disconnect timeout to be 10 second. 2017-06-23 13:04:23,015 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Set maximum MQTT operation timeout to be 5 second 2017-06-23 13:04:23,019 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication Traceback (most recent call last): File "basicPubSub.py", line 87, in myAWSIoTMQTTClient.connect() File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 405, in connect return self._mqttCore.connect(keepAliveIntervalSecond) File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqttCore.py", line 290, in connect self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception... File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 655, in connect return self.reconnect() File "/usr/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 777, in reconnect sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0)) File "/usr/lib/python2.7/socket.py", line 571, in create_connection raise err socket.error: [Errno 145] Connection timed out

What doese this meen? And if now the Arduino SDK is running I got a different failure:

AWS IoT SDK Version(dev) 2.2.0-

root@Arduino:~/AWS-IoT-Python-Runtime/runtime# /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied /bin/ash: 1: not found /bin/ash: /root: Permission denied Linux /

Traceback (most recent call last): Setup failed! -1

I really dont know what can I do more, can somebody help me? Maybee @liuszeng ?

Thanks Skrixx

liuszeng commented 7 years ago

Hi @skrixx ,

Thank you very much for using AWS IoT Arduino Yun SDK.

It seems that the Python runtime failed in connecting to AWS IoT at TCP connection level. You can try the following:

  1. Double check your AWS IoT endpoint. It should have the following format:

    <CUSTOMER_SPECIFIC_PREFIX>.iot.<REGION>.amazonaws.com

    If you are using X.509 certificate auth., you should use port 8883. If you are using MQTT over WebSocket, you should use port 443.

  2. On your AR9331 (where OpenWRT lives), try a simple telnet command to the service hostname and port:

    
    host$> telnet <prefix>.iot.<region>.amazonaws.com 8883
    Trying 54.236.141.103...
    Connected to <endpoint>.
    Escape character is '^]'.

Connection closed by foreign host. host$>

The above shows a successful TCP connection, with the connection eventually being closed due to failed authentication. This would indicate connections on port 8883 are not being blocked. Below shows the same command when attempting on a blocked port:

host$> telnet .iot..amazonaws.com 8883 Trying 54.236.141.103... telnet: connect to address 54.236.141.103: Connection refused


Check your DNS configuration or try connecting from a different network.

Thanks,
Liusu
skrixx commented 7 years ago

Changing port between 443 and 8883 make no difference and the endpoint is correct. Then I tryed a simple telnet command an got this:

root@Arduino:~# telnet .iot.eu-central-1.amazonaws.com 8883 telnet: can't connect to remote host (35.157.199.74): Connection timed out

Is this a network problem?

Kind regards

liuszeng commented 7 years ago

Hi @skrixx ,

Thanks for providing the information.

A failure in telnet command means that a TCP connection to your AWS IoT endpoint cannot be established from your board. To verify if it is a network specific issue, you can try the same command on another device/computer that is connected to the same network Yun is on. If you are still experiencing this issue, you may want to try again with a different network.

Thanks, Liusu

vareddy-zz commented 6 years ago

Hi @skrixx, We haven't heard from you in over two months and hence we are closing this issue. If you have any questions about the Arduino SDK, please feel free to open another issue. Thanks! Varun