nerves-project / nerves

Craft and deploy bulletproof embedded software in Elixir
http://nerves-project.org
Apache License 2.0
2.23k stars 189 forks source link

Docker permissions issue #997

Closed xmyst closed 1 month ago

xmyst commented 1 month ago

Environment

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 commented 1 month ago

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

xmyst commented 1 month ago

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

xmyst commented 1 month ago

@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 commented 1 month ago

The dependency needs to be forced. Try this:

{:nerves, github: "nerves-project/nerves", branch: "fix-docker-build", override: true, runtime: false},
xmyst commented 1 month ago

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 commented 1 month ago

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!