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-machine support #389

Closed
sxul opened this issue Mar 11, 2020 · 4 comments
Closed

docker-machine support #389

sxul opened this issue Mar 11, 2020 · 4 comments

Comments

@sxul
Copy link

sxul commented Mar 11, 2020

I'm using docker-machine on Mac OS 10.15.

When I try to run
cross build --target x86_64-unknown-linux-gnu
I get this error:

# cross build --target x86_64-unknown-linux-gnu --verbose
+ "rustc" "--print" "sysroot"
+ "rustup" "toolchain" "list"
+ "rustup" "target" "list" "--toolchain" "nightly-x86_64-unknown-linux-gnu"
+ "rustup" "component" "list" "--toolchain" "nightly-x86_64-unknown-linux-gnu"
+ "/usr/local/bin/docker" "run" "--userns" "host" "--rm" "--user" "501:20" "-e" "XARGO_HOME=/xargo" "-e" "CARGO_HOME=/cargo" "-e" "CARGO_TARGET_DIR=/target" "-e" "USER=sxul07" "-e" "CROSS_RUNNER=" "-v" "/Users/sxul07/.xargo:/xargo:Z" "-v" "/Users/sxul07/.cargo:/cargo:Z" "-v" "/cargo/bin" "-v" "/Users/sxul07/Source/hw:/project:Z" "-v" "/Users/sxul07/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu:/rust:Z,ro" "-v" "/Users/sxul07/Source/hw/target:/target:Z" "-w" "/project" "-i" "-t" "rustembedded/cross:x86_64-unknown-linux-gnu-0.2.0" "sh" "-c" "PATH=$PATH:/rust/bin cargo build --target x86_64-unknown-linux-gnu --verbose"
error: failed to open: /target/debug/.cargo-lock

Caused by:
  Permission denied (os error 13)

I found a simple solution is replace "--user" "501:20" to "--user" "1000:20", and it works fine.

I don't know how the mac user system works, it looks like I can't find users id 501 and 1000 in /etc/passwd

@BJK
Copy link

BJK commented Sep 21, 2020

I'm having the same issue. From looking at the code it grabs the UID of the current user. (Pretty sure Mac OS doesn't use /etc/passwd in the traditional way anymore).

@sxul Curious how did you change the user ID that is passed? Did you modify the source?

@sxul
Copy link
Author

sxul commented Sep 24, 2020

I'm having the same issue. From looking at the code it grabs the UID of the current user. (Pretty sure Mac OS doesn't use /etc/passwd in the traditional way anymore).

@sxul Curious how did you change the user ID that is passed? Did you modify the source?

yes, modify here and rebuild cross

bors bot added a commit that referenced this issue Mar 29, 2021
543: Added environment variables to control the UID and GID in the container r=Dylan-DPC a=UebelAndre

`CROSS_CONTAINER_UID` and `CROSS_CONTAINER_GID` can now be used to control the user and group ID's passed to Docker.

I ran into this when trying to setup a Github-Action that runs on MacOS and uses docker-machine which wasn't working. I then found #389 which described the solution of updating the UID and GID which I've confirmed works. This change should make it easier for users to solve for the same issue without making a fork.

Co-authored-by: Andre Brisco <andre.brisco@gmail.com>
@UebelAndre
Copy link
Contributor

UebelAndre commented Mar 29, 2021

yes, modify here and rebuild cross

Just a heads up, as of 58bfd65 you can now use CROSS_CONTAINER_UID and CROSS_CONTAINER_GID environment variables to apply the same suggestion.

I've tested this using a github action that runs docker on macos and posted the yaml here: #543 (comment)

@Alexhuszagh
Copy link
Contributor

I believe this is fixed as of 58bfd65, I will reopen this if it is still an issue. I've added additional documentation on these variables on the wiki.

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

No branches or pull requests

4 participants