When using IoT Edge without DPS, I can persist state and log data in modules that survive reboot and service restarts.
When using IoT Edge with DPS (example symmetrical key), every time the OS is restarted or the service is restarted, IoT Edge deletes (losing log and state data) the modules and recreates them. This makes troubleshooting and managing modules and business applications a challenge.
- OS: Windows IoT 1809 (LTSC)
- IoT Edge version: iotedge 1.0.9.3 (ad04e23b1865211913282b918263700deafdccfa)
- IoT Edge Agent: Version - 1.0.9.4.32971639 (12d55e582cc7ce95c8abfe11eddfbbc938ed6001)
Steps to reproduce:
- Install Windows IoT 1809 (though I don't think this is OS specific)
- Install IoT Edge using a SAS token (not DPS) (https://learn.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-windows)
- In the Azure Portal, add a simple Module (I used: docker.io/ksaye/mqttdemo:0.0.2-windows-amd64, but any will do)
- When the module is deployed to the edge, run (to get in the container): docker -H npipe:////./pipe/iotedge_moby_engine exec -i -t %yourmodulename% cmd
- Inside the module container, run: echo hello > test.txt
- Inside the module container, run: type test.txt to see your content
- Type exit to exit the module container and then reboot your system
- After the device starts, again run (to get in the container): docker -H npipe:////./pipe/iotedge_moby_engine exec -i -t %yourmodulename% cmd
- Again in the module container run: type test.txt to see that your content has persisted the reboot
(now to see the undesired behavior)
- Stop the iotedge service run: net stop iotedge
- Change the c:\programdata\iotedge\config.yaml to use DPS with a symmetrical key
- Re run steps 4 - 9, but this time step 9 will fail because the file will not be there
Is there a setting or configuration object that can change this behavior? When deploying SQL Edge or MySQL, I can not have the containers deleted every time the device is rebooted.