iotedgedev icon indicating copy to clipboard operation
iotedgedev copied to clipboard

Cannot start hub with docker on Windows

Open Vic152 opened this issue 4 years ago • 4 comments

Hey Guys.

When I run in the docker on my Win 10 desktop it seems Agent is connected but neither the Hub or IoT module connect. Maybe there is something simple I am missing.

Steps to repro: Run .\build-container.ps1 Set connection string env variable in PS Run .\run-container.ps1

Docker env

Client: Debug Mode: false Plugins: app: Docker Application (Docker Inc., v0.8.0) buildx: Build with BuildKit (Docker Inc., v0.4.2-tp-docker) scan: Docker Scan (Docker Inc., v0.3.4)

Server: Containers: 4 Running: 1 Paused: 0 Stopped: 3 Images: 21 Server Version: 19.03.13 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 5.4.39-linuxkit Operating System: Docker Desktop OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.941GiB Name: docker-desktop ID: XXX Docker Root Dir: /var/lib/docker Debug Mode: true File Descriptors: 47 Goroutines: 53 System Time: 2021-02-12T11:01:48.0000155Z EventsListeners: 4 Registry: https://index.docker.io/v1/ Labels: Experimental: true Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine

Logs

=> detecting IP => creating config.yaml provisioning: source: "manual" device_connection_string: "HostName=XXX" agent: name: "edgeAgent" type: "docker" env: {} config: image: "mcr.microsoft.com/azureiotedge-agent:1.0" auth: {} hostname: "edgehub" connect: management_uri: "http://host.docker.internal:15580" workload_uri: "http://host.docker.internal:15581" listen: management_uri: "http://172.17.0.3:15580" workload_uri: "http://172.17.0.3:15581" homedir: "/var/lib/iotedge" moby_runtime: docker_uri: "/var/run/docker.sock" network: "azure-iot-edge" => running iotedge daemon <6>2021-02-12T10:41:19Z [INFO] - Using config file: /etc/iotedge/config.yaml <6>2021-02-12T10:41:19Z [INFO] - Starting Azure IoT Edge Security Daemon <6>2021-02-12T10:41:19Z [INFO] - Version - 1.0.8 (208b2204fd30e856d00b280112422130c104b9f0) <6>2021-02-12T10:41:19Z [INFO] - Using runtime network id azure-iot-edge <6>2021-02-12T10:41:19Z [INFO] - Initializing the module runtime... <6>2021-02-12T10:41:19Z [INFO] - Initializing module runtime... <6>2021-02-12T10:41:19Z [INFO] - Successfully initialized module runtime <6>2021-02-12T10:41:19Z [INFO] - Finished initializing the module runtime. <6>2021-02-12T10:41:19Z [INFO] - Configuring /var/lib/iotedge as the home directory. <6>2021-02-12T10:41:19Z [INFO] - Configuring certificates... <6>2021-02-12T10:41:19Z [INFO] - Transparent gateway certificates not found, operating in quick start mode... <6>2021-02-12T10:41:19Z [INFO] - Finished configuring certificates. <6>2021-02-12T10:41:19Z [INFO] - Initializing hsm... <6>2021-02-12T10:41:20Z [INFO] - Finished initializing hsm. <6>2021-02-12T10:41:20Z [INFO] - Detecting if configuration file has changed... <6>2021-02-12T10:41:20Z [INFO] - Change to configuration file detected. <6>2021-02-12T10:41:20Z [INFO] - Removing all modules... <6>2021-02-12T10:41:20Z [INFO] - Removing module edgeHub... <6>2021-02-12T10:41:20Z [INFO] - Removing module ConnectorModule... <6>2021-02-12T10:41:20Z [INFO] - Removing module edgeAgent... <6>2021-02-12T10:41:20Z [INFO] - Successfully removed module ConnectorModule <6>2021-02-12T10:41:20Z [INFO] - Successfully removed module edgeAgent <6>2021-02-12T10:41:20Z [INFO] - Successfully removed module edgeHub <6>2021-02-12T10:41:20Z [INFO] - Finished removing modules. <3>2021-02-12T10:41:20Z [ERR!] (/home/vsts/work/1/s/edgelet/hsm-sys/azure-iot-hsm-c/src/hsm_utils.c:read_file_into_buffer_impl:167) Could not open file for reading /var/lib/iotedge/hsm/enc_keys/edgelet-masterWt5mT2xpO72EPKlt2Tt0Sq4uJCrMvfl2rzzKRB3pnyo_.enc.key. Errno 2 'No such file or directory' <3>2021-02-12T10:41:20Z [ERR!] (/home/vsts/work/1/s/edgelet/hsm-sys/azure-iot-hsm-c/src/edge_hsm_client_store.c:remove_if_cert_and_key_exist_by_alias:1443) Certificate and key file for alias do not exist iotedged-workload-ca <6>2021-02-12T10:41:20Z [INFO] - Edge issuer CA expiration date: 2021-05-13T10:41:20Z <6>2021-02-12T10:41:21Z [INFO] - Provisioning edge device... <6>2021-02-12T10:41:21Z [INFO] - Manually provisioning device "XXX-iot-edge-dev" in hub "XXX.azure-devices.net" <6>2021-02-12T10:41:21Z [INFO] - Finished provisioning edge device. <6>2021-02-12T10:41:21Z [INFO] - Starting management API... <6>2021-02-12T10:41:21Z [INFO] - Starting workload API... <6>2021-02-12T10:41:21Z [INFO] - Starting watchdog with 60 second frequency... <6>2021-02-12T10:41:21Z [INFO] - Listening on http://172.17.0.3:15580/ with 1 thread for management API. <6>2021-02-12T10:41:21Z [INFO] - Listening on http://172.17.0.3:15581/ with 1 thread for workload API. <6>2021-02-12T10:41:21Z [INFO] - Checking edge runtime status <6>2021-02-12T10:41:21Z [INFO] - Creating and starting edge runtime module edgeAgent <6>2021-02-12T10:41:21Z [INFO] - Updating identity for module $edgeAgent <6>2021-02-12T10:41:21Z [INFO] - Pulling image mcr.microsoft.com/azureiotedge-agent:1.0... <6>2021-02-12T10:41:22Z [INFO] - Successfully pulled image mcr.microsoft.com/azureiotedge-agent:1.0 <6>2021-02-12T10:41:22Z [INFO] - Creating module edgeAgent... <6>2021-02-12T10:41:22Z [INFO] - Successfully created module edgeAgent <6>2021-02-12T10:41:22Z [INFO] - Starting module edgeAgent... <6>2021-02-12T10:41:22Z [INFO] - Successfully started module edgeAgent <6>2021-02-12T10:41:23Z [INFO] - [work] - - - [2021-02-12 10:41:23.010162800 UTC] "GET /trust-bundle?api-version=2019-01-30 HTTP/1.1" 200 OK 1944 "-" "-" auth_id(-) <6>2021-02-12T10:41:23Z [INFO] - Querying system info... <6>2021-02-12T10:41:23Z [INFO] - Successfully queried system info <6>2021-02-12T10:41:23Z [INFO] - [mgmt] - - - [2021-02-12 10:41:23.300832100 UTC] "GET /systeminfo?api-version=2019-01-30 HTTP/1.1" 200 OK 103 "-" "-" auth_id(-) <6>2021-02-12T10:41:23Z [INFO] - [work] - - - [2021-02-12 10:41:23.799336100 UTC] "POST /modules/%24edgeAgent/genid/637438890217003074/sign?api-version=2018-06-28 HTTP/1.1" 200 OK 57 "-" "-" auth_id(-) <6>2021-02-12T10:41:23Z [INFO] - Querying system info... <6>2021-02-12T10:41:23Z [INFO] - Successfully queried system info <6>2021-02-12T10:41:23Z [INFO] - [mgmt] - - - [2021-02-12 10:41:23.925625900 UTC] "GET /systeminfo?api-version=2019-01-30 HTTP/1.1" 200 OK 103 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - [mgmt] - - - [2021-02-12 10:41:24.007737900 UTC] "GET /modules?api-version=2019-01-30 HTTP/1.1" 200 OK 449 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - [work] - - - [2021-02-12 10:41:24.338646600 UTC] "POST /modules/%24edgeAgent/genid/637438890217003074/encrypt?api-version=2019-01-30 HTTP/1.1" 200 OK 1613 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - [mgmt] - - - [2021-02-12 10:41:24.431038200 UTC] "GET /identities/?api-version=2019-01-30 HTTP/1.1" 200 OK 315 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - [mgmt] - - - [2021-02-12 10:41:24.679533300 UTC] "PUT /identities/%24edgeHub?api-version=2019-01-30 HTTP/1.1" 200 OK 98 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - [mgmt] - - - [2021-02-12 10:41:24.687569400 UTC] "PUT /identities/ConnectorModule?api-version=2019-01-30 HTTP/1.1" 200 OK 105 "-" "-" auth_id(-) <6>2021-02-12T10:41:24Z [INFO] - Pulling image tidevregcontainer.azurecr.io/grpc_connector_module:20210203.1-amd64.debug... <6>2021-02-12T10:41:25Z [INFO] - Successfully pulled image tidevregcontainer.azurecr.io/grpc_connector_module:20210203.1-amd64.debug <6>2021-02-12T10:41:25Z [INFO] - Creating module ConnectorModule... <6>2021-02-12T10:41:25Z [INFO] - Successfully created module ConnectorModule <6>2021-02-12T10:41:25Z [INFO] - [mgmt] - - - [2021-02-12 10:41:25.760866400 UTC] "POST /modules?api-version=2019-01-30 HTTP/1.1" 201 Created 1009 "-" "-" auth_id(-) <6>2021-02-12T10:41:25Z [INFO] - Starting module ConnectorModule... <4>2021-02-12T10:41:25Z [WARN] - Could not start module ConnectorModule <4>2021-02-12T10:41:25Z [WARN] - caused by: network azure-iot-edge not found <6>2021-02-12T10:41:25Z [INFO] - [mgmt] - - - [2021-02-12 10:41:25.810433 UTC] "POST /modules/ConnectorModule/start?api-version=2019-01-30 HTTP/1.1" 404 Not Found 152 "-" "-" auth_id(-) <6>2021-02-12T10:41:25Z [INFO] - Pulling image mcr.microsoft.com/azureiotedge-hub:1.0... <6>2021-02-12T10:41:26Z [INFO] - Successfully pulled image mcr.microsoft.com/azureiotedge-hub:1.0 <6>2021-02-12T10:41:26Z [INFO] - Creating module edgeHub... <6>2021-02-12T10:41:26Z [INFO] - Successfully created module edgeHub <6>2021-02-12T10:41:26Z [INFO] - [mgmt] - - - [2021-02-12 10:41:26.231715200 UTC] "POST /modules?api-version=2019-01-30 HTTP/1.1" 201 Created 975 "-" "-" auth_id(-) <6>2021-02-12T10:41:26Z [INFO] - Starting module edgeHub... <4>2021-02-12T10:41:26Z [WARN] - Could not start module edgeHub <4>2021-02-12T10:41:57Z [WARN] - caused by: network azure-iot-edge not found <6>2021-02-12T10:41:57Z [INFO] - [mgmt] - - - [2021-02-12 10:41:57.444538500 UTC] "POST /modules/ConnectorModule/start?api-version=2019-01-30 HTTP/1.1" 404 Not Found 152 "-" "-" auth_id(-) <6>2021-02-12T10:41:57Z [INFO] - [work] - - - [2021-02-12 10:41:57.455699700 UTC] "POST /modules/%24edgeAgent/genid/637438890217003074/encrypt?api-version=2019-01-30 HTTP/1.1" 200 OK 1613 "-" "-" auth_id(-) <6>2021-02-12T10:41:26Z [INFO] - Starting module edgeHub... <4>2021-02-12T10:41:26Z [WARN] - Could not start module edgeHub <4>2021-02-12T10:41:26Z [WARN] - caused by: network azure-iot-edge not found <6>2021-02-12T10:42:02Z [INFO] - [mgmt] - - - [2021-02-12 10:42:02.467870800 UTC] "GET /modules?api-version=2019-01-30 HTTP/1.1" 200 OK 1256 "-" "-" auth_id(-) <6>2021-02-12T10:42:02Z [INFO] - Stopping module edgeHub... <4>2021-02-12T10:42:02Z [WARN] - Could not stop module edgeHub

In the cloud

image

Vic152 avatar Feb 12 '21 11:02 Vic152

Maybe I found the culprit...

image

Vic152 avatar Feb 12 '21 16:02 Vic152

Maybe I found the culprit...

image

I added gnupg dirmngr. it did get rid of the error but still getting:

Could not start module edgeHub <4>2021-02-12T17:02:40Z [WARN] - caused by: network azure-iot-edge not found

Vic152 avatar Feb 12 '21 17:02 Vic152

Hello @Vic152 , thank you for reporting this issue! We are actively looking into updating the Dockerfile and relevant container scripts and will keep you updated. Meanwhile, please let us know if you found any workarounds.

cindydeng1998 avatar Mar 02 '21 00:03 cindydeng1998

Hello

i had a similar issue while trying to run iot-edge-c on an Ubuntu VM.

The log was saying "network azure-iot-edge not found" as you mentioned above.

To solve it i found this workaround:

  1. Add the command docker network list at the end of the file \docker\runtime\rund.sh:
cat /etc/iotedge/config.yaml

docker network list

echo '=> running iotedge daemon'
exec iotedged -c /etc/iotedge/config.yaml
  1. Build and run again the container:
docker build . -t iot-edge-c
./run-container.sh
  1. Observe the output and note down the name of the edge network. In my case i got this:
NETWORK ID     NAME                 DRIVER    SCOPE
609b045aea86   azure-iot-edge-dev   bridge    local
f69d5c4b1d9d   bridge               bridge    local
7134f3aeda36   host                 host      local
01ee98f399a5   none                 null      local
  1. Update the config.yaml with the name of the network just found. You should edit again rund.sh where it is setting the moby runtime. In my case i had to replace azure-iot-edge with azure-iot-edge-dev
homedir: "/var/lib/iotedge"
moby_runtime:
  docker_uri: "/var/run/docker.sock"
  network: "azure-iot-edge-dev"
EOF
  1. Build and run again

alevincenzi avatar May 04 '21 11:05 alevincenzi