Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
585 stars 739 forks source link

Help for MQTT FIRMWARE UPGRADE LOGS on raspberry-pi device and server/cloud #153

Closed Konark411 closed 6 years ago

Konark411 commented 7 years ago

Device Details -TI Sitara am437x -ARM Cortex A9 -OS Ubuntu 14.04 -Azure C SDK version 1.1.13 (release_2017_04_21)

Description of the issue:

We have been trying Firmware upgrade for the device (TI Sitara am437x) using C SDK . We are facing some issue for firmware upgrade with device running C SDK , we are attaching the log for same.

To understand how the firmware upgrade works we need to compare logs on raspberry-pi with what we are getting . So Please share logs for firmware upgrade on the pi device . Also it will be very helpful if we get the logs on the server side / cloud side along with the device side to understand the wholesome flow of firmware upgrade .

Note : Please share logs for C SDK firmware upgrade .

LOGS on our device:

/home/user/CLOUDSDK/azure-iot-sdk-c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_mqtt_dm# create new SID for child process11entering iothub_client_sample_mqtt_dm_runInfo: Initialize Platform Initialize PlatformInfo: Instantiate the device. Instantiate the device.Info: Initialize From Connection String. Info: IoT Hub SDK for C, version 1.1.10 Info: Device successfully connected. device successfully connectedInfo: DeviceTwin CallBack: Status_code = 204 Info: do_firmware_update('{\"fwPackageUri\":\"https://secureurl\"}') Info: Downloading [{\"fwPackageUri\":\"https://secureurl\"}] --2017-06-06 20:09:31-- ftp://%7B%22fwpackageuri%22/%22https://secureurl%22%7D => â-â Resolving {"fwpackageuri" ({"fwpackageuri")... Info: DeviceTwin CallBack: Status_code = 204 failed: Name or service not known. wget: unable to resolve host address â{"fwpackageuri"â Info: Command [/usr/bin/wget -O - "{\"fwPackageUri\":\"https://secureurl\"}" > /root/newfirmware.zip] returned 1024 Error: Time:Tue Jun 6 20:09:41 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/iothub_client/samples/iothub_client_sample_mqtt_dm/pi_device/pi.c Func:device_download_firmware Line:238 failed to download from '{\"fwPackageUri\":\"https://secureurl\"}' Error: Time:Tue Jun 6 20:09:41 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/iothub_client/samples/iothub_client_sample_mqtt_dm/iothub_client_sample_mqtt_dm.c Func:do_firmware_update Line:149 failed to download new firmware image from '{\"fwPackageUri\":\"https://secureurl\"}' Info: DeviceTwin CallBack: Status_code = 204 Error: Time:Tue Jun 6 20:13:33 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:signal_callback Line:161 Socket received signal 13. Error: Time:Tue Jun 6 20:13:33 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:socketio_send Line:504 Failure: sending socket failed. errno=107 (Transport endpoint is not connected). Error: Time:Tue Jun 6 20:13:33 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:write_outgoing_bytes Line:494 Error in xio_send. Error: Time:Tue Jun 6 20:13:33 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_send Line:1195 Error in write_outgoing_bytes. Error: Time:Tue Jun 6 20:13:33 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:sendPacketItem Line:323 1196: Failure sending control packet data Info: Evaluated delay 0 at 0 attempt to retry

Error: Time:Tue Jun 6 20:14:54 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:mqtt_error_callback Line:1486 Mqtt Ping Response was not encountered. Reconnecting device... Info: Evaluated delay 0 at 0 attempt to retry

Error: Time:Tue Jun 6 20:18:46 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:signal_callback Line:161 Socket received signal 13. Error: Time:Tue Jun 6 20:18:46 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/adapters/socketio_berkeley.c Func:socketio_send Line:504 Failure: sending socket failed. errno=107 (Transport endpoint is not connected). Error: Time:Tue Jun 6 20:18:46 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:write_outgoing_bytes Line:494 Error in xio_send. Error: Time:Tue Jun 6 20:18:46 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_send Line:1195 Error in write_outgoing_bytes. Error: Time:Tue Jun 6 20:18:46 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/umqtt/src/mqtt_client.c Func:sendPacketItem Line:323 1196: Failure sending control packet data Info: Evaluated delay 0 at 0 attempt to retry

Error: Time:Tue Jun 6 20:20:07 2017 File:/home/user/CLOUDSDK/azure-iot-sdk-c/iothub_client/src/iothubtransport_mqtt_common.c Func:mqtt_error_callback Line:1486 Mqtt Ping Response was not encountered. Reconnecting device... Info: Evaluated delay 0 at 0 attempt to retry

mhshami01 commented 7 years ago

Hello @K0414

I see from the log provided the following error(s):

failed: Name or service not known. wget: unable to resolve host address â{"fwpackageuri"â

Either there is a networking error or an invalid URI is given.

Thank you, --Haitham

Konark411 commented 7 years ago

Hi Haitham,

Thanks for the quick reply . Yes we are aware about this issue regarding invalid URL but there has been a different problem we are facing . We tried firmware upgrade , the firmware upgrade happens for the first time but fails to download the firmware due to bad URL (this is not bothering us ).(This is bothering us)On checking the device explorer after again initiating the firmware upgrade we find that the status on the device twin does not get updated and hence we get error for not able to reinitiate the firmware upgrade on the device.

That is why we are asking for C SDK logs to find out how the actual working system behave here. If you have logs for the same that will be a great help and also if you can provide a working URL for firmware upgrade we will be able to test the whole process, for the situation of first time initiating the firmware upgrade.

Thank you, Konark.

Konark411 commented 7 years ago

Hi Haitham,

Did you find anything for the case? Eagerly waiting for support . This can be a great help to our project development . Thanks.

Regards, Konark.

olivierbloch commented 7 years ago

Hi @Konark411 I don't think logs for a firmware update process on a different platform will help you. What IoT Hub infrastructure offers for DM is the "plumbing" (Twins, Methods, Jobs) to implement DM patterns, and we have a couple samples to illustrate a way of implementing some of the common DM patterns. The firmware update sample is just a sample and has to be adapted for each new platform, and note that one might actually even want to implement it differently even on the Raspberry Pi than how the sample does it. You can read more about the principles of DM with Azure IoT Hub. The Firmware Update pattern implemented in our samples is described in there. You can also take a look at our docs on the node sample.

FrankZhcz commented 6 years ago

Log file is here: 2017-11-03_box-mqtt-log copy.txt Hello, I also get the error "Mqtt Ping Response was not encountered. Reconnecting device..." as below:

1. [Thu Nov 02 18:20:37.007 2017] Error: Time:Thu Nov 2 10:20:37 2017 File:/home/user/bin/qsdk/build_dir/target-mips_34kc_uClibc-1.0.14/azure-iot-sdk-2017-05-19/iothub_client/src/iothubtransport_mqtt_common.c Func:mqtt_error_callback Line:1560 Mqtt Ping Response was not encountered. Reconnecting device...

2. [Thu Nov 02 18:07:37.701 2017] Error: Time:Thu Nov 2 10:07:37 2017 File:/home/user/bin/qsdk/build_dir/target-mips_34kc_uClibc-1.0.14/azure-iot-sdk-2017-05-19/iothub_client/src/iothubtransport_mqtt_common.c Func:CreateRetryLogic Line:359 Use IOTHUB_CLIENT_RETRY_LINEAR_BACKOFF Policy

Reference:

Could you give some advice?

ewertons commented 6 years ago

Hi @FrankZhcz , this seems like a different topic. Could you open a separate issue on GitHub please, for visibility? Thanks.

cgoma commented 5 years ago

Hi @Konark411 @olivierbloch I am also trying software update on ubuntu desktop using iothub_client_sample_mqtt_dm. In my case, iothub_client_sample_mqtt_dm is stuck in with message "Info: DeviceTwin CallBack: Status_code = 204" as below

stuck_iot_hub

Below is my device twin configuration file

{
  "deviceId": "MyRaspberyPi2",
  "etag": "someetag=",
  "deviceEtag": "deviceEtag",
  "status": "enabled",
  "statusUpdateTime": "0001-01-01T00:00:00",
  "connectionState": "Connected",
  "lastActivityTime": "0001-01-01T00:00:00",
  "cloudToDeviceMessageCount": 0,
  "authenticationType": "sas",
  "x509Thumbprint": {
    "primaryThumbprint": null,
    "secondaryThumbprint": null
  },
  "version": 35,
  "properties": {
    "desired": {
      "firmware": {
        "fwVersion": "2.8.5",
        "fwPackageURI": "https://my-blob-url-test.bin",
        "fwPackageCheckValue": "123456abcde"
      },
      "$metadata": {
        "$lastUpdated": "2018-10-16T09:53:49.8762493Z",
        "$lastUpdatedVersion": 4,
        "firmware": {
          "$lastUpdated": "2018-10-16T09:53:49.8762493Z",
          "$lastUpdatedVersion": 4,
          "fwVersion": {
            "$lastUpdated": "2018-10-16T09:53:49.8762493Z",
            "$lastUpdatedVersion": 4
          },
          "fwPackageURI": {
            "$lastUpdated": "2018-10-16T09:53:49.8762493Z",
            "$lastUpdatedVersion": 4
          },
          "fwPackageCheckValue": {
            "$lastUpdated": "2018-10-16T09:53:49.8762493Z",
            "$lastUpdatedVersion": 4
          }
        }
      },
      "$version": 4
    },
    "reported": {
      "iothubDM": {
        "firmwareVersion": "4.15.0-36-generic",
        "firmwareUpdate": {
          "status": "waiting"
        }
      },
      "$metadata": {
        "$lastUpdated": "2018-10-16T16:40:07.6072084Z",
        "iothubDM": {
          "$lastUpdated": "2018-10-16T16:40:07.6072084Z",
          "firmwareVersion": {
            "$lastUpdated": "2018-10-16T16:40:07.6072084Z"
          },
          "firmwareUpdate": {
            "$lastUpdated": "2018-10-16T16:40:07.6072084Z",
            "status": {
              "$lastUpdated": "2018-10-16T16:40:07.6072084Z"
            }
          }
        }
      },
      "$version": 31
    }
  },
  "capabilities": {
    "iotEdge": false
  }
}

Please let me know if I am doing something wrong here.