Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker permissions issue #997

Closed
xmyst opened this issue Jul 28, 2024 · 6 comments · Fixed by #996
Closed

Docker permissions issue #997

xmyst opened this issue Jul 28, 2024 · 6 comments · Fixed by #996

Comments

@xmyst
Copy link

xmyst commented Jul 28, 2024

Environment

  • Elixir version (elixir -v):

    Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace]
    
    Elixir 1.17.2 (compiled with Erlang/OTP 26)
    
  • Nerves environment (mix nerves.env --info):

    ==> nerves
    ==> xxx_rpi5
    Generated xxx_rpi5 app
    |Elixir.Docker| Starting Build... (this may take a while)
    
    chown: changing ownership of '/nerves/build': Operation not permitted
    could not compile dependency :xxx_rpi5, "mix compile" failed.
    Errors may have been logged above.
    You can recompile this dependency with "mix deps.compile xxx_rpi5 --force",
    update it with "mix deps.update xxx_rpi5" or clean it with "mix deps.clean xxx_rpi5"
    ==> pnp_connect
    ** (Mix) The Nerves Docker build_runner encountered an error while setting permissions:
    
    %IO.Stream{device: :standard_io, raw: true, line_or_bytes: :line}
    
  • Additional information about your host, target hardware or environment that may help:

    I suspect it might be connected to the move away from root, i.e. https://github.com/nerves-project/nerves_system_br/blob/v1.28.1/support/docker/nerves_system_br/Dockerfile#L137 vs. https://github.com/nerves-project/nerves/blob/main/lib/nerves/artifact/build_runners/docker.ex#L279. My understanding is that chown needs its sudo now.

Current behaviour

% mix deps.compile xxx_rpi5 --force
==> nerves
==> xxx_rpi5
Generated xxx_rpi5 app
|Elixir.Docker| Starting Build... (this may take a while)

chown: changing ownership of '/nerves/build': Operation not permitted
could not compile dependency :xxx_rpi5, "mix compile" failed.
Errors may have been logged above.
You can recompile this dependency with "mix deps.compile xxx_rpi5 --force",
update it with "mix deps.update xxx_rpi5" or clean it with "mix deps.clean xxx_rpi5"
==> pnp_connect
** (Mix) The Nerves Docker build_runner encountered an error while setting permissions:

%IO.Stream{device: :standard_io, raw: true, line_or_bytes: :line}

Expected behaviour

It compiles.

@fhunleth
Copy link
Member

@xmyst I think if you change your :nerves dependency to point to the fix-docker-build branch from #996 that it should build.

@xmyst
Copy link
Author

xmyst commented Jul 28, 2024

I am going to check in ~6h and report back here. I am not at my machine now.

@xmyst
Copy link
Author

xmyst commented Jul 28, 2024

@fhunleth I am not sure how to solve this

Because every version of nerves_toolchain_aarch64_nerves_linux_gnu depends
on nerves ~> 1.4 which doesn't match any versions, no version of
nerves_toolchain_aarch64_nerves_linux_gnu is allowed.
So, because your app depends on nerves_toolchain_aarch64_nerves_linux_gnu ~> 13.2.0,
version solving failed.
** (Mix) Hex dependency resolution failed

Update: for the context, I have this line in my mix.exs

{:nerves, github: "nerves-project/nerves", branch: "fix-docker-build", runtime: false},

@fhunleth
Copy link
Member

The dependency needs to be forced. Try this:

{:nerves, github: "nerves-project/nerves", branch: "fix-docker-build", override: true, runtime: false},

@xmyst
Copy link
Author

xmyst commented Jul 29, 2024

Building now. I will update this comment when my laptop is done heating the room 🤣

Update: @fhunleth completed successfully with the following complaint about Erlang version. Which, I assume, is not relevant to the issue at hand. I am not using asdf on my macOS, so I expected that when moving to a newer version.

I am concerned about MIX_TARGET: target in the mix's output though.

% echo $MIX_TARGET
xxx_rpi5

% echo $MIX_ENV   
prod

% mix deps.get    
Resolving Hex dependencies...
Resolution completed in 0.053s
Unchanged:
  castore 1.0.8
  earmark_parser 1.4.40
  elixir_make 0.8.4
  ex_doc 0.34.1
  jason 1.4.4
  makeup 1.1.2
  makeup_elixir 0.16.2
  makeup_erlang 1.0.0
  nerves_system_br 1.28.1
  nerves_system_linter 0.4.0
  nerves_toolchain_aarch64_nerves_linux_gnu 13.2.0
  nerves_toolchain_ctng 1.10.0
  nimble_parsec 1.4.0
All dependencies are up to date
==> nerves
==> xxx_rpi5

Nerves environment
  MIX_TARGET:   target
  MIX_ENV:      prod

Checking for prebuilt Nerves artifacts...
  Found xxx_rpi5 in cache
    /Users/myst/.nerves/artifacts/xxx_rpi5-portable-0.3.0
  Found nerves_toolchain_aarch64_nerves_linux_gnu in cache
    /Users/myst/.nerves/artifacts/nerves_toolchain_aarch64_nerves_linux_gnu-darwin_x86_64-13.2.0

@fhunleth
Copy link
Member

This looks good. The MIX_TARGET setting is expected. The short story is that Mix targets are just mostly arbitrary words (the word host is the only that means something since it's used when the target is unset). They are only mainly used to select among library dependencies. In Nerves, we name them things like rpi5 when pulling in Raspberry Pi 5 dependencies, but in places like here where there's only one way to build, we just call it target for consistency.

Thank you for reporting that the build completed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants