Skip to content

google auth breaks on debian because username fail badname check #1066

Description

@joequant

Bug description

google auth creates usernames with @ in them but useradd in debian fails to create these usernames without a --badname flag

How to reproduce

Set up google auth on debian

Expected behaviour

Should create new user and jupyterhub environment

Actual behaviour

Breaks with error

Your personal set up

OS: Debian 13

Logs
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]: [E 2026-04-04 09:16:11.207 JupyterHub user:1004] Unhandled error starting joequant@bitquant.com.hk's server: Command '['useradd', '--create-home', 'jupyter-joequant@bitquant.-1a662']' re>
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     Traceback (most recent call last):
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       File "/opt/tljh/hub/lib/python3.13/site-packages/jupyterhub/user.py", line 914, in spawn
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         f = maybe_future(spawner.start())
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:                          ~~~~~~~~~~~~~^^
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       File "/opt/tljh/hub/lib/python3.13/site-packages/tljh/user_creating_spawner.py", line 26, in start
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         user.ensure_user(system_username)
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       File "/opt/tljh/hub/lib/python3.13/site-packages/tljh/user.py", line 29, in ensure_user
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         subprocess.check_call(["useradd", "--create-home", username])
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       File "/usr/lib/python3.13/subprocess.py", line 419, in check_call
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:         raise CalledProcessError(retcode, cmd)
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     subprocess.CalledProcessError: Command '['useradd', '--create-home', 'jupyter-joequant@bitquant.-1a662']' returned non-zero exit status 19.
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]: [E 2026-04-04 09:16:11.265 JupyterHub pages:364] Error starting server joequant@bitquant.com.hk: Command '['useradd', '--create-home', 'jupyter-joequant@bitquant.-1a662']' returned non-z>
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     Traceback (most recent call last):
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     NoneType: None
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]: [W 2026-04-04 09:16:11.266 JupyterHub web:1964] 500 GET /hub/spawn (::1): Unhandled error starting server joequant@bitquant.com.hk
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]: [E 2026-04-04 09:16:11.269 JupyterHub log:184] {
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Host": "compute.hkphysics.hk",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Accept-Encoding": "gzip, deflate, br, zstd",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Accept-Language": "en-US,en;q=0.9",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Cookie": "_xsrf=[secret]; jupyterhub-hub-login=[secret]; jupyterhub-session-id=[secret]",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Priority": "u=0, i",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Sec-Fetch-Dest": "document",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Sec-Fetch-Mode": "navigate",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Sec-Fetch-Site": "none",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Sec-Fetch-User": "?1",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Te": "trailers",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "Upgrade-Insecure-Requests": "1",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Forwarded-For": "::1",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Forwarded-Host": "compute.hkphysics.hk",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Forwarded-Port": "80",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Forwarded-Proto": "http",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Forwarded-Server": "debian-s-2vcpu-2gb-sgp1-01",
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:       "X-Real-Ip": "::1"
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]:     }
Apr 04 09:16:11 debian-s-2vcpu-2gb-sgp1-01 python3[14586]: [E 2026-04-04 09:16:11.269 JupyterHub log:192] 500 GET /hub/spawn (joequant@bitquant.com.hk@::1) 161.08ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions