Hi,
I’m unable to let my device handshake with nerves-hub using nerves_hub_link. The dmesg() of RingLogger don’t complain about it, so it is hard to debug for me.
The Supervisor is up:
iex(...)> Supervisor.which_children(NervesHubLink.Supervisor)
[
{NervesHubLink.UpdateManager, #PID<0.1766.0>, :worker,
[NervesHubLink.UpdateManager]},
{NervesHubLink.DeviceChannel, #PID<0.1765.0>, :worker,
[NervesHubLink.DeviceChannel]},
{PhoenixClient.Socket, #PID<0.1764.0>, :worker, [PhoenixClient.Socket]},
{NervesHubLink.Connection, #PID<0.1763.0>, :worker,
[NervesHubLink.Connection]}
]
The connection is disconnected (taking the pid from above):
iex(...)> :sys.get_state(pid(0, 1763, 0))
{:disconnected, 39}
Eventually the NervesHub Connection does state it is disconnected too long:
iex(...)> NervesHubLink.Connection.check
{:error, {:disconnected_too_long, 39}}
The problem is, I don’t have a clue where it goes wrong. I followed the instructions on https://docs.nerves-hub.org/
I don’t have a NervesKey, so I generated a self-signed root-ca and signing-ca, which signed the certificate for the devise which I use in the config.ex:
config :nerves_hub_link,
socket: [
json_library: Jason,
heartbeat_interval: 45_000
],
ssl: [
certfile: "config/certs/self-signed-device.crt",
keyfile: "config/certs/self-signed-device.key"
],
fwup_public_keys: [:devkey]
I also uploaded the root-ca and signing-ca to nerves-hub as Certificate Authorities.
This is all done in step https://docs.nerves-hub.org/nerves-hub/setup/adding-nerveshub-to-your-project
Later on the devise is created using mix nerves_hub.device create
which also generates certificates. So now I have 2 device certificates: one self-signed using openssl with my own self-signed CA, and one generated by the mix nerves_hub.device create
command. I don’t understand why I have two completely, so maybe the problem lies there.
So I guess, the main question is: how to approach this debugging?
Thanks,
Bas