JupyterHub fails to spawn server using DummyAuthenticator

I recently tried to get a new JupyterHub instance going on my home network using the DummyAuthenticator, but every time I tried to log in, I got the following message:

500 : Internal Server Error

Error in Authenticator.pre_spawn_start: KeyError “getpwnam(): name not found: ‘tom’”

You can try restarting your server from the home page.

When I try to restart the server, either by clicking to the “Home” tab and clicking the “Start My Server” button, or by using the Admin screen and trying to start the server there, I get an HTTP 500 error and a similar message.

Here’s a summary of my changes to the jupyterhub_config.py file. It’s basically setting the authenticator_class and adding a tuple of admin_users.

c.JupyterHub.authenticator_class = 'jupyterhub.auth.DummyAuthenticator'
c.Authenticator.admin_users = {'tom'}

I’m pretty confused by this, since the dummy authenticator shouldn’t be using the getpwnam function - that seems like something that would only be necessary with a PAM authenticator or an authenticator that used the server’s user directory. I did a cursory scan through the DummyAuthenticator and the regular authenticator class and didn’t see anything too shady.

The wrinkle here is that I’m using the docker container (version 1.3), so that might do something weird with spawners.

Here’s a log of everything from a prior shutdown to stable run:

[I 2021-03-27 06:34:48.641 JupyterHub app:2349] Running JupyterHub version 1.3.0
[I 2021-03-27 06:34:48.642 JupyterHub app:2379] Using Authenticator: jupyterhub.auth.DummyAuthenticator-1.3.0
[I 2021-03-27 06:34:48.642 JupyterHub app:2379] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-1.3.0
[I 2021-03-27 06:34:48.642 JupyterHub app:2379] Using Proxy: jupyterhub.proxy.ConfigurableHTTPProxy-1.3.0
[I 2021-03-27 06:34:48.652 JupyterHub app:1420] Loading cookie_secret from /srv/jupyterhub/jupyterhub_cookie_secret
[I 2021-03-27 06:34:48.673 JupyterHub proxy:460] Generating new CONFIGPROXY_AUTH_TOKEN
[I 2021-03-27 06:34:48.704 JupyterHub app:1725] Not using allowed_users. Any authenticated user will be allowed.
[I 2021-03-27 06:34:48.727 JupyterHub app:2416] Initialized 0 spawners in 0.002 seconds
[W 2021-03-27 06:34:48.730 JupyterHub proxy:662] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2021-03-27 06:34:48.730 JupyterHub proxy:666] Starting proxy @ http://:8000
06:34:49.679 [ConfigProxy] info: Proxying http://*:8000 to (no default)
06:34:49.682 [ConfigProxy] info: Proxy API at http://127.0.0.1:8001/api/routes
06:34:49.763 [ConfigProxy] info: 200 GET /api/routes 
[I 2021-03-27 06:34:49.764 JupyterHub app:2664] Hub API listening on http://127.0.0.1:8081/hub/
06:34:49.766 [ConfigProxy] info: 200 GET /api/routes 
[I 2021-03-27 06:34:49.766 JupyterHub proxy:319] Checking routes
[I 2021-03-27 06:34:49.766 JupyterHub proxy:399] Adding default route for Hub: / => http://127.0.0.1:8081
06:34:49.769 [ConfigProxy] info: Adding route / -> http://127.0.0.1:8081
06:34:49.770 [ConfigProxy] info: Route added / -> http://127.0.0.1:8081
06:34:49.770 [ConfigProxy] info: 201 POST /api/routes/ 
[I 2021-03-27 06:34:49.771 JupyterHub app:2739] JupyterHub is now running at http://:8000

Here’s what happens during one of the failed logins:

[I 2021-03-27 06:36:00.392 JupyterHub base:757] User logged in: tom
[I 2021-03-27 06:36:00.394 JupyterHub log:181] 302 POST /hub/login?next= -> /hub/spawn (tom@::ffff:192.168.1.225) 13.57ms
[E 2021-03-27 06:36:00.608 JupyterHub user:689] Unhandled error starting tom's server: "getpwnam(): name not found: 'tom'"
[W 2021-03-27 06:36:00.684 JupyterHub web:1787] 500 GET /hub/spawn (::ffff:192.168.1.225): Error in Authenticator.pre_spawn_start: KeyError "getpwnam(): name not found: 'tom'"
[E 2021-03-27 06:36:00.722 JupyterHub log:173] {
      "X-Forwarded-Host": "192.168.1.73:8130",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8130",
      "X-Forwarded-For": "::ffff:192.168.1.225",
      "Sec-Gpc": "1",
      "Upgrade-Insecure-Requests": "1",
      "Cookie": "jupyterhub-hub-login=[secret]; PHPSESSID=[secret]; io=[secret]; vmware_client=[secret]; DokuWiki=[secret]; XSRF-TOKEN=[secret]; heimdall_session=[secret]; jupyterhub-session-id=[secret]",
      "Connection": "close",
      "Dnt": "1",
      "Referer": "http://192.168.1.73:8130/hub/login",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Host": "192.168.1.73:8130"
    }
[E 2021-03-27 06:36:00.722 JupyterHub log:181] 500 GET /hub/spawn (tom@::ffff:192.168.1.225) 303.17ms

And with debug logging:

[D 2021-03-27 06:42:29.828 JupyterHub base:521] Setting cookie jupyterhub-session-id: {'httponly': True}
[D 2021-03-27 06:42:29.828 JupyterHub base:525] Setting cookie for tom: jupyterhub-hub-login
[D 2021-03-27 06:42:29.828 JupyterHub base:521] Setting cookie jupyterhub-hub-login: {'httponly': True, 'path': '/hub/'}
[I 2021-03-27 06:42:29.828 JupyterHub base:757] User logged in: tom
[I 2021-03-27 06:42:29.829 JupyterHub log:181] 302 POST /hub/login?next= -> /hub/spawn (tom@::ffff:192.168.1.225) 7.22ms
[D 2021-03-27 06:42:29.871 JupyterHub pages:217] Triggering spawn with default options for tom
[D 2021-03-27 06:42:29.871 JupyterHub base:875] Initiating spawn for tom
[D 2021-03-27 06:42:29.871 JupyterHub base:879] 0/100 concurrent spawns
[D 2021-03-27 06:42:29.872 JupyterHub base:884] 0 active servers
[D 2021-03-27 06:42:30.023 JupyterHub user:602] Calling Spawner.start for tom
[E 2021-03-27 06:42:30.024 JupyterHub user:689] Unhandled error starting tom's server: "getpwnam(): name not found: 'tom'"
[D 2021-03-27 06:42:30.024 JupyterHub user:790] Stopping tom
[D 2021-03-27 06:42:30.031 JupyterHub user:816] Deleting oauth client jupyterhub-user-tom
[D 2021-03-27 06:42:30.065 JupyterHub user:819] Finished stopping tom
[W 2021-03-27 06:42:30.099 JupyterHub web:1787] 500 GET /hub/spawn (::ffff:192.168.1.225): Error in Authenticator.pre_spawn_start: KeyError "getpwnam(): name not found: 'tom'"
[D 2021-03-27 06:42:30.100 JupyterHub base:1280] No template for 500
[E 2021-03-27 06:42:30.101 JupyterHub log:173] {
      "X-Forwarded-Host": "192.168.1.73:8130",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8130",
      "X-Forwarded-For": "::ffff:192.168.1.225",
      "Sec-Gpc": "1",
      "Upgrade-Insecure-Requests": "1",
      "Cookie": "jupyterhub-hub-login=[secret]; PHPSESSID=[secret]; io=[secret]; vmware_client=[secret]; DokuWiki=[secret]; XSRF-TOKEN=[secret]; heimdall_session=[secret]; jupyterhub-session-id=[secret]",
      "Connection": "close",
      "Dnt": "1",
      "Referer": "http://192.168.1.73:8130/hub/login",
      "Accept-Encoding": "gzip, deflate",
      "Accept-Language": "en-US,en;q=0.5",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0",
      "Host": "192.168.1.73:8130"
    }
[E 2021-03-27 06:42:30.101 JupyterHub log:181] 500 GET /hub/spawn (tom@::ffff:192.168.1.225) 232.77ms

Let me know if you’d like me to snip some dates so this goes easier.

I’m a little surprised by the lack of a stacktrace here - even on debug log level.

I was able to bring up hub with dummyAuthenticator with the below config

proxy:
  secretToken: "<secret token>"
hub:
  config:
    Authenticator:
      admin_users:
        - foo
        - bar
    # ...
    DummyAuthenticator:
      password: <password>
    JupyterHub:
      authenticator_class: dummy

In JupyterHub Authenticators and Spawners are completely separate. This means you’re still using the default LocalProcessSpawner which requires a matching operating system user: