$ mix firmware fail -> :ssh_sftpd is not available

Hi nerves community. I try to follow the steps to build the weather station based on nerves. But I fail pretty early while trying to build the firmware:

$ mix firmware
==> nerves
==> sensor_hub

Nerves environment
  MIX_TARGET:   rpi0
  MIX_ENV:      dev

==> nerves_ssh
Compiling 7 files (.ex)

== Compilation error in file lib/nerves_ssh/options.ex ==
** (UndefinedFunctionError) function :ssh_sftpd.subsystem_spec/1 is undefined (module :ssh_sftpd is not available)
    :ssh_sftpd.subsystem_spec([cwd: ~c"/"])
    lib/nerves_ssh/options.ex:50: (module)
could not compile dependency :nerves_ssh, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile nerves_ssh --force", update it with "mix deps.update nerves_ssh" or clean it with "mix deps.clean nerves_ssh"

Anyone having an idea what is going on here?

Hi @theAntimon,

I haven’t seen this specific error, but I have a guess. The :ssh_sftpd module is provided by Erlang and I think that it may not be included if Erlang wasn’t compiled with OpenSSL support. To see if this is the case, start up IEx and see what you get from :crypto.info_lib/0:

$ iex
Erlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Interactive Elixir (1.15.6) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :crypto.info_lib
[{"OpenSSL", 269488511, "OpenSSL 1.1.1w  11 Sep 2023"}]

If you get an error, you’ll have to reinstall Erlang. I’d assume that OpenSSL development libraries or header files were missing when Erlang was installed, but I don’t know without more info. Hopefully this will give a clue that you can google for a next step.

A second thing to try, but please ensure that OpenSSL is definitely working before trying this, is to try my updated version of the Weather Station book code. That repository only updates the sensor_hub_poncho directory to let it be compiled with current versions of Elixir and Erlang. You can see the updates via the git commit history and they’re mostly dependency updates.

Hope this helps!

1 Like

Thank you for your answer.

I get this:

iex(1)> :crypto.info_lib
[{"OpenSSL", 806354960, "OpenSSL 3.1.1 30 May 2023"}]

I also cloned your linked repository and tried it again but I get the same error.

But… I just removed all the erlang and elixir packages on my system and reinstalled them. And now it is working. It maybe really was because I already had Erlang installed before I installed some other dependencies. Anyway, now I’m happy :slight_smile:

Thank you!

1 Like