notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Notebook doesn't open on recent Ubuntu (e.g. 20.04) with Chromium as default browser

Open mgedmin opened this issue 4 years ago • 4 comments

Steps to reproduce:

$ jupyter-notebook
[I 14:59:35.624 NotebookApp] Serving notebooks from local directory: /home/mg
[I 14:59:35.624 NotebookApp] The Jupyter Notebook is running at:
[I 14:59:35.624 NotebookApp] http://localhost:8888/?token=a4a2d5dfeaf5a426507e887f3909cf787b3426e51a7d2954
[I 14:59:35.624 NotebookApp]  or http://127.0.0.1:8888/?token=a4a2d5dfeaf5a426507e887f3909cf787b3426e51a7d2954
[I 14:59:35.624 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:59:35.643 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/mg/.local/share/jupyter/runtime/nbserver-780941-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=a4a2d5dfeaf5a426507e887f3909cf787b3426e51a7d2954
     or http://127.0.0.1:8888/?token=a4a2d5dfeaf5a426507e887f3909cf787b3426e51a7d2954

and then

Ekrano nuotrauka iš 2020-05-25 15-00-31

This is because Chromium in Ubuntu 20.04 is packaged via Snap, which puts all applications in a container where they cannot see certain filesystem directories (anything outside /home and /media, basically, plus all the files in dotted directories are inacessible -- which cuts off ~/.local/share/).

Clicking the http://localhost:8888/... link works fine.

While checking if this issue was already filed I've discovered the use_redirect_file option, which should work as a workaround.

It is unfortunate that these two security features clash and make the user experience worse. I wonder if anything can be done?

mgedmin avatar May 25 '20 12:05 mgedmin

Much of this could be avoided if use_redirect_file were False by default.

dimpase avatar Mar 30 '22 08:03 dimpase

Incidentally, Ubuntu 22.04 LTS will make its the default browser, Firefox, a snap package as well, which presumably has the same sandbox restrictions.

mgedmin avatar Mar 31 '22 07:03 mgedmin

Yes, this is an issue on Ubuntu 22.04 with Firefox. Here is a recent stackoverflow post that demonstrates it: https://stackoverflow.com/questions/54877158/jupyter-notebook-wont-open-in-newly-installed-firefox-quantum

I just upgraded to 22.04 and jupyter notebook opens a tab in firefox with the error. I have to manually open one of the URLs.

moorepants avatar May 17 '22 07:05 moorepants