iotedge: Iotedge fails to make docker-proxy.sock after reboot (file exists) in Ubuntu Core

Expected Behavior

If I have setup and installed azure-iot-edge snap I should be able to reboot the device and azure-iot-edge should start without any issues.

Current Behavior

azure-iot-edge fails to start with the following logs:

2024-03-27T17:29:35Z systemd[1]: Started Service for snap application azure-iot-edge.docker-proxy.
2024-03-27T17:29:35Z azure-iot-edge.docker-proxy[1201]: 2024/03/27 17:29:35 socat[1201] E "/var/snap/azure-iot-edge/common/docker-proxy.sock" exists
2024-03-27T17:29:35Z systemd[1]: snap.azure-iot-edge.docker-proxy.service: Main process exited, code=exited, status=1/FAILURE
2024-03-27T17:29:35Z systemd[1]: snap.azure-iot-edge.docker-proxy.service: Failed with result 'exit-code'.
2024-03-27T17:29:35Z systemd[1]: snap.azure-iot-edge.docker-proxy.service: Scheduled restart job, restart counter is at 5.
2024-03-27T17:29:35Z systemd[1]: Stopped Service for snap application azure-iot-edge.docker-proxy.
2024-03-27T17:29:35Z systemd[1]: snap.azure-iot-edge.docker-proxy.service: Start request repeated too quickly.
2024-03-27T17:29:35Z systemd[1]: snap.azure-iot-edge.docker-proxy.service: Failed with result 'exit-code'.
2024-03-27T17:29:35Z systemd[1]: Failed to start Service for snap application azure-iot-edge.docker-proxy.
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: 2024-03-27T17:29:38Z [INFO] - Device is QemuDevice1 on clp-dev-iq-shared-8ccd7.azure-devices.net
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: 2024-03-27T17:29:38Z [INFO] - Initializing module runtime...
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: 2024-03-27T17:29:38Z [INFO] - Using runtime network id azure-iot-edge
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: 2024-03-27T17:29:38Z [WARN] - container runtime error
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: Caused by:
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]:     0: error trying to connect: Connection refused (os error 111)
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]:     1: Connection refused (os error 111)
2024-03-27T17:29:38Z azure-iot-edge.aziot-edged[1078]: 2024-03-27T17:29:38Z [ERR!] - Failed to initialize module runtime: runtime operation error: initialize module runtime
2024-03-27T17:29:38Z systemd[1]: snap.azure-iot-edge.aziot-edged.service: Main process exited, code=exited, status=1/FAILURE
2024-03-27T17:29:38Z systemd[1]: snap.azure-iot-edge.aziot-edged.service: Failed with result 'exit-code'.
2024-03-27T17:29:38Z systemd[1]: snap.azure-iot-edge.aziot-edged.service: Scheduled restart job, restart counter is at 1.
2024-03-27T17:29:38Z systemd[1]: Stopped Service for snap application azure-iot-edge.aziot-edged.

Steps to Reproduce

Provide a detailed set of steps to reproduce the bug.

  1. Install azure-iot-edge and azure-iot-identity (both on latest/stable, revision 32 and 27 respectively)
  2. Setup azure-iot-edge with primary connection string (FYI: for me it only works with setting raw-config, otherwise I get permission errors)
sudo echo "[provisioning]
source = \"manual\"
connection_string = \"$MY_CONNECTION_STRING\"" > config.toml
sudo snap set azure-iot-edge raw-config="$(cat config.toml)"

I verify if it is working by checking the logs

snap logs azure-iot-edge -f
  1. Reboot the device: now azure-iot-edge fails to start.

Context (Environment)

  • Ubuntu Core 22
  • azure-iot-edge revision 32
  • azure-iot-identity revision 27
  • docker revision 2915
  • No failures reported by snap changes

Output of iotedge check

Seems to be OK other than docker-proxy.sock not being accesible, which is the bug I'm reporting

charlee@ubuntucore:~$ sudo iotedge check

Configuration checks (aziot-identity-service)
---------------------------------------------
√ keyd configuration is well-formed - OK
√ certd configuration is well-formed - OK
√ tpmd configuration is well-formed - OK
√ identityd configuration is well-formed - OK
√ daemon configurations up-to-date with config.toml - OK
√ identityd config toml file specifies a valid hostname - OK
√ aziot-identity-service package is up-to-date - OK
√ host time is close to reference time - OK
√ preloaded certificates are valid - OK
√ keyd is running - OK
√ certd is running - OK
√ identityd is running - OK
√ read all preloaded certificates from the Certificates Service - OK
√ read all preloaded key pairs from the Keys Service - OK
√ check all EST server URLs utilize HTTPS - OK
√ ensure all preloaded certificates match preloaded private keys with the same ID - OK

Connectivity checks (aziot-identity-service)
--------------------------------------------
√ host can connect to and perform TLS handshake with iothub AMQP port - OK
√ host can connect to and perform TLS handshake with iothub HTTPS / WebSockets port - OK
√ host can connect to and perform TLS handshake with iothub MQTT port - OK

Configuration checks
--------------------
√ aziot-edged configuration is well-formed - OK
√ configuration up-to-date with config.toml - OK
× container engine is installed and functional - Error
    Could not communicate with container engine at unix:///var/snap/azure-iot-edge/common/docker-proxy.sock.
    Please check your moby-engine installation and ensure the service is running.
√ aziot-edge package is up-to-date - OK
‼ DNS server - Warning
    Container engine is not configured with DNS server setting, which may impact connectivity to IoT Hub.
    Please see https://aka.ms/iotedge-prod-checklist-dns for best practices.
    You can ignore this warning if you are setting DNS server per module in the Edge deployment.
‼ production readiness: logs policy - Warning
    Container engine is not configured to rotate module logs which may cause it run out of disk space.
    Please see https://aka.ms/iotedge-prod-checklist-logs for best practices.
    You can ignore this warning if you are setting log policy per module in the Edge deployment.
√ proxy settings are consistent in aziot-edged, aziot-identityd, moby daemon and config.toml - OK

Connectivity checks
-------------------
23 check(s) succeeded.
2 check(s) raised warnings. Re-run with --verbose for more details.
1 check(s) raised errors. Re-run with --verbose for more details.
11 check(s) were skipped due to errors from other checks. Re-run with --verbose for more details.


Device Information

  • Host OS: Ubuntu Core 22.04
  • Architecture: amd64
  • Container OS: QEMU running on linux, but also on hardware running Ubuntu Core directly

Runtime Versions

  • aziot-edged: 1.4.33
  • Edge Agent: 1.4
  • Edge Hub: 1.4
  • Docker/Moby: 24.0.5

Workaround

sudo rm /var/snap/azure-iot-edge/common/docker-proxy.sock && sudo snap restart azure-iot-edge

Notes

Not sure if it is reproducible 100% of the time, but it occurs often enough to be a problem. Especially since my device is supposed to be able to boot without human interaction.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@bishal41 I thought this was recognized as a solvable issue, why would you close it? @KhazAkar I don’t think you need C#/Rust to solve it, from my understanding it is mostly a linux/systemd/framework/bash issue.

I currently have no time to fix this but if it is not fixed by the time we need to include iotedge into our product we will