Jupyterhub 2.0.0 c.Spawner.notebook_dir vs $HOME for setting custom home directory

I just upgraded JupyterHub v1.3.0 to v2.0.0 on Linux CentOS 8 (I know this OS is EOL soon, planning to migrate to Ubuntu 20.04LTS…) following instructions here, but I am now experiencing difficulties setting custom home directories.

I previously set up user home directories on an NFS mounted file path, using the following lines in my jupyterhub_config.py which worked nicely:

c.JupyterHub.spawner_class = 'jupyterhub.spawner.LocalProcessSpawner'
c.Spawner.notebook_dir = '/JHubShare/home/{username}'

On upgrading to 2.0.0, the home directory is now set to ~/ (i.e./home/{username} default on Linux), which is the environment variable $HOME for respective users…

Did this configuration behavior change for the default spawner class in Jhub 2.0.0? There are troubleshooting instructions here https://jupyterhub.readthedocs.io/en/stable/troubleshooting.html#i-want-access-to-the-whole-filesystem-but-still-default-users-to-their-home-directory but unclear how to get this back and working…

Thanks & much appreciated, and apologies in advance if this Topic is not posted on correct forum!

1 Like

I think I have a similar problem as you (and no solution); but I do not understand something: upon upgrading to 2.0.0, did you experience some errors, or not?

Also:

On upgrading to 2.0.0, the home directory is now set to ~/ (i.e. /home/{username} default on Linux),

Where is the “home directory now set to”? In the jupyterhub_config.py? But that file you generate yourself, it shouldn’t change automatically?

Can you share pip list? My guess is that this is related to the switch to jupyter_server by default, and perhaps the $JUPYTERHUB_ROOT_DIR config getting ignored. Maybe some other package is out-of-date.

Can you share the log output of the single-user server starting up? And can you run in the single-user server in a terminal:

env | grep JUPYTERHUB | grep -v TOKEN | sort
1 Like

Thanks @minrk for the response, below is my pip list…

The home dir is default ~/ instead of value defined in JUPYTERHUB_ROOT_DIR… I have tried appending %U and {username} to jhub config c.Spawner.notebook_dir but does not make a difference… The hub still defaults to tree view instead of lab as defined in JUPYTERHUB_DEFAULT_URL, perhaps this is related.

[ejacquot@my.domain.com@NXJHub1 ~]$ env | grep JUPYTERHUB | grep -v TOKEN | sort

JUPYTERHUB_ACTIVITY_URL=http://127.0.0.1:8081/hub/api/users/ejacquot@my.domain.com/activity
JUPYTERHUB_API_URL=http://127.0.0.1:8081/hub/api
JUPYTERHUB_BASE_URL=/
JUPYTERHUB_CLIENT_ID=jupyterhub-user-ejacquot%40my.domain.com
JUPYTERHUB_DEFAULT_URL=/lab
JUPYTERHUB_HOST=
JUPYTERHUB_OAUTH_CALLBACK_URL=/user/ejacquot@my.domain.com/oauth_callback
JUPYTERHUB_OAUTH_SCOPES=["access:servers!server=ejacquot@my.domain.com/", "access:servers!user=ejacquot@my.domain.com"]
JUPYTERHUB_ROOT_DIR=/JHubShare/home/
JUPYTERHUB_SERVER_NAME=
JUPYTERHUB_SERVICE_PREFIX=/user/ejacquot@my.domain.com/
JUPYTERHUB_SERVICE_URL=http://127.0.0.1:50669/user/ejacquot@my.domain.com/
JUPYTERHUB_USER=ejacquot@my.domain.com

Okay actually I was able to resolve by just archiving my existing Active Directory authenticated home directory (default ~/) and then signing in again via SSH to create a fresh home dir… On doing this I was able to log back in just fine for custom home directory on NFS and /lab as the default…

Clearly I misconfigured something, either with a customization in my home dir which was used instead of the jhub config… I don’t think it’s anything in ~/.jupyter or ~/.ipython as I am now trying to selecting back up & remove various directories to find what caused this…

UPDATE: The misconfiguration causing this for me was somewhere in ~/.local/ … On changing this directory name (appending .bak) and re-authenticating the hub works as expected! This very well could be I accidentally ran jupyter from my home directory / completely user error. Hope that is helpful for others

Regardless thanks all & glad to move to Jhub 2.0.0