2

I'm having a problem where jupyterhub will not actually start, but it's spitting out an error that I'm unable to debug fully.

Output from journalctl --unit=jupyterhub

Aug 04 14:04:12 rkhost jupyterhub[7145]: [I 2016-08-04 14:04:12.594 JupyterHub app:622] Loading cookie_secret from /usr/local/etc/jupyterhub/jupyterhub_cookie_secret
Aug 04 14:04:12 rkhost jupyterhub[7145]: [E 2016-08-04 14:04:12.630 JupyterHub app:1296]
Aug 04 14:04:12 rkhost jupyterhub[7145]: Traceback (most recent call last):
Aug 04 14:04:12 rkhost jupyterhub[7145]: File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 1293, in launch_instance_async
Aug 04 14:04:12 rkhost jupyterhub[7145]: yield self.initialize(argv)
Aug 04 14:04:12 rkhost jupyterhub[7145]: File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 1102, in initialize
Aug 04 14:04:12 rkhost jupyterhub[7145]: yield self.init_users()
Aug 04 14:04:12 rkhost jupyterhub[7145]: File "/usr/local/lib/python3.4/dist-packages/jupyterhub/app.py", line 803, in init_users
Aug 04 14:04:12 rkhost jupyterhub[7145]: yield gen.maybe_future(self.authenticator.add_user(user))
Aug 04 14:04:12 rkhost jupyterhub[7145]: File "/usr/local/lib/python3.4/dist-packages/jupyterhub/auth.py", line 328, in add_user
Aug 04 14:04:12 rkhost jupyterhub[7145]: raise KeyError("User %s does not exist." % user.name)
Aug 04 14:04:12 rkhost jupyterhub[7145]: KeyError: 'User k does not exist.'
Aug 04 14:04:12 rkhost systemd[1]: jupyterhub.service: main process exited, code=exited, status=1/FAILURE
Aug 04 14:04:12 rkhost systemd[1]: Unit jupyterhub.service entered failed state.

Contents of /usr/local/etc/jupyterhub/jupyterhub_config.py

c.Authenticator.admin_users = set(['rkern99']
c.Authenticator.whitelist = set(['rkern99'])
c.JupyterHub.admin_access = False
c.JupyterHub.answer_yes = False
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
c.JupyterHub.base_url = '/'
c.JupyterHub.cleanup_proxy = True
c.JupyterHub.cleanup_servers = True
c.JupyterHub.config_file = '/usr/local/etc/jupyterhub/jupyterhub_config.py'
c.JupyterHub.confirm_no_ssl = True
c.JupyterHub.cookie_max_age_days = 14
c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_secret'
c.JupyterHub.data_files_path = '/usr/local/share/jupyter/hub'
c.JupyterHub.db_kwargs = {}
c.JupyterHub.hub_ip = '10.0.0.50'
c.JupyterHub.hub_port = 54321
c.JupyterHub.hub_prefix = '/hub/'
c.JupyterHub.ip = '10.0.0.50'
c.JupyterHub.port = 80
c.JupyterHub.proxy_api_ip = '10.0.0.50'
c.JupyterHub.proxy_api_port = 5432
c.JupyterHub.proxy_auth_token = '1941890e3eb3d835a754b0c09dc542f33b6616ede96376c9464770d7c205d970'
c.JupyterHub.proxy_cmd = ['configurable-http-proxy']
c.JupyterHub.spawner_class = 'sudospawner.SudoSpawner'
c.Spawner.notebook_dir = '~/Jupyter/'

Contents of /lib/systemd/system/jupyterhub.service

[Unit]
Description=Jupyterhub
After=network-online.target

[Service]
User=jupyterhub
ExecStart=/usr/local/bin/jupyterhub --config=/usr/local/etc/jupyterhub/jupyterhub_config.py
WorkingDirectory=/usr/local/etc/jupyterhub

[Install]
WantedBy=multi-user.target

Verification of user and group

$ grep jupyterhub /etc/passwd
jupyterhub:x:1001:1002::/var/jupyterhub:/usr/sbin/nologin
$ grep jupyterhub /etc/passwd
jupyterhub:x:1001:1002::/var/jupyterhub:/usr/sbin/nologin

This is on a fresh install of Debian 8 Jessie and all installed apt/pip/pip3/npm packages are up to date.

4

Since I solved this myself, it turned out that there was something wrong with /usr/local/etc/jupyterhub/jupyterhub.sqlite. Removing the file solved the problem, but I'm not sure why. I suspect the database was created when loading with a bad prior config and somehow would not overwrite.

  • I am running into this problem as well. JupyterHub would run fine if I started it manually in the terminal, but it wouldn't start as a service, giving me the "User %s does not exist" error message. Have you had any problem after deleting the sqlite file? Have you found out whether it's actually safe to remove? – Kal Aug 12 '16 at 4:23
  • Given that it was an initial install, it appears that the sqlite database is safe to remove. Also, since the problem has gone away and I don't know what caused it before, I am unsure as to why it occurred in the first place. I did have similar behavior though, where I could start it from the command line but not as a service. I don't want to accept my own answer until somebody figures out what actually was/is going on here, but it feels like a permissions issue, I suspect at the time of creation for the sqlite database. – richkern99 Aug 15 '16 at 11:28
  • FYI I have opened a ticket on GitHub about this: github.com/jupyterhub/jupyterhub/issues/687 – Kal Aug 15 '16 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.