Upgrading from preview to GA version of IoT Edge


The wait is finally over with todays announcement that Azure IoT Edge is now out of preview and in GA.  The new installation process is quite different than it was in preview and there are detailed instructions available for the wide variety of supported platform. But you may hit some speedbumps if you install the GA version over the top of the preview version.

The Problem

The IoT Edge runtime should automatically instantiate the edgeAgent module to orchestrate the deployment and lifecycle of the other modules. For some reason this wasn't happening so  running the "iotedge list" command returned a depressing blank result. This occurred on both my windows and Linux dev machines.

iotedge list
NAME STATUS DESCRIPTION CONFIG

Looking at the logs for the IoT Edge service (iotedged) revealed a not overly helpful error.

PS C:\WINDOWS\system32> Get-WinEvent -ea SilentlyContinue  -FilterHashtable @{ProviderName= "iotedged";
>> LogName = "application"; StartTime = [datetime]::Today} |  select TimeCreated, Message | Sort-Object -Descending

TimeCreated Message
----------- -------
28/06/2018 4:54:16 PM info: edgelet_core::watchdog -- Updating identity for module $edgeAgent
28/06/2018 4:54:19 PM warn: edgelet_core::watchdog -- Error in watchdog when checking for edge runtime status:
28/06/2018 4:54:19 PM warn: edgelet_utils::logging -- A module runtime error occurred.
28/06/2018 4:53:59 PM info: edgelet_http::logging -- [mgmt] - - - [2018-06-28 06:53:59.809207100 UTC] "GET /modules?...
28/06/2018 4:54:16 PM info: edgelet_core::watchdog -- Checking edge runtime status
28/06/2018 4:54:16 PM info: edgelet_core::watchdog -- Creating and starting edge runtime module edgeAgent
28/06/2018 4:54:19 PM warn: edgelet_utils::logging -- caused by: Conflict with current operation
28/06/2018 4:55:16 PM info: edgelet_core::watchdog -- Updating identity for module $edgeAgent
28/06/2018 4:55:19 PM warn: edgelet_core::watchdog -- Error in watchdog when checking for edge runtime status:
28/06/2018 4:55:19 PM warn: edgelet_utils::logging -- A module runtime error occurred.

The Solution

It seems that the existence of the preview versions of the edgeAgent images in the local Docker registry was the source of my grief. A spring clean was therefore required.

Windows (Linux containers) Fix

  1. Start a powershell as Adminstrator
  2. Stop the IoT Edge Service
    Stop-Service iotedge
  3. Create and run  a batch file to delete the existing images and containers
    @echo off
    FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
    FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i -f

  4. Restart the IoT Edge service and give it a minute to pull down the images

    Start-Service iotedge
  5. List the running modules to make sure all is good
    PS C:\WINDOWS\system32> iotedge list
    NAME      STATUS  DESCRIPTION   CONFIG
    edgeAgent running Up 41 minutes mcr.microsoft.com/azureiotedge-agent:1.0

Linux Fix

  1. Stop the IoT Edge Service
    sudo systemctl stop iotedge
  2. Run commands to  delete the existing images and containers
    rm $(docker ps -a -q)
    rmi $(docker images -q) -f
  3. Restart the IoT Edge service and give it a minute to pull down the images

    sudo systemctl start iotedge
  4. List the running modules to make sure all is good
    sudo iotedge list
    NAME      STATUS  DESCRIPTION   CONFIG
    edgeAgent running Up 41 minutes mcr.microsoft.com/azureiotedge-agent:1.0
  5. Check the logs of the edgeAgent container to check it it happy
    sudo iotedge logs edgeAgent

 

 


Comments (2)

  1. Helge Mahrt says:

    Thanks, this saved me some time and headaches! 🙂

  2. Start PowerShell as Administrator and paste
    Stop-Service iotedge
    or visit our page.

Skip to main content