question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'getpwnam(): name not found: myname'

See original GitHub issue

I’m not sure if this a jupyterhub or a ldapauthenticator issue.

I think I’m getting through the ldap configuration, but when i start a new notebook i get a 500 error.

I’m probably just missing a step, but not sure what it is.

[I 2018-10-30 19:18:28.164 JupyterHub log:122] 200 GET /hub/login (@::ffff:10.2.1.1) 5.84ms
[D 2018-10-30 19:18:33.089 JupyterHub ldapauthenticator:299] TYPE= 'False'
[D 2018-10-30 19:18:33.090 JupyterHub ldapauthenticator:223] Looking up user with search_base=OU=Users,DC=mycompany,DC=com, search_filter='(sAMAccountName=myuser)', attributes=sAMAccountName
[D 2018-10-30 19:18:33.156 JupyterHub ldapauthenticator:278] Attempting to bind myname with CN=myname,OU=Users,DC=mycompany,DC=com
[D 2018-10-30 19:18:33.274 JupyterHub ldapauthenticator:333] Status of user bind myname with CN=myname,OU=Users,DC=mycompany,DC=com : True
[D 2018-10-30 19:18:33.278 JupyterHub base:268] Setting cookie for myname: jupyter-hub-token, {'httponly': True, 'secure': True}
[I 2018-10-30 19:18:33.279 JupyterHub base:346] User logged in: myname
[D 2018-10-30 19:18:33.279 JupyterHub base:421] Initiating spawn for myname
[E 2018-10-30 19:18:33.317 JupyterHub user:427] Unhandled error starting myname's server: 'getpwnam(): name not found: myname'
[D 2018-10-30 19:18:33.383 JupyterHub base:427] 0/100 concurrent spawns
[D 2018-10-30 19:18:33.383 JupyterHub base:430] 0 active servers
[E 2018-10-30 19:18:33.383 JupyterHub web:1591] Uncaught exception POST /hub/login?next= (::ffff:10.2.1.1)
    HTTPServerRequest(protocol='https', SNIP)
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1512, in _execute
        result = yield result
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/login.py", line 94, in post
        yield self.spawn_single_user(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: myuser'

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

8reactions
babaMarcommented, Feb 2, 2021

Adding in jupyter_config.py

from subprocess import check_call


def pre_spawn_hook(spawner):
    username = spawner.user.name
    try:
        check_call(['useradd', '-ms', '/bin/bash', username])
    except Exception as e:
        print(f'{e}')
c.Spawner.pre_spawn_hook = pre_spawn_hook

helped for me

1reaction
dimitar-petrovcommented, Nov 29, 2018

I am facing the same issue here. Did you manage find the root cause.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Re:Error: 'getpwnam(): name not found: - Intel Communities
Hello,. My account had not expired, and I could not login through SSH either. I waited a few hours to try again and...
Read more >
KeyError: "getpwnam(): name not found - ERPNext Forum
Trying to get version 13 running. Getting the following error when running 'sudo bench setup production erpnext --yes' Port configuration ...
Read more >
Infra Solr can not start after installation on Ambari 2.7.1
Infra Solr can not start after installation on Ambari 2.7.1 ... pwd.getpwnam(user) KeyError: 'getpwnam(): name not found: infra-solr' The ...
Read more >
How To Install ERPNext on Ubuntu 20.04
Create a new user named erpnext by running the following command: ... This is not the recommended mode of installation for production.
Read more >
Python Library Reference
import () function does not set the local. variable named eggs; this is done by subsequent code that is generated for the import...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found