jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.04k stars 340 forks source link

bootstrap: apt-get update failure not detected, red-herring errors follow #575

Open nbastin opened 4 years ago

nbastin commented 4 years ago

Bug description

If you install the prerequisites as indicated on the web site, and run the bootstrap.py script, it thinks you don't get Node.js and the installation fails.

Expected behaviour

Installation would succeed.

Actual behaviour

You get this log and the installation fails:

Checking if TLJH is already installed...
Setting up hub environment
Installed python & virtual environment
Set up hub virtual environment
Setting up TLJH installer...
Upgraded pip
Setup tljh package
Starting TLJH installer...
Setting up admin users
Granting passwordless sudo to JupyterHub admins...
Setting up user environment...
Downloading & setting up user environment...
Setting up JupyterHub...
Downloading traefik 1.7.18...
Ran /opt/tljh/user/bin/jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.1 --no-build with exit code 1
An error occured.
ValueError: Please install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).
See the log file for details:  /tmp/jupyterlab-debug-twt1muvk.log

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 509, in <module>
    main()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 497, in main
    ensure_jupyterlab_extensions()
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/installer.py", line 182, in ensure_jupyterlab_extensions
    ] + extensions + install_options)
  File "/opt/tljh/hub/lib/python3.6/site-packages/tljh/utils.py", line 32, in run_subprocess
    raise subprocess.CalledProcessError(cmd=cmd, returncode=proc.returncode)
subprocess.CalledProcessError: Command '['/opt/tljh/user/bin/jupyter', 'labextension', 'install', '@jupyter-widgets/jupyterlab-manager@1.1', '--no-build']' returned non-zero exit status 1.

In the log created in /tmp/, it seems that there is a Node available, right before the error:

Yarn configuration loaded.
Node v8.10.0

How to reproduce

  1. Install prereqs as documented:

    $ sudo apt-get install python3 python3-dev git curl
  2. Attempt to run install script:

    curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py | sudo -E python3 - --admin admin

Your personal set up

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

$ uname -a
Linux jhub-test 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Completely fresh install, no extra packages other than openssh.

nbastin commented 4 years ago

It seems likely that the problem here is that the bootstrap.py script adds an https:// package repository to sources.list.d, which causes apt-get update to fail in many proxied environments but the installer does not notice this error and continues on as if everything went fine (only to fail later with a far more mysterious error).

JeffSaxeVA commented 4 years ago

+1, we also encountered this issue. In our locked-down firewall environment, we pull all our apt-get packages through an apt-cacher-ng server, and while it could theoretically proxy both HTTP and HTTPS, it is more able to inspect everything if it's HTTP. So in our case, the bootstrap script added the HTTPS version of nodesource (in a nice, separate sources.list.d file, that is appreciated!), and then it tried to install Node.js but this apt-get failed, and the calling script doesn't notice that this happened. The error later is, I concur, more mysterious, a distracting red herring for troubleshooting!

My vote would be for whatever is calling the apt-get to notice the failed install and then halt the script there with an appropriate message, perhaps calling attention to /etc/apt/sources.list.d/nodesource.list for the sysadmin to adjust.