Systemd Spawner Permission Error

187 views
Skip to first unread message

khle...@colorado.edu

unread,
Sep 26, 2016, 2:44:01 PM9/26/16
to Project Jupyter
I'm getting permission errors on the systemd spawner even though I'm running it as root. These are the errors I'm getting. It's a fairly new spawner, bu I feel like I'm missing something obvious. 

    Traceback (most recent call last):
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/user.py", line 248, in spawn
        yield self.stop()
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/user.py", line 302, in stop
        status = yield spawner.poll()
      File "/usr/lib/python3.4/site-packages/systemdspawner/systemdspawner.py", line 176, in poll
        self.unit_name
      File "/usr/lib64/python3.4/subprocess.py", line 607, in check_output
        with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
      File "/usr/lib64/python3.4/subprocess.py", line 859, in __init__
        restore_signals, start_new_session)
      File "/usr/lib64/python3.4/subprocess.py", line 1457, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    PermissionError: [Errno 13] Permission denied
    
[E 2016-09-26 12:34:24.043 JupyterHub web:1548] Uncaught exception GET /hub/user/philliple (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8000', method='GET', uri='/hub/user/philliple', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Referer': 'http://localhost:8000/hub/home', 'Connection': 'close', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Cookie': 'jupyter-hub-token="2|1:0|10:1474912415|17:jupyter-hub-token|44:ZjU0OWE1MjNmYjBhNGEwOGE4YTFmMjg3MGM2MjQwZjQ=|1df692d9b3f6146b5d4d76f1024a1ab5de455c04f2b4eebe855d58614329a41f"', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36', 'Upgrade-Insecure-Requests': '1', 'Host': 'localhost:8000'})
    Traceback (most recent call last):
      File "/usr/lib64/python3.4/site-packages/tornado/web.py", line 1469, in _execute
        result = yield result
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/handlers/base.py", line 510, in get
        yield self.spawn_single_user(current_user)
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/handlers/base.py", line 323, in spawn_single_user
        yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/user.py", line 254, in spawn
        raise e
      File "/home/philliple/jupyterhub/jupyterhub/jupyterhub/user.py", line 228, in spawn
        ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
      File "/usr/lib/python3.4/site-packages/systemdspawner/systemdspawner.py", line 85, in start
        self.unit_name
      File "/usr/lib64/python3.4/subprocess.py", line 607, in check_output
        with Popen(*popenargs, stdout=PIPE, **kwargs) as process:
      File "/usr/lib64/python3.4/subprocess.py", line 859, in __init__
        restore_signals, start_new_session)
      File "/usr/lib64/python3.4/subprocess.py", line 1457, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    PermissionError: [Errno 13] Permission denied



Yuvi Panda

unread,
Sep 26, 2016, 5:12:36 PM9/26/16
to jup...@googlegroups.com
Hello!

That's very interesting - can you share the contents of your
jupyterhub_config.py file?
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/78f3ba50-b2d1-4647-9867-cf7eb9a2e697%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Yuvi Panda T
http://yuvi.in/blog

Lawrence D’Oliveiro

unread,
Sep 27, 2016, 2:19:54 AM9/27/16
to Project Jupyter
On Tuesday, September 27, 2016 at 7:44:01 AM UTC+13, khle...@colorado.edu wrote:
I'm getting permission errors on the systemd spawner even though I'm running it as root.

Is the file you’re trying to execute actually executable?

khle...@colorado.edu

unread,
Sep 27, 2016, 12:24:52 PM9/27/16
to Project Jupyter, yuvi...@gmail.com
Here you go. It's only a couple of lines though.
c = get_config()
c.Authenticator.admin_users = {'philliple'}
c.JupyterHub.spawner_class='systemdspawner.SystemdSpawner'

I also want to note that messing with it more I'm getting SElinux alers telling me pyhon3.4 is trying to access files like /usr/bin/systemctl which I'm assuming is where the permission error is, but shouldn't root be able to access these files?

Yuvi Panda

unread,
Sep 28, 2016, 2:47:38 AM9/28/16
to khle...@colorado.edu, Project Jupyter
Ah, yeah it could be SELinux related. Can you test it on a machine
with SELinux disabled (but all other bits - OS, distro, python
version, etc) the same to see if SELinux is the problem?
systemdspawner requires full access to systemctl, and since systemctl
is very powerful I can imagine SELinux disabling access to it by
default. If SELinux is the problem, need to find some way of letting
jupyterhub have full access to systemctl via SELinux.
Reply all
Reply to author
Forward
0 new messages