Open balena opened 2 years ago
Do you know which package is missing? If so, could you please send a PR?
I did some tests and looks like we're missing netbase
package to get it work, but I can't reproduce the error in all debian/ubuntu images, for example, in the image hexpm/erlang:22.2-ubuntu-bionic-20200219
it works
I did some research and aschiavon91 is right in the previous comment: the netbase
dependency is missing in the final erlang img.
For example to test it on several images:
# debian-bookworm
$ docker run -i -a stdout hexpm/elixir:1.15.8-erlang-25.3.2.9-debian-bookworm-20240904 sh -c 'echo ":socket.open(:inet, :raw, :icmp)" | iex'
iex(1)> {:error, {:invalid, {:protocol, :icmp}}}
# debian-bookworm with 'netbase'
$ docker run -i -a stdout hexpm/elixir:1.15.8-erlang-25.3.2.9-debian-bookworm-20240904 sh -c 'apt update && apt install netbase && echo ":socket.open(:inet, :raw, :icmp)" | iex'
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
[...]
iex(1)> {:ok, {:"$socket", #Reference<0.3787441770.2561802246.469>}}
I also test it for the following img (trying to grab one of each type) and it works on all of them when the package is installed:
hexpm/elixir:1.17.2-erlang-25.1.2.1-debian-bullseye-20240904
hexpm/elixir:1.17.2-erlang-25.1.2.1-debian-bullseye-20240904-slim
hexpm/elixir:1.14.5-erlang-25.2.3-debian-bullseye-20240904
hexpm/elixir:1.12.3-erlang-22.1.8.1-debian-buster-20240612
hexpm/elixir:1.17.1-erlang-26.1.2-ubuntu-focal-20240530
hexpm/elixir:1.17.1-erlang-26.2.5.1-ubuntu-jammy-20240530
hexpm/elixir:1.17.0-erlang-25.1.2.1-ubuntu-noble-20240605
I did not test it for arm64
and I have doubts here. It should work, but it would be good to confirm it.
I was able to test the images for the arm64
architecture. It also works when installing the netbase
package.
Now I do a PR to add the netbase
package to the final step of the erlang dockerfiles.
The test consists in performing the following commands:
and repeating for each Debian/Ubuntu images available.
Then if you perform the same for Alpine Linux, it actually works:
The problem seems to be related to some missing package at build time. Reference seems to be here: https://github.com/erlang/otp/blob/aa7f201ac2405ef6bf25d3111934f89dc3e23b73/erts/emulator/nifs/common/socket_nif.c#L169. The definition
HAVE_LINUX_ERRQUEUE_H
seems to be missing during build time.