Search code examples
linuxazureopc-uaazure-iot-edge

OPC Publisher module does not start on my Ubuntu VM as an edge module


The OPC Publisher marketplace image runs successfully as a standalone container (albeit with server connection problems). But I am not able to deploy it as an edge module, especially after changing container create options.

Background: In my host laptop I was never able to get the module up so I created a Ubuntu VM. When I tried to deploy the edge module in the VM with default container create options the module did show up in the iotedge module list as "running". I wanted to set the "--op" option to set publishing rate so I changed it in the create options using the portal "Set modules" tab. Since there is no update button I used create button to "recreate" the modules. After this the module did not show up.

After that the OPC publisher module is not showing up on the edge VM. I am following the Microsoft tutorial.

Following is the command:

sudo docker run -v /iiotedge:/appdata mcr.microsoft.com/iotedge/opc-publisher:latest --aa --pf=/appdata/publishednodes.json --c="HostName=<iot hub name>.azure-devices.net;DeviceId=iothubowner;SharedAccessKey=<hub primary key>" --dc="HostName=<edge device id/name>.azure-devices.net;DeviceId=<edge device id/name>;SharedAccessKey=<edge primary key>" --op=10000

Container create options:

{
    "Hostname": "opcpublisher",
    "Cmd": [
        "--pf=/appdata/publishednodes.json",
        "--aa",
        "--op=10000"
    ],
    "HostConfig": {
        "Binds": [
            "/iiotedge:/appdata"
        ]
    }
}

I have not specified the connection strings explicitly since the documentation from Microsoft assures that the runtime will pass them automatically.

The relevant iotedge journalctl logs are here.

Oct 06 19:36:05 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:05Z [INFO] - Pulling image mcr.microsoft.com/iotedge/opc-publisher:latest...
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Successfully pulled image mcr.microsoft.com/iotedge/opc-publisher:latest
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Creating module OPCPublisher...
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [INFO] - Starting new listener for module OPCPublisher
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]: 2021-10-06T14:06:08Z [ERR!] - Internal server error: Could not create module OPCPublisher
Oct 06 19:36:08 shreesha-VirtualBox iotedged[9622]:         caused by: Could not get module OPCPublisher

The logs from iotedge itself is not much useful. Find below anyway.

~$ iotedge logs OPCPublisher
A module runtime error occurred

I have also tried docker container prune just to be sure but it did not help.

Also strangely in the Azure portal when I try to restart the module from the troubleshoot page it throws an error "module not found in the current environment"

Azure portal module error

Can someone please help me out in troubleshooting this problem? I will be glad to share more details if required.


Solution

  • I raised a support query in Azure portal. After sending support bundles and trying various suggestions like removing DNS configuration, changing bind path to a non-sudo location etc. the team zeroed in on the edge version mismatch.

    After re-reading the documentation I uninstalled the earlier iotedge package and installed aziot-edge instead and problem solved!

    The team has raised a github issue for public tracking here:

    https://github.com/Azure/Industrial-IoT/issues/1425

    @asergaz also pointed to the right direction but did not notice since it came a bit later