Troubleshooting
Why an OPC Publisher edge module fails after the image pulls
Short answer
When the Edge runtime logs 'Successfully pulled image' and then 'Could not create module OPCPublisher', the fault is at the runtime and container-creation boundary, not in OPC UA endpoints or the --op setting. In the reported case, uninstalling the older iotedge package and installing aziot-edge fixed module creation. Check the installed runtime before editing create options.
On this page
When the IoT Edge runtime log shows Successfully pulled image followed by Could not create module OPCPublisher, the fault is at the Edge runtime and container-creation boundary. The registry transaction completed; the runtime then failed before the publisher application ever started. In the reported case the fix was to uninstall the older iotedge package and install aziot-edge instead. No change to OPC UA endpoints, certificates or the --op publishing setting repairs a runtime that cannot create the module.
Reading the startup sequence #
The reported log, in order, was Pulling image mcr.microsoft.com/iotedge/opc-publisher:latest..., then Successfully pulled image, then Creating module OPCPublisher..., then the error Internal server error: Could not create module OPCPublisher with the nested cause Could not get module OPCPublisher. The command iotedge logs OPCPublisher returned A module runtime error occurred, because no module process exists to read logs from. A portal restart request failed with module not found in the current environment for the same reason: there is no instance to restart.
Each symptom places the failure at a specific stage:
- Image pull succeeds: the registry interaction completed for that attempt. Stop investigating the registry and move to the next log line.
- Module creation fails: the failure precedes any publisher operation. Application settings such as
--pf,--aaand--opcannot be the cause, because the process that reads them never starts. iotedge logsreturns a runtime error: application logs are unavailable through that request. Collect runtime and container-engine diagnostics instead.- Standalone
docker runof the same image starts: basic container execution works outside Edge management. This is a useful isolation test but does not validate Edge integration, and the standalone container's server-connection problems are a separate fault domain.
Why the failure appeared after a create-options edit #
The module had previously shown as running with default create options. It disappeared after the edit was deployed, but the timing alone does not make the edited argument the cause: any deployment change forces the runtime to recreate the module, and a recreate is exactly where an existing runtime compatibility problem surfaces. The deciding quantity is the startup stage reached, not the publishing interval or CPU load.
Remedies tried and what each one tests #
Several changes were attempted in this installation before the fix was found:
| Approach | What it tests or changes | Outcome |
|---|---|---|
| Run the image as a standalone container | Basic image execution outside Edge | Started; good isolation test, not a fix |
| Remove DNS configuration | Name resolution | No fix; use it only when diagnostics show a resolution failure |
| Change the host bind path | Storage location and access | No fix; use it when logs show a mount or permission error |
docker container prune |
Removes stopped containers | No fix; it deletes diagnostic evidence and does not touch the runtime |
Replace the earlier iotedge package with aziot-edge |
Edge runtime installation and compatibility | Resolved module creation |
Container cleanup is a poor first response to a reproducible creation error. Compare the installed Edge packages against the vendor's documented deployment path for your intended runtime, and record the actual installed versions and the publisher image identity, because package names alone are not a complete compatibility matrix. This runtime-versus-container boundary is the same class of fault seen when a Docker container cannot open the D-Bus socket on an edge controller: the application is fine; the hosting layer refuses.
The create options, read correctly #
The edited create options were:
{
"Hostname": "opcpublisher",
"Cmd": [
"--pf=/appdata/publishednodes.json",
"--aa",
"--op=10000"
],
"HostConfig": {
"Binds": [
"/iiotedge:/appdata"
]
}
}
Cmd supplies application arguments to the image's configured entry point, one argument per string, as shown. Keep two fault classes apart: a malformed create-options document is rejected by the runtime at creation and appears in creation diagnostics, while an unsupported application argument shows up only when the process starts and parses its command line. In the reported case the document was well formed and the failure was at creation, which again points away from the arguments.
The latest tag is mutable: a later pull can resolve to a different image, so record the resolved image identity while troubleshooting and pin an explicit release for production.
Checking the bind mount and published-nodes path #
The bind /iiotedge:/appdata maps a host directory into the container, so with --pf=/appdata/publishednodes.json the expected host file is /iiotedge/publishednodes.json. That path relationship follows from the mount and the argument. The container process needs traversal access through the host directory and read access to the file; the container's configured execution identity and the actual host ownership decide that, not the directory name. A mount rejected by the container engine appears in creation diagnostics; a started process that cannot open its file reports the problem in application output. Use that distinction to pick the next check, but only after module creation succeeds.
Decision #
- Pull succeeds, creation fails,
iotedge logsreturns a runtime error: align the runtime. In the reported case that meant removing the earlieriotedgepackage and installingaziot-edge. Do this before touching create options, DNS or bind paths. - Creation fails with a mount or document error in the creation diagnostics: fix that specific create-options defect; the runtime is healthy.
- Module created, process starts, then argument or file errors appear: now the
Cmdarguments, the bind mapping and file permissions are the right place to work, and the publisher release's own command help defines what--opmeans and accepts. - Module runs but OPC UA sessions fail: that is the application's connectivity problem, a separate domain from this one, similar in shape to troubleshooting Node-RED OPC UA when UaExpert connects.
If an edge box must be redeployed alongside the runtime alignment, a fanless industrial mini PC is the class of host that carries an Edge runtime and its modules in a cabinet.
Questions asked
What does 'module not found in the current environment' mean when restarting OPC Publisher from the portal?
It means the restart request has no module instance to act on, because creation failed earlier on the device. The portal restart is not a diagnostic tool for this fault; read the device's runtime log instead and fix module creation first.
Why did the module run with default create options and fail only after the edit?
The deployment edit forced the runtime to recreate the module, which exposed an existing runtime compatibility problem. The timing points at the edit, but the edited argument is not the cause; the runtime that cannot create the module is.
Should I run docker container prune when module creation fails?
No. It removes stopped containers, deletes diagnostic evidence and does not change the runtime component responsible for module creation. Only use it after the runtime fault is fixed and leftover containers need cleaning.
Is the --op=10000 value a guaranteed end-to-end publishing period?
No. It is a numeric command-line argument whose unit and meaning are defined by the deployed publisher release's command help. Server sampling, publisher behavior, transport and downstream processing all affect the interval you actually observe at the receiving system.