About provisioning of Azure IoT Edge 1.2

h-abe 31 Reputation points
2021-08-24T05:59:01.65+00:00

The following occurs in an Azure IoT Edge 1.2 environment:

If you install the moby, aziot-edge and aziot-identity-service packages only once in a clean environment, you will get "Could not retrieve device information" and provisioning will not succeed.

However, provisioning is successful by installing and launching the same aziot-edge package again.

Do you know the reason for this?

--- Envroiment
Debian 11 / VM / amd64
But , the same is true for Debian 10.

--- Execute Command

root@debian:~# dpkg -i aziot-edge_1.2.3-1_debian10_amd64.deb aziot-identity-service_1.2.2-1_debian10_amd64.deb
root@debian:~# iotedge config mp --force --connection-string '<REPLACE-CONNECTION-STRING>'
root@debian:~# iotedge config apply -c '/etc/aziot/config.toml'

root@debian:~# iotedge system status
System services:
aziot-edged Running
aziot-identityd Ready
aziot-keyd Ready
aziot-certd Ready
aziot-tpmd Ready

Use 'iotedge system logs' to check for non-fatal errors.
Use 'iotedge check' to diagnose connectivity and configuration issues.

root@debian:~# iotedge system logs
-- Journal begins at Tue 2021-08-24 14:46:05 JST, ends at Tue 2021-08-24 14:50:36 JST. --
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Starting Azure IoT Edge Module Runtime
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Version - 1.2.3
Aug 24 14:49:43 debian systemd[1]: Started Azure IoT Edge daemon.
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Initializing the module runtime...
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Initializing module runtime...
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Using runtime network id azure-iot-edge
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Successfully initialized module runtime
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Finished initializing the module runtime.
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [INFO] - Obtaining edge device provisioning data...
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [WARN] - caused by: HTTP request error
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [WARN] - caused by: error trying to connect: Permission denied (os error 13)
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [WARN] - Requesting device reprovision.
Aug 24 14:49:43 debian aziot-edged[3077]: 2021-08-24T05:49:43Z [WARN] - The reprovisioning operation failed
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [INFO] - Obtaining edge device provisioning data...
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [WARN] - caused by: HTTP request error
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [WARN] - caused by: error trying to connect: Permission denied (os error 13)
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [WARN] - Requesting device reprovision.
Aug 24 14:49:48 debian aziot-edged[3077]: 2021-08-24T05:49:48Z [WARN] - The reprovisioning operation failed
Aug 24 14:49:53 debian aziot-edged[3077]: 2021-08-24T05:49:53Z [INFO] - Obtaining edge device provisioning data...
Aug 24 14:49:53 debian aziot-edged[3077]: 2021-08-24T05:49:53Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
Aug 24 14:49:53 debian aziot-edged[3077]: 2021-08-24T05:49:53Z [WARN] - caused by: HTTP request error
....................

root@debian:~# iotedge system stop
root@debian:~# dpkg -i aziot-edge_1.2.3-1_debian10_amd64.deb
root@debian:~# iotedge system restart

root@debian:~# iotedge system logs
...........
Aug 24 14:50:13 debian aziot-edged[3077]: 2021-08-24T05:50:13Z [WARN] - The reprovisioning operation failed
Aug 24 14:50:17 debian systemd[1]: Stopping Azure IoT Edge daemon...
Aug 24 14:50:17 debian systemd[1]: aziot-edged.service: Succeeded.
Aug 24 14:50:17 debian systemd[1]: Stopped Azure IoT Edge daemon.
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Starting Azure IoT Edge Module Runtime
Aug 24 14:50:28 debian systemd[1]: Started Azure IoT Edge daemon.
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Version - 1.2.3
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Initializing the module runtime...
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Initializing module runtime...
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Using runtime network id azure-iot-edge
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Successfully initialized module runtime
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Finished initializing the module runtime.
Aug 24 14:50:28 debian aziot-edged[3277]: 2021-08-24T05:50:28Z [INFO] - Obtaining edge device provisioning data...
Aug 24 14:50:28 debian systemd[1]: Started Azure IoT Identity Service.
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Starting service...
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Version - 1.2.2
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Provisioning starting. Reason: Startup
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Updated device info for Edge210824D6.
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Provisioning complete.
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Identity reconciliation started. Reason: Startup
Aug 24 14:50:28 debian systemd[1]: Started Azure IoT Keys Service.
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - Starting service...
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - Version - 1.2.2
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - Loaded libaziot-keys with version 0x02000000
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - Starting server...
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - <-- GET /key/device-id?api-version=2020-09-01 {"host": "keyd.sock"}
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - --> 200 {"content-type": "application/json"}
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - <-- POST /sign?api-version=2020-09-01 {"content-type": "application/json", "host": "keyd.sock", "content-length": "378"}
Aug 24 14:50:28 debian aziot-keyd[3282]: 2021-08-24T05:50:28Z [INFO] - --> 200 {"content-type": "application/json"}
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Identity reconciliation complete.
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - Starting server...
Aug 24 14:50:28 debian aziot-identityd[3280]: 2021-08-24T05:50:28Z [INFO] - <-- POST /identities/device?api-version=2020-0
...........

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.
531 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. António Sérgio Azevedo 7,661 Reputation points Microsoft Employee
    2021-08-25T09:28:08.84+00:00

    Hello @h-abe ,
    I noticed you are not using sudo in front of the commands. As mentioned in the How-to guide to verify successfull configuration.

    You need elevated privileges to run iotedge commands. Once you sign out of your machine and sign back in the first time after installing the IoT Edge runtime, your permissions are automatically updated. Until then, use sudo in front of the commands.

    Can you confirm if the same happens when you use sudo?

    Thanks

    0 comments No comments

  2. h-abe 31 Reputation points
    2021-09-03T07:48:00.417+00:00

    Hello @António Sérgio Azevedo ,

    I tried to execute it using the sudo command in Debian in a clean environment.

    However, there is no change in the result of the first execution.

    --- Execute Command

    habe@debian:~$ sudo dpkg -i aziot-edge_1.2.3-1_debian10_amd64.deb aziot-identity-service_1.2.2-1_debian10_amd64.deb
    Selecting previously unselected package aziot-edge.
    (Reading database ... 26277 files and directories currently installed.)
    Preparing to unpack aziot-edge_1.2.3-1_debian10_amd64.deb ...
    Unpacking aziot-edge (1.2.3-1) ...
    Selecting previously unselected package aziot-identity-service.
    Preparing to unpack aziot-identity-service_1.2.2-1_debian10_amd64.deb ...
    Unpacking aziot-identity-service (1.2.2-1) ...
    Setting up aziot-identity-service (1.2.2-1) ...
    Created symlink /etc/systemd/system/sockets.target.wants/aziot-certd.socket → /lib/systemd/system/aziot-certd.socket.
    Created symlink /etc/systemd/system/sockets.target.wants/aziot-identityd.socket → /lib/systemd/system/aziot-identityd.socket.
    Created symlink /etc/systemd/system/sockets.target.wants/aziot-keyd.socket → /lib/systemd/system/aziot-keyd.socket.
    Created symlink /etc/systemd/system/sockets.target.wants/aziot-tpmd.socket → /lib/systemd/system/aziot-tpmd.socket.
    Setting up aziot-edge (1.2.3-1) ...

    ===============================================================================

                              Azure IoT Edge  
    

    IMPORTANT: Please configure the device with provisioning information.

    Please create a new system configuration.

    You can quickly configure the device for manual provisioning with
    a connection string using:

    sudo iotedge config mp --connection-string '...'  
    

    For other provisioning options, copy the template file
    at /etc/aziot/config.toml.edge.template to /etc/aziot/config.toml,
    update it with your device information, then apply the configuration to
    the IoT Edge services with:

    sudo iotedge config apply  
    

    ===============================================================================

    Created symlink /etc/systemd/system/sockets.target.wants/aziot-edged.mgmt.socket → /lib/systemd/system/aziot-edged.mgmt.socket.
    Created symlink /etc/systemd/system/multi-user.target.wants/aziot-edged.service → /lib/systemd/system/aziot-edged.service.
    Created symlink /etc/systemd/system/sockets.target.wants/aziot-edged.workload.socket → /lib/systemd/system/aziot-edged.workload.socket.
    habe@debian:~$ sudo iotedge config mp --force --connection-string '<CONNECTION_STRING>'
    Azure IoT Edge has been configured successfully!
    The configuration has been written to /etc/aziot/config.toml
    To apply the new configuration to services, run:

    sudo iotedge config apply -c '/etc/aziot/config.toml'  
    

    WARNING: This configuration is not suitable when using IoT Edge as a gateway.

    habe@debian:~$ sudo iotedge config apply -c '/etc/aziot/config.toml'
    Note: Symmetric key will be written to /var/secrets/aziot/keyd/device-id
    Azure IoT Edge has been configured successfully!

    Restarting service for configuration to take effect...
    Stopping aziot-edged.service...Stopped!
    Stopping aziot-identityd.service...Stopped!
    Stopping aziot-keyd.service...Stopped!
    Stopping aziot-certd.service...Stopped!
    Stopping aziot-tpmd.service...Stopped!
    Starting aziot-edged.mgmt.socket...Started!
    Starting aziot-edged.workload.socket...Started!
    Starting aziot-identityd.socket...Started!
    Starting aziot-keyd.socket...Started!
    Starting aziot-certd.socket...Started!
    Starting aziot-tpmd.socket...Started!
    Starting aziot-edged.service...Started!
    Done.

    habe@debian:~$ sudo iotedge system status
    System services:
    aziot-edged Running
    aziot-identityd Ready
    aziot-keyd Ready
    aziot-certd Ready
    aziot-tpmd Ready

    Use 'iotedge system logs' to check for non-fatal errors.
    Use 'iotedge check' to diagnose connectivity and configuration issues.

    habe@debian:~$ sudo iotedge system logs
    -- Journal begins at Fri 2021-09-03 16:29:25 JST, ends at Fri 2021-09-03 16:41:11 JST. --
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Starting Azure IoT Edge Module Runtime
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Version - 1.2.3
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Initializing the module runtime...
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Initializing module runtime...
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Using runtime network id azure-iot-edge
    Sep 03 16:41:00 debian systemd[1]: Started Azure IoT Edge daemon.
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Successfully initialized module runtime
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Finished initializing the module runtime.
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [INFO] - Obtaining edge device provisioning data...
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [WARN] - caused by: HTTP request error
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [WARN] - caused by: error trying to connect: Permission denied (os error 13)
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [WARN] - Requesting device reprovision.
    Sep 03 16:41:00 debian aziot-edged[1165]: 2021-09-03T07:41:00Z [WARN] - The reprovisioning operation failed
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [INFO] - Obtaining edge device provisioning data...
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [WARN] - caused by: HTTP request error
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [WARN] - caused by: error trying to connect: Permission denied (os error 13)
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [WARN] - Requesting device reprovision.
    Sep 03 16:41:05 debian aziot-edged[1165]: 2021-09-03T07:41:05Z [WARN] - The reprovisioning operation failed
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [INFO] - Obtaining edge device provisioning data...
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [WARN] - The daemon could not start up successfully: Could not retrieve device information
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [WARN] - caused by: HTTP request error
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [WARN] - caused by: error trying to connect: Permission denied (os error 13)
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [WARN] - Requesting device reprovision.
    Sep 03 16:41:10 debian aziot-edged[1165]: 2021-09-03T07:41:10Z [WARN] - The reprovisioning operation failed