jupyter-notebooksystemdjupyterhubpam

jupyterhub fails to spawn server with systemdspawner


I am trying to run jupyterhub on an Ubuntu 20.04 LTS server. My idea is to run python/jupyterhub in a conda virtual environment as a system service. As I want to be able to limit the resources available to individual users I installed the systemdspawner.

After installing everything and starting the jupyterhub service I can login through my web browser. However, when trying to start the server the spawner stucks and after a while I get an error message saying "Spawn failed: Timeout"

in journalctl I can see the following messages:

User logged in: me 302 POST /hub/login?next= -> /hub/spawn (me@::ffff:[my IP address]) 59.42ms

Adding role server to token: <APIToken('93c8...', user='me', client_id='jupyterhub')

Creating oauth client jupyterhub-user-me

pam_loginuid(login:session): Error writing /proc/self/loginuid: Operation not permitted

pam_loginuid(login:session): set_loginuid failed

pam_unix(login:session): session opened for user me by (uid=0)

Failed to open PAM session for me: [PAM Error 14] Cannot make/remove an entry for the specified session

Disabling PAM sessions from now on. user:me

Unit jupyter-me-singleuser in a failed state. Resetting state.

Disclaimer: My Jupyter/Python installation is replacing an former installation that was setup by someone else and got messed up a bit during time. I tried to remove everything related and start with a clean installation from scratch. However, as I had very little documentation about the old setup there is a certain risk that there might be some left-overs of the previous installation that may cause trouble.

Any ideas?


Solution

  • Solved it out myself. In the end the PAM related messages seem to be non-critical and were not related to the timeout at all. Instead I found a mistake in /etc/systemd/system/jupyterhub.service, where the PATH variable was not including the bin directory of my miniconda installation.