IoT Edge gateway - MQTT connection refused

randomrabbit 121 Reputation points
2022-04-27T11:48:37.037+00:00

I'm trying to connect a downstream device (not edge) to an IoT Edge gateway using the transparent gateway model. My gateway is an Azure virtual machine, Debian. I've installed Edge and tried to configure it. The VM is connecting to IoT Central (notice, not hub, but Central).

When following these instructions https://learn.microsoft.com/en-us/azure/iot-edge/how-to-connect-downstream-device?view=iotedge-2020-11 the command to test MQTT fails. This one specifically

openssl s_client -connect <vm-ip-address>:8883 -CAfile <CERTDIR>/certs/azure-iot-test-only.root.ca.cert.pem -showcerts  

Response is:
connect: Connection refused
connect:errno=61

I get a connection refused. Why?

I have allowed port 8883 in Azure. I did not find any firewall on the VM, is there something I could check on that end?

I get this status info from iotedge

> sudo iotedge system status  
System services:  
    aziot-edged             Running  
    aziot-identityd         Running  
    aziot-keyd              Running  
    aziot-certd             Running  
    aziot-tpmd              Ready  

Should I see IoT Hub running as well?

I'm struggling to find non bloated examples of valid manifests files for gateways, maybe I have not configured that properly. Please point me to any examples.

Edit: more output

> sudo iotedge list  
NAME             STATUS           DESCRIPTION                CONFIG  
edgeAgent        failed           Failed (1) 44 seconds ago  mcr.microsoft.com/azureiotedge-agent:1.2  

Logs repeat this:

Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Checking edge runtime status  
Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Edge runtime status is failed, starting module now...  
Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Starting module edgeAgent...  
Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Starting new listener for module edgeAgent  
Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Listener  edgeAgent already started, removing old listener  
Apr 27 12:26:08 mygateway aziot-certd[11288]: 2022-04-27T12:26:08Z [INFO] - <-- GET /certificates/aziot-edged-ca?api-version=2020-09-01 {"host": "2f72756e2f617a696f742f63657274642e736f636b:0"}  
Apr 27 12:26:08 mygateway aziot-certd[11288]: 2022-04-27T12:26:08Z [INFO] - --> 200 {"content-type": "application/json"}  
Apr 27 12:26:08 mygateway aziot-edged[11270]: 2022-04-27T12:26:08Z [INFO] - Listening on unix:///var/lib/aziot/edged/mnt/edgeAgent.sock with 1 thread for workload API.  
Apr 27 12:26:09 mygateway aziot-edged[11270]: 2022-04-27T12:26:09Z [INFO] - Successfully started module edgeAgent  

There's also this coming from 'iotedge logs edgeAgent'.

2022-04-27 12:46:09  Starting Edge Agent  
2022-04-27 12:46:09  Changing ownership of management socket: /var/run/iotedge/mgmt.sock  
su: setuid: Operation not permitted  
Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
530 questions
Azure IoT Central
Azure IoT Central
An Azure hosted internet of things (IoT) application platform.
342 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dom 1,466 Reputation points Microsoft Employee
    2022-04-27T13:07:44.993+00:00

    Hi @randomrabbit ,

    You can find a detailed walkthrough for connecting through a transparent IoT Edge gateway to IoT Central here: https://learn.microsoft.com/azure/iot-central/core/how-to-connect-iot-edge-transparent-gateway

    The article includes a sample manifest.

    Regards,
    Dominic

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful