错误指向源代码中的以下行
if not user_exists:
if self.create_system_users:
await maybe_future(self.add_system_user(user))
else:
raise KeyError("User %s does not exist." % user.name)
await maybe_future(super().add_user(user))
这意味着只有当self.create_system_users = False(默认值)时才会抛出错误
但我已经在jupyterhub_config.py
中将其设置为Truec.LocalGitHubAuthenticator.create_system_users = True
日志
[D 2018-06-06 21:28:51.993 JupyterHub app:866] Generating new cookie_secret
[I 2018-06-06 21:28:51.994 JupyterHub app:871] Writing cookie_secret to /srv/jupyterhub/jupyterhub_cookie_secret
[D 2018-06-06 21:28:51.995 JupyterHub app:886] Connecting to db: sqlite:///jupyterhub.sqlite
[D 2018-06-06 21:28:52.011 JupyterHub orm:475] Stamping empty database with alembic revision 3ec6993fe20c
[I 2018-06-06 21:28:52.017 alembic.runtime.migration migration:117] Context impl SQLiteImpl.
[I 2018-06-06 21:28:52.018 alembic.runtime.migration migration:122] Will assume non-transactional DDL.
[I 2018-06-06 21:28:52.025 alembic.runtime.migration migration:327] Running stamp_revision -> 3ec6993fe20c
[D 2018-06-06 21:28:52.026 alembic.runtime.migration migration:516] new branch insert 3ec6993fe20c
[W 2018-06-06 21:28:52.091 JupyterHub app:955] No admin users, admin interface will be unavailable.
[W 2018-06-06 21:28:52.091 JupyterHub app:956] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2018-06-06 21:28:52.092 JupyterHub app:983] Not using whitelist. Any authenticated user will be allowed.
[D 2018-06-06 21:28:52.114 JupyterHub app:1241] Loaded users:
[I 2018-06-06 21:28:52.120 JupyterHub app:1528] Hub API listening on http://127.0.0.1:8081/hub/
[W 2018-06-06 21:28:52.121 JupyterHub proxy:415]
Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
[I 2018-06-06 21:28:52.122 JupyterHub proxy:458] Starting proxy @ https://0.0.0.0:8000/
[D 2018-06-06 21:28:52.122 JupyterHub proxy:459] Proxy cmd: ['configurable-http-proxy', '--ip', '0.0.0.0', '--port', '8000', '--api-ip', '127.0.0.1', '--api-port', '8001', '--error-target', 'http://127.0.0.1:8081/hub/error', '--ssl-key', 'key.pem', '--ssl-cert', 'cert.pem']
21:28:52.574 - info: [ConfigProxy] Proxying https://0.0.0.0:8000 to (no default)
21:28:52.577 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
[D 2018-06-06 21:28:53.107 JupyterHub proxy:491] Proxy started and appears to be up
[D 2018-06-06 21:28:53.109 JupyterHub proxy:552] Proxy: Fetching GET http://127.0.0.1:8001/api/routes
[W 2018-06-06 21:28:53.124 JupyterHub proxy:304] Adding missing default route
[I 2018-06-06 21:28:53.124 JupyterHub proxy:370] Adding default route for Hub: / => http://127.0.0.1:8081
[D 2018-06-06 21:28:53.125 JupyterHub proxy:552] Proxy: Fetching POST http://127.0.0.1:8001/api/routes/
21:28:53.129 - info: [ConfigProxy] 200 GET /api/routes
21:28:53.132 - info: [ConfigProxy] Adding route / -> http://127.0.0.1:8081
[I 2018-06-06 21:28:53.133 JupyterHub app:1581] JupyterHub is now running at https://0.0.0.0:8000/
21:28:53.134 - info: [ConfigProxy] 201 POST /api/routes/
[W 2018-06-06 21:29:04.588 JupyterHub base:202] Invalid or expired cookie token
[W 2018-06-06 21:29:04.590 JupyterHub base:202] Invalid or expired cookie token
[I 2018-06-06 21:29:04.590 JupyterHub log:122] 302 GET /hub/home → /hub/login?next=%2Fhub%2Fhome (@185.46.137.18) 1.87ms
[I 2018-06-06 21:29:04.884 JupyterHub log:122] 200 GET /hub/login?next=%2Fhub%2Fhome (@185.46.137.18) 32.02ms
[D 2018-06-06 21:29:05.258 JupyterHub log:122] 200 GET /hub/static/css/style.min.css?v=14dc0b5a8b791d573b687aa626aa2600 (@185.46.137.18) 3.36ms
[I 2018-06-06 21:29:09.932 JupyterHub log:122] 302 GET / → /hub (@185.46.137.18) 0.69ms
[I 2018-06-06 21:29:10.528 JupyterHub log:122] 302 GET / → /hub (@185.46.137.18) 0.58ms
[I 2018-06-06 21:29:10.580 JupyterHub log:122] 302 GET /hub → /hub/login (@185.46.137.18) 0.63ms
[I 2018-06-06 21:29:10.748 JupyterHub log:122] 302 GET /hub → /hub/login (@185.46.137.18) 0.62ms
[I 2018-06-06 21:29:10.751 JupyterHub log:122] 200 GET /hub/login (@185.46.137.18) 1.12ms
[I 2018-06-06 21:29:11.009 JupyterHub log:122] 200 GET /hub/login (@185.46.137.18) 1.48ms
[D 2018-06-06 21:29:11.014 JupyterHub log:122] 200 GET /hub/static/css/style.min.css?v=14dc0b5a8b791d573b687aa626aa2600 (@185.46.137.18) 1.30ms
[D 2018-06-06 21:29:11.376 JupyterHub log:122] 200 GET /hub/static/css/style.min.css?v=14dc0b5a8b791d573b687aa626aa2600 (@185.46.137.18) 1.44ms
[D 2018-06-06 21:29:11.383 JupyterHub log:122] 200 GET /hub/static/components/bootstrap/dist/js/bootstrap.min.js?v=5869c96cc8f19086aee625d670d741f9 (@185.46.137.18) 3.27ms
[D 2018-06-06 21:29:11.384 JupyterHub log:122] 200 GET /hub/static/components/requirejs/require.js?v=e7199843dfd445bb66ec816e98a03214 (@185.46.137.18) 5.83ms
[D 2018-06-06 21:29:11.385 JupyterHub log:122] 200 GET /hub/static/components/jquery/dist/jquery.min.js?v=c9f5aeeca3ad37bf2aa006139b935f0a (@185.46.137.18) 5.56ms
[D 2018-06-06 21:29:11.738 JupyterHub log:122] 200 GET /hub/logo (@185.46.137.18) 1.13ms
[D 2018-06-06 21:29:11.858 JupyterHub log:122] 200 GET /hub/static/components/requirejs/require.js?v=e7199843dfd445bb66ec816e98a03214 (@185.46.137.18) 1.34ms
[D 2018-06-06 21:29:12.286 JupyterHub log:122] 200 GET /hub/static/components/jquery/dist/jquery.min.js?v=c9f5aeeca3ad37bf2aa006139b935f0a (@185.46.137.18) 1.30ms
[D 2018-06-06 21:29:12.679 JupyterHub log:122] 200 GET /hub/static/components/bootstrap/dist/js/bootstrap.min.js?v=5869c96cc8f19086aee625d670d741f9 (@185.46.137.18) 1.10ms
[I 2018-06-06 21:29:13.090 JupyterHub oauth2:82] OAuth redirect: 'https://52.29.150.250/hub/oauth_callback'
[I 2018-06-06 21:29:13.092 JupyterHub log:122] 302 GET /hub/oauth_login?next= → https://github.com/login/oauth/authorize?redirect_uri=https%3A%2F%2F52.29.150.250%2Fhub%2Foauth_callback&client_id=ea68e73f8ff48a925f1a&response_type=code&state=eyJzdGF0ZV9pZCI6ICJlYWFhM2M2ZTM2NmY0ZjljOWY5M2I5ZWEzMTA5NTI5MCIsICJuZXh0X3VybCI6ICIifQ%3D%3D (@185.46.137.18) 1.83ms
[D 2018-06-06 21:29:13.182 JupyterHub log:122] 200 GET /hub/logo (@185.46.137.18) 1.04ms
[D 2018-06-06 21:29:15.009 JupyterHub base:268] Setting cookie for wutianchen: jupyter-hub-token, {'httponly': True, 'secure': True}
[I 2018-06-06 21:29:15.009 JupyterHub base:346] User logged in: wutianchen
ERROR:asyncio:Future exception was never retrieved
future: <Future finished exception=KeyError('User wutianchen does not exist.',)>
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1113, in run
yielded = self.gen.send(value)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/auth.py", line 489, in add_user
raise KeyError("User %s does not exist." % user.name)
KeyError: 'User wutianchen does not exist.'
[D 2018-06-06 21:29:15.011 JupyterHub user:184] Creating <class 'jupyterhub.spawner.LocalProcessSpawner'> for wutianchen:
[I 2018-06-06 21:29:15.022 JupyterHub log:122] 302 GET /hub/oauth_callback?code=25e81552eb4f1864171d&state=eyJzdGF0ZV9pZCI6ICJlYWFhM2M2ZTM2NmY0ZjljOWY5M2I5ZWEzMTA5NTI5MCIsICJuZXh0X3VybCI6ICIifQ%3D%3D → /hub/ (@185.46.137.18) 936.92ms
[D 2018-06-06 21:29:15.449 JupyterHub pages:54] User is not running: /hub/home
[I 2018-06-06 21:29:15.452 JupyterHub log:122] 302 GET /hub/ → /hub/home (wutianchen@185.46.137.18) 3.25ms
[I 2018-06-06 21:29:15.628 JupyterHub log:122] 200 GET /hub/home (wutianchen@185.46.137.18) 8.26ms
[D 2018-06-06 21:29:15.848 JupyterHub log:122] 200 GET /hub/static/css/style.min.css?v=14dc0b5a8b791d573b687aa626aa2600 (@185.46.137.18) 1.72ms
[D 2018-06-06 21:29:15.853 JupyterHub log:122] 304 GET /hub/logo (@185.46.137.18) 1.26ms
[D 2018-06-06 21:29:16.454 JupyterHub log:122] 200 GET /hub/static/components/font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0 (@185.46.137.18) 1.27ms
[D 2018-06-06 21:29:16.500 JupyterHub log:122] 200 GET /hub/static/js/home.js?v=(& (@185.46.137.18) 1.05ms
[D 2018-06-06 21:29:16.797 JupyterHub log:122] 200 GET /hub/static/js/jhapi.js?v=(& (@185.46.137.18) 1.07ms
[D 2018-06-06 21:29:17.087 JupyterHub log:122] 200 GET /hub/static/js/utils.js?v=(& (@185.46.137.18) 1.07ms
[I 2018-06-06 21:29:19.549 JupyterHub log:122] 302 GET /hub/spawn → /user/wutianchen/ (wutianchen@185.46.137.18) 3.56ms
[I 2018-06-06 21:29:19.739 JupyterHub log:122] 302 GET /user/wutianchen/ → /hub/user/wutianchen/ (@185.46.137.18) 0.60ms
[D 2018-06-06 21:29:19.958 JupyterHub base:421] Initiating spawn for wutianchen
[E 2018-06-06 21:29:19.989 JupyterHub user:427] Unhandled error starting wutianchen's server: 'getpwnam(): name not found: wutianchen'
[D 2018-06-06 21:29:20.000 JupyterHub base:427] 0/100 concurrent spawns
[D 2018-06-06 21:29:20.000 JupyterHub base:430] 0 active servers
[E 2018-06-06 21:29:20.000 JupyterHub web:1621] Uncaught exception GET /hub/user/wutianchen/ (185.46.137.18)
HTTPServerRequest(protocol='https', host='52.29.150.250', method='GET', uri='/hub/user/wutianchen/', version='HTTP/1.1', remote_ip='185.46.137.18')
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 747, in get
yield self.spawn_single_user(current_user)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 475, in spawn_single_user
yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 445, in finish_user_spawn
yield spawn_future
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 439, in spawn
raise e
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 378, in spawn
ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
File "/opt/conda/lib/python3.6/types.py", line 248, in wrapped
coro = func(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/spawner.py", line 968, in start
env = self.get_env()
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/spawner.py", line 960, in get_env
env = self.user_env(env)
File "/opt/conda/lib/python3.6/site-packages/jupyterhub/spawner.py", line 947, in user_env
home = pwd.getpwnam(self.user.name).pw_dir
KeyError: 'getpwnam(): name not found: wutianchen'
[D 2018-06-06 21:29:20.005 JupyterHub base:633] No template for 500
[E 2018-06-06 21:29:20.015 JupyterHub log:114] {
"X-Forwarded-Host": "52.29.150.250",
"X-Forwarded-Proto": "https",
"X-Forwarded-Port": "443",
"X-Forwarded-For": "185.46.137.18",
"Cookie": "jupyterhub-hub-login=\"2|1:0|10:1528282009|20:jupyterhub-hub-login|44:NGExZmU5NTU4YzdmNGY5Njg3NjFmYmZlOWZkNjdmOTA=|e76a19da7857f3fdc9552808b870fedeac644f9f51713ce2da13c5da3230b2a3\"; jupyter-hub-token=\"2|1:0|10:1528320555|17:jupyter-hub-token|44:MmJkYTA2NGJlNzg5NDcwZTk5NzhiMTc4YzM4ZmVjMjY=|5b81b2163bbdd92985e4b3443094106505851f63dee2f349da07907b3508ff18\"; jupyterhub-session-id=5f3f608678df41cfa8520c56b7ef3677; _xsrf=2|85e4a0ae|a5a70783d2268cfd2b873c64eaba920e|1528282915",
"Accept-Language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,de;q=0.6",
"Accept-Encoding": "gzip, deflate, br",
"Referer": "https://52.29.150.250/hub/home",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
"Upgrade-Insecure-Requests": "1",
"Connection": "close",
"Host": "52.29.150.250"
}
答案 0 :(得分:1)
在jupyterhub_config.py中自己解决问题,它应该是
c.LocalAuthenticator.create_system_users = True