{"action":"created","issue":{"url":"https://api.github.com/repos/jupyter/dockerspawner/issues/67","repository_url":"https://api.github.com/repos/jupyter/dockerspawner","labels_url":"https://api.github.com/repos/jupyter/dockerspawner/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/jupyter/dockerspawner/issues/67/comments","events_url":"https://api.github.com/repos/jupyter/dockerspawner/issues/67/events","html_url":"https://github.com/jupyter/dockerspawner/issues/67","id":130863893,"number":67,"title":"jupyter/systemuser permission error","user":{"login":"smokedsalmonbagel","id":5355848,"avatar_url":"https://avatars.githubusercontent.com/u/5355848?v=3","gravatar_id":"","url":"https://api.github.com/users/smokedsalmonbagel","html_url":"https://github.com/smokedsalmonbagel","followers_url":"https://api.github.com/users/smokedsalmonbagel/followers","following_url":"https://api.github.com/users/smokedsalmonbagel/following{/other_user}","gists_url":"https://api.github.com/users/smokedsalmonbagel/gists{/gist_id}","starred_url":"https://api.github.com/users/smokedsalmonbagel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smokedsalmonbagel/subscriptions","organizations_url":"https://api.github.com/users/smokedsalmonbagel/orgs","repos_url":"https://api.github.com/users/smokedsalmonbagel/repos","events_url":"https://api.github.com/users/smokedsalmonbagel/events{/privacy}","received_events_url":"https://api.github.com/users/smokedsalmonbagel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-03T00:20:03Z","updated_at":"2016-02-04T00:58:02Z","closed_at":null,"body":"Hi - I am setting up a jupyterhub and dockerspawner on the same machine.  I have it all working, but cannot connect to the launched docker image.  My config looks like this:\r\n\r\n```python\r\nc.DockerSpawner.hub_ip_connect = 'xxx'\r\nc.JupyterHub.hub_ip = 'xxx'\r\nc.JupyterHub.port = 443\r\nc.JupyterHub.cookie_secret_file = '/home/jupyter/jupyterhub_cookie_secret'\r\nc.JupyterHub.log_level = 'DEBUG'\r\nc.Spawner.debug = True\r\nc.JupyterHub.spawner_class = 'dockerspawner.SystemUserSpawner'\r\nc.SystemUserSpawner.host_homedir_format_string = '/volumes/user/{username}'\r\nc.DockerSpawner.hub_ip_connect = 'xxx'\r\nc.JupyterHub.proxy_auth_token = 'xxx'\r\nc.Authenticator.whitelist = {'jupyter'}\r\nc.Authenticator.admin_users = {'jupyter'}\r\nc.JupyterHub.ssl_cert = '/home/jupyter/mycert.pem'\r\nc.JupyterHub.ssl_key = '/home/jupyter/mykey.k\r\n```\r\n\r\nThe server starts, and I can login (via local authentication), but then I get a 500 error on the web.  \r\nI have DEBUG logging:\r\n\r\n```\r\n[D 2016-02-02 19:16:13.921 JupyterHub dockerspawner:309] Getting container 'jupyter-jupyter'\r\n[I 2016-02-02 19:16:13.928 JupyterHub dockerspawner:374] Found existing container 'jupyter-jupyter' (id: 5f6551a)\r\n[I 2016-02-02 19:16:13.928 JupyterHub dockerspawner:379] Starting container 'jupyter-jupyter' (id: 5f6551a)\r\n[D 2016-02-02 19:16:14.124 JupyterHub spawner:261] Polling subprocess every 30s\r\n[D 2016-02-02 19:16:23.927 JupyterHub dockerspawner:309] Getting container 'jupyter-jupyter'\r\n[D 2016-02-02 19:16:23.934 JupyterHub dockerspawner:295] Container 5f6551a status: {'Dead': False,\r\n     'Error': '',\r\n     'ExitCode': 9,\r\n     'FinishedAt': '2016-02-03T00:16:14.190673324Z',\r\n     'OOMKilled': False,\r\n     'Paused': False,\r\n     'Pid': 0,\r\n     'Restarting': False,\r\n     'Running': False,\r\n     'StartedAt': '2016-02-03T00:16:14.111710525Z'}\r\n[W 2016-02-02 19:16:23.935 JupyterHub web:1521] 500 POST /hub/login?next= (67.249.20.25): Spawner failed to start [status=ExitCode=9, Error='', FinishedAt=2016-02-03T00:16:14.190673324Z]\r\n[D 2016-02-02 19:16:23.939 JupyterHub base:415] No template for 500\r\n[E 2016-02-02 19:16:23.989 JupyterHub log:99] {\r\n      \"X-Forwarded-Proto\": \"https\",\r\n      \"Host\": \"128.153.6.128\",\r\n      \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\",\r\n      \"Connection\": \"close\",\r\n      \"X-Forwarded-For\": \"67.249.20.25\",\r\n      \"Origin\": \"https://128.153.6.128\",\r\n      \"Content-Type\": \"application/x-www-form-urlencoded\",\r\n      \"Upgrade-Insecure-Requests\": \"1\",\r\n      \"Accept-Language\": \"en-US,en;q=0.8\",\r\n      \"Referer\": \"https://128.153.6.128/hub/login?next=\",\r\n      \"Content-Length\": \"37\",\r\n      \"Cache-Control\": \"max-age=0\",\r\n      \"Accept-Encoding\": \"gzip, deflate\",\r\n      \"X-Forwarded-Port\": \"443\",\r\n      \"User-Agent\": \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36\"\r\n    }\r\n[E 2016-02-02 19:16:23.990 JupyterHub log:100] 500 POST /hub/login?next= (@67.249.20.25) 10667.63ms\r\n\r\n\r\nI looked into the docker log (I assumed the problem was here) and found:\r\nCreating user jupyter (1001)\r\n/opt/conda/lib/python3.4/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.\r\n  warn(\"IPython.utils.traitlets has moved to a top-level traitlets package.\")\r\n/opt/conda/lib/python3.4/site-packages/IPython/paths.py:69: UserWarning: IPython parent '/home/jupyter' is not a writable location, using a temp directory.\r\n  \" using a temp directory.\".format(parent))\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/jupyterhub-singleuser\", line 237, in <module>\r\n    main()\r\n  File \"/usr/local/bin/jupyterhub-singleuser\", line 233, in main\r\n    return SingleUserNotebookApp.launch_instance()\r\n  File \"/opt/conda/lib/python3.4/site-packages/jupyter_core/application.py\", line 267, in launch_instance\r\n    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)\r\n  File \"/opt/conda/lib/python3.4/site-packages/traitlets/config/application.py\", line 588, in launch_instance\r\n    app.initialize(argv)\r\n  File \"<decorator-gen-114>\", line 2, in initialize\r\n  File \"/opt/conda/lib/python3.4/site-packages/traitlets/config/application.py\", line 74, in catch_config_error\r\n    return method(app, *args, **kwargs)\r\n  File \"/opt/conda/lib/python3.4/site-packages/notebook/notebookapp.py\", line 1017, in initialize\r\n    super(NotebookApp, self).initialize(argv)\r\n  File \"<decorator-gen-113>\", line 2, in initialize\r\n  File \"/opt/conda/lib/python3.4/site-packages/traitlets/config/application.py\", line 74, in catch_config_error\r\n    return method(app, *args, **kwargs)\r\n  File \"/opt/conda/lib/python3.4/site-packages/jupyter_core/application.py\", line 243, in initialize\r\n    self.migrate_config()\r\n  File \"/opt/conda/lib/python3.4/site-packages/jupyter_core/application.py\", line 169, in migrate_config\r\n    migrate()\r\n  File \"/opt/conda/lib/python3.4/site-packages/jupyter_core/migrate.py\", line 238, in migrate\r\n    ensure_dir_exists(env['jupyter_config'])\r\n  File \"/opt/conda/lib/python3.4/site-packages/ipython_genutils/path.py\", line 167, in ensure_dir_exists\r\n    os.makedirs(path, mode=mode)\r\n  File \"/opt/conda/lib/python3.4/os.py\", line 237, in makedirs\r\n    mkdir(name, mode)\r\nPermissionError: [Errno 13] Permission denied: '/home/jupyter/.jupyter'\r\nCreating user jupyter (1001)\r\nuseradd: user 'jupyter' already exists\r\nCreating user jupyter (1001)\r\nuseradd: user 'jupyter' already exists\r\nCreating user jupyter (1001)\r\nuseradd: user 'jupyter' already exists\r\n```\r\n\r\nI don't know if that is helpful - it looks like I had the error once but now it is just appending useradd: user 'jupyter' already exists.\r\n\r\nI just need a nudge in the right direction - as I am not sure if the problem is with the container image or my install.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jupyter/dockerspawner/issues/comments/179557330","html_url":"https://github.com/jupyter/dockerspawner/issues/67#issuecomment-179557330","issue_url":"https://api.github.com/repos/jupyter/dockerspawner/issues/67","id":179557330,"user":{"login":"jhamrick","id":83444,"avatar_url":"https://avatars.githubusercontent.com/u/83444?v=3","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T00:58:02Z","updated_at":"2016-02-04T00:58:02Z","body":"Ah, hmm, yes, I believe in this case you need to remove and recreate the container. You can do that by setting the `DockerSpawner.remove_containers` config option.\r\n\r\nIdeally you shouldn't *need* to do that, though. The culprit is probably this line failing to check whether the user exists or not: https://github.com/jupyter/dockerspawner/blob/master/systemuser/systemuser.sh#L4\r\n\r\nI *think* if that script were changed to check first if the user exists, and only create it if it doesn't, then it should work correctly."}}