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

adduser: The user `root' already exists. #267

Closed
spMohanty opened this issue Mar 18, 2018 · 7 comments · Fixed by #676
Closed

adduser: The user `root' already exists. #267

spMohanty opened this issue Mar 18, 2018 · 7 comments · Fixed by #676
Labels

Comments

@spMohanty
Copy link

In a fresh installation of docker-ce on Ubuntu-16.04, if I try to locally build a binder repository, then I get the following logs (and finally the error):

root@myserver:/mount/SDE/crowdAI/conda# repo2docker . --no-run
Using CondaBuildPack builder
Step 1/28 : FROM buildpack-deps:artful
 ---> 766d0aa6a29e
Step 2/28 : RUN apt-get update &&     apt-get install --yes --no-install-recommends locales &&     apt-get purge &&     apt-get clean &&     rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> b173f69c6e6a
Step 3/28 : RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen &&     locale-gen
 ---> Using cache
 ---> 3a5031e18af9
Step 4/28 : ENV LC_ALL en_US.UTF-8
 ---> Using cache
 ---> a221ace95304
Step 5/28 : ENV LANG en_US.UTF-8
 ---> Using cache
 ---> e0315886a2f4
Step 6/28 : ENV LANGUAGE en_US.UTF-8
 ---> Using cache
 ---> 0fc8bee8cc99
Step 7/28 : ENV SHELL /bin/bash
 ---> Using cache
 ---> 5fd1340b2573
Step 8/28 : ARG NB_USER
 ---> Using cache
 ---> 2b0535a59b11
Step 9/28 : ARG NB_UID
 ---> Using cache
 ---> 655d60cd28de
Step 10/28 : ENV USER ${NB_USER}
 ---> Using cache
 ---> 1bc2aa837513
Step 11/28 : ENV HOME /home/${NB_USER}
 ---> Using cache
 ---> ab2784542f9e
Step 12/28 : RUN adduser --disabled-password     --gecos "Default user"     --uid ${NB_UID}     ${NB_USER}
 ---> Running in bc1f2314bb1d
adduser: The user `root' already exists.
Removing intermediate container bc1f2314bb1d
The command '/bin/sh -c adduser --disabled-password     --gecos "Default user"     --uid ${NB_UID}     ${NB_USER}' returned a non-zero code: 1

This can be deterministically replicated by :

pip install jupyter-repo2docker
git clone https://github.com/binder-examples/conda
cd conda
repo2docker . --no-run
@spMohanty
Copy link
Author

spMohanty commented Mar 18, 2018

I do manage to get it to run by instead passing a custom user-name and user-id, but ideally I believe it should work with the default options.

repo2docker --no-run --user-id 1001 --user-name crowdai --debug . 

@betatim
Copy link
Member

betatim commented Mar 18, 2018

Thanks for this. I think we never considered anyone running repo2docker as root before.

The relevant bit of config is this bit here. It does the right thing most of the time (use the username of the user running repo2docker) except when you are root (or any other system account that already exists in the image). What do people think of special casing being executed as root and using jovyan as the user in the image in that case? An alternative would be to make the adduser command conditional inside the image.

@willingc willingc added the user-support Questions on using repo2docker label Mar 19, 2018
@minrk
Copy link
Member

minrk commented Mar 20, 2018

user-id can be set with repo2docker --user-id=1000 --user-name=12345. I don't think we should special-case anything based on what the calling user is. Requiring users running as root to specify these arguments, since the image itself shouldn't build as root seems like the right thing to do.

@choldgraf
Copy link
Member

@minrk could we just check for root with os.geteuid and then raise an informative error if user-id isn't explicitly set?

@minrk
Copy link
Member

minrk commented Apr 25, 2018

@choldgraf good idea. I imagine we can.

@arnavs
Copy link

arnavs commented Apr 1, 2019

If it still matters, just hit this issue in the master build of repo2docker on Ubuntu 18. Was running jupyter-repo2docker as sudo to avoid some permissions hassle with Docker.

@betatim
Copy link
Member

betatim commented Apr 1, 2019

Maybe the first thing to do here is to make repo2docker recognise it is being executed as root and stop with an error message pointing people to the --user-name and --user-id options.

I think trying to guess as what users we should be running is pretty hard, better to let the user decide for themselves. For the novice user the advice should probably be "you shouldn't be doing this, do X instead" and for the advanced user pointing them to the CLI options will let them figure out how to get unstuck.

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

Successfully merging a pull request may close this issue.

6 participants