500 : Internal Server Error azuread

Hello!
I use azuread for authorisation to jupyterlab. I have a problem, I get an error when logging in as test_test@test.com. When logging in under test@test.com account I get no error. Please help me to solve the problem Attached log:

: [I 2023-08-25 10:04:53.915 JupyterHub provider:659] Creating oauth client jupyterhub-user-test%20test
: useradd: invalid user name 'jupyter-test test'
: [E 2023-08-25 10:04:53.932 JupyterHub user:884] Unhandled error starting test test's server: Command '['useradd', '--create-home', 'jupyter-test test']' returned non-zero exit status 3.
:     Traceback (most recent call last):
:       File "/opt/tljh/hub/lib/python3.10/site-packages/jupyterhub/user.py", line 795, in spawn
:         f = maybe_future(spawner.start())
:       File "/opt/tljh/hub/lib/python3.10/site-packages/tljh/user_creating_spawner.py", line 26, in start
:         user.ensure_user(system_username)
:       File "/opt/tljh/hub/lib/python3.10/site-packages/tljh/user.py", line 28, in ensure_user
:         subprocess.check_call(["useradd", "--create-home", username])
:       File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
:         raise CalledProcessError(retcode, cmd)
:     subprocess.CalledProcessError: Command '['useradd', '--create-home', 'jupyter-test test']' returned non-zero exit status 3.
:     
: Invalid unit name "jupyter-test test" escaped as "jupyter-test\x20test" (maybe you should use systemd-escape?).
: [E 2023-08-25 10:04:53.959 JupyterHub pages:313] Error starting server dmitry pestov: Command '['useradd', '--create-home', 'jupyter-test test']' returned non-zero exit status 3.
:     Traceback (most recent call last):
:     NoneType: None
[W 2023-08-25 10:04:53.959 JupyterHub web:1869] 500 GET /hub/spawn (185.114.121.147): Unhandled error starting server test test

Unless you share your config and more logs, it is hard to say where the problem lies. It seems that your normalized username has a space and Linux does not allow spaces in usernames. Not sure why your username ended up as such!

1 Like

I solves this problem , i add this to config:

username_claim: unique_name