Mix firmware is generating version error

Hello,
I’m trying to build a sample application and deploy on beaglebone black.
I’m able to get the nerves shell up and running.
Also i was able to build the zImage, however when I try to execute mix firmware i’m getting error

packetp@pp:~/nerves_ramoops/nerves_system_bbb/test_bb$ mix firmware
==> nerves
==> nerves_system_br
Generated nerves_system_br app
==> nerves_toolchain_ctng
Compiling 1 file (.ex)
Generated nerves_toolchain_ctng app
==> nerves_toolchain_armv7_nerves_linux_gnueabihf
Generated nerves_toolchain_armv7_nerves_linux_gnueabihf app
==> nerves_system_bbb
Generated nerves_system_bbb app
==> test_bb

Nerves environment
  MIX_TARGET:   bbb
  MIX_ENV:      dev

** (Mix) Major version mismatch between host and target Erlang/OTP versions
  Host version: 25
  Target version: 26

This will likely cause Erlang code compiled for the target to fail in
unexpected ways.

The easiest way to resolve this issue is to install the same version of
Erlang/OTP on your host. See the Nerves installation guide for doing this
using the `asdf` version manager.

The Nerves System (nerves_system_*) dependency determines the OTP version
running on the target. It is possible that a recent update to the Nerves
System pulled in a new version of Erlang/OTP. If you are using an official
Nerves System, you can verify this by reviewing the CHANGELOG.md file that
comes with the release. Run 'mix deps' to see the Nerves System version and
go to that system's repository on https://github.com/nerves-project.

If you need to run a particular version of Erlang/OTP on your target, you can
either lock the nerves_system_* dependency in your mix.exs to an older
version. Note that this route prevents you from receiving security updates
from the official systems. The other option is to build a custom Nerves
system. See the Nerves documentation for building a custom system and then
run 'make menuconfig' and look for the Erlang options.

Below are the current active versions of erlang and elixir

packetp@pp:~/nerves_ramoops/nerves_system_bbb$ asdf current erlang
erlang          25.0.3          /home/packetp/.tool-versions
packetp@pp:~/nerves_ramoops/nerves_system_bbb$ asdf current elixir
elixir          1.13.4-otp-25   /home/packetp/.tool-versions

Initially elixir version i used was 1.15.5-otp-26 and erlang version was 25.0.2. With this I was successfully able to build the image and deployed it on BBB as well, but i was not able to get launch nerves shell.

Do i need to use any other versions of erlang and elixir?
Or is there anything I can change in mix.exs

Thanks & Regards,
Rehan

OTP is baked into nerves firmware (installed by buildroot). To successfully build a release to run on that firmware you need to make sure the otp version you’re using to build the release matches the otp version of the firmware. In your case it seems the firmware expects OTP 26, but your local system is running 25.

1 Like

Thank you,

I when I set OTP to 26, I’m able to build the firmware, but nerves shell won’t start

packetp@pp:~/nerves_ramoops/nerves_system_bbb/test_bb$ asdf global erlang 26.0.2packetp@pp:~/nerves_ramoops/nerves_system_bbb/test_bb$ mix nerves.system.shell
==> jason
Compiling 10 files (.ex)
Generated jason app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> nerves
HOST_CC port.o
HOST_LD port
Compiling 50 files (.ex)
Generated nerves app
sh: 1: exec: tty_sl: not found
** (ArgumentError) argument error
    :erlang.port_control(#Port<0.8>, 25889124, [])
    (nerves 1.10.3) lib/mix/nerves/shell.ex:106: Mix.Nerves.Shell.get_tty_geometry/1
    (nerves 1.10.3) lib/mix/nerves/shell.ex:49: Mix.Nerves.Shell.open/2
    (nerves 1.10.3) lib/attic/system.shell.ex:74: Mix.Tasks.Nerves.System.Shell.run/1
    (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    (mix 1.13.4) lib/mix/cli.ex:84: Mix.CLI.run_task/2
packetp@pp:~/nerves_ramoops/nerves_system_bbb/test_bb$ 

See Mix nerves.system.shell run into "sh: 1: exec: tty_sl: not found" - #2 by jjcarstens

1 Like