NativeAuthenticator: server not spawning

Hello,

I have installed yesterday a Jupyterhub on a Fedora 39 machine with pip as root, then jupytyerhub-nativeauthenticator because it’s a server on an internal LAN (no public IP address) and I want the students to subscribe by themselves.

I tested with an account I created, the signup works well but when I want to login, I get

" 500 : Internal Server Error
Unhandled error starting server fdelente
You can try restarting your server from the [home page](http: slash slash 10.70.19.5/hub/home)."

Trying to restart it also fails. The terminal where I started Jupyter hub shows

"[I 2024-02-02 09:42:25.490 JupyterHub app:3245] JupyterHub is now running at http:// 10.70.19.5:80
[I 2024-02-02 09:42:31.841 JupyterHub log:191] 302 GET / → /hub/ (@10.70.19.250) 4.40ms
[I 2024-02-02 09:42:31.875 JupyterHub log:191] 302 GET /hub/ → /hub/login?next=%2Fhub%2F (@10.70.19.250) 2.94ms
[I 2024-02-02 09:42:32.002 JupyterHub log:191] 200 GET /hub/login?next=%2Fhub%2F (@10.70.19.250) 106.51ms
[I 2024-02-02 09:42:39.797 JupyterHub base:837] User logged in: fdelente
[I 2024-02-02 09:42:39.798 JupyterHub log:191] 302 POST /hub/login?next=%2Fhub%2F → /hub/ (fdelente@10.70.19.250) 636.99ms
[I 2024-02-02 09:42:39.830 JupyterHub log:191] 302 GET /hub/ → /hub/spawn (fdelente@10.70.19.250) 19.09ms
[I 2024-02-02 09:42:39.875 JupyterHub provider:659] Creating oauth client jupyterhub-user-fdelente
[E 2024-02-02 09:42:39.912 JupyterHub user:884] Unhandled error starting fdelente’s server: “getpwnam(): name not found: ‘fdelente’”
Traceback (most recent call last):
File “/usr/local/lib/python3.12/site-packages/jupyterhub/user.py”, line 798, in spawn
url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/jupyterhub/spawner.py”, line 1679, in start
env = self.get_env()
^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/jupyterhub/spawner.py”, line 1626, in get_env
env = self.user_env(env)
^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/jupyterhub/spawner.py”, line 1613, in user_env
home = pwd.getpwnam(self.user.name).pw_dir
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: “getpwnam(): name not found: ‘fdelente’”

[E 2024-02-02 09:42:39.957 JupyterHub pages:313] Error starting server fdelente: “getpwnam(): name not found: ‘fdelente’”
Traceback (most recent call last):
NoneType: None

[W 2024-02-02 09:42:39.959 JupyterHub web:1873] 500 GET /hub/spawn (10.70.19.250): Unhandled error starting server fdelente
[E 2024-02-02 09:42:40.015 JupyterHub log:183] {
“X-Forwarded-Host”: “10.70.19.5”,
“X-Forwarded-Proto”: “http”,
“X-Forwarded-Port”: “80”,
“X-Forwarded-For”: “10.70.19.250”,
“Upgrade-Insecure-Requests”: “1”,
“Cookie”: “_xsrf=[secret]; jupyterhub-hub-login=[secret]; jupyterhub-session-id=[secret]”,
“Connection”: “keep-alive”,
“Dnt”: “1”,
“Referer”: “http: slash slash 10.70.19.5/hub/login?next=%2Fhub%2F”,
“Accept-Encoding”: “gzip, deflate”,
“Accept-Language”: “en-US,en;q=0.5”,
“Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8”,
“User-Agent”: “Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0”,
“Host”: “10.70.19.5”
}
[E 2024-02-02 09:42:40.016 JupyterHub log:191] 500 GET /hub/spawn (fdelente at 10.70.19.250) 175.40ms
"

In the config file for Jupyterhub, the only lines I have are

"
c.JupyterHub.authenticator_class=‘nativeauthenticator.NativeAuthenticator’

import os, nativeauthenticator
c.JupyterHub.template_paths = [f"{os.path.dirname(nativeauthenticator.file)}/templates/"]
c.NativeAuthenticator.open_signup = True

c.JupyterHub.bind_url = ‘http: slash slash 10.70.19.5:80’
"

Can anybody help me solve this? Thanks!

The error says that the user fdelente does not exist locally as system user on the server where you deployed JupyterHub. Seems like nativeauthenticator does not create system users upon signup but the default LocalProcessSpawner attempts to get user home directory from system user. So, I guess you cannot use LocalprocessSpawner with nativeauthenticator.

You can look into systemdspawner with dynamic_users set to true which will create users dynamically!

2 Likes