kylemanna / docker-aosp

🏗 Minimal Android AOSP build environment with handy automation wrapper scripts
https://registry.hub.docker.com/u/kylemanna/aosp/
MIT License
507 stars 239 forks source link

chown: invalid user: 'aosp:aosp' #19

Closed Wanchen7 closed 7 years ago

Wanchen7 commented 7 years ago

ocker_entrypoint: Creating user UID/GID [501/20] groupadd: GID '20' already exists docker_entrypoint: Creating user UID/GID [501/20] - done docker_entrypoint: Copying .gitconfig and .ssh/config to new user home cp: cannot create regular file '/home/aosp/.gitconfig': No such file or directory docker_entrypoint: Creating /tmp/ccache and /aosp directory chown: invalid user: 'aosp:aosp'

kylemanna commented 7 years ago

Problem here is that your primary group id collides with an existing system group id in the container.

Your user setup on your host is unusual, most Linux systems expert user ids > 1000 for users and 500-999 for system accounts. Same for group ids. See /etc/login.defs

Why is your group ID so low?

Wanchen7 commented 7 years ago

I'm using the MBP with macOS 10.12. The UID start from 501 by default. I'm trying to change UID to 1001,seemed that create a brand new user, all the applications must be reinstall. So I drop this incredible way to build android source code. Thanks for answer my questions.

kylemanna commented 7 years ago

Well, running directly on macOS would likely lead to alot of headaches with the performance of hte volume mounting through the VM. I used to build Android on macOS in a Docker container (via Linux VM) a few years ago, and wouldn't recommend it.

muyiou commented 7 years ago

Can this problem be solved ?

yunair commented 7 years ago

Use root user will solve it

vbisbest commented 7 years ago

How do you use root user? What commands do you run to set it? Thanks.

yunair commented 7 years ago

use root user to run command.

vbisbest commented 7 years ago

This seems random. Sometimes it works and sometimes it still throws the error. So the command is: sudo AOSP_VOL=$PWD/build bash ./build-marshmallow.sh

And most of the time it still throws: docker_entrypoint: Creating /tmp/ccache and /aosp directory chown: changing ownership of '/tmp/ccache': Operation not permitted chown: changing ownership of '/aosp': Operation not permitted

vbisbest commented 7 years ago

I was able to work around this issue.

  1. Had to delete aosp-root in the home folder.
  2. manually create the build, aosp and ccache folders in your working folder
  3. run sudo AOSP_VOL=$PWD/build bash ./build-marshmallow.sh

This gets it going on OSX

joekiller commented 6 years ago

You can also just change the $AOSP_HOST_ID_ARGS in https://github.com/kylemanna/docker-aosp/blob/dd9995aae650fff7129c3720e56cf1f7b9b0430b/utils/aosp#L53 to both be zero (0) and fix the ownership of the build directory afterwards with something like,

sudo chown -R $uid:$(id -g) build/

slightly less risky than doing a sudo docker ... command