matrix-org / pantalaimon

E2EE aware proxy daemon for matrix clients.
Apache License 2.0
283 stars 41 forks source link

Get panctl working on headless systems #37

Open Sorunome opened 4 years ago

Sorunome commented 4 years ago

Compiling pantalaimon with ui on headless systems is not possible. Commentint out the PyGObject dependency makes it compilable, at least, as it doesn't require cairo then. (PyGObjects seems to be unused anyways?)

After that, pantalaimon is unable to start, as to be able to autolaunch dbus sessions an X11 session is required

(.python3) sorunome@sorunome-bpi:~/pantalaimon$ pantalaimon
Traceback (most recent call last):
  File "/home/sorunome/.python3/bin/pantalaimon", line 8, in <module>
    sys.exit(main())
  File "/home/sorunome/.python3/lib/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/Click-7.0-py3.7.egg/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/Click-7.0-py3.7.egg/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/pantalaimon/main.py", line 180, in main
    pan_conf,
  File "<attrs generated init pantalaimon.ui.GlibT>", line 8, in __init__
  File "/home/sorunome/.python3/lib/python3.7/site-packages/pantalaimon/ui.py", line 466, in __attrs_post_init__
    self.bus = SessionBus()
  File "/home/sorunome/.python3/lib/python3.7/site-packages/pydbus/bus.py", line 60, in SessionBus
    return bus_get(Bus.Type.SESSION)
  File "/home/sorunome/.python3/lib/python3.7/site-packages/pydbus/bus.py", line 19, in bus_get
    return Gio.bus_get_sync(type, None).pydbus
gi.repository.GLib.Error: g-spawn-exit-error-quark: Error spawning command line “dbus-launch --autolaunch=391ecad09e9e427fbd865a229ec24eea --binary-syntax --close-stderr”: Child process exited with code 1 (1)
(.python3) sorunome@sorunome-bpi:~/pantalaimon$ dbus-launch --autolaunch=391ecad09e9e427fbd865a229ec24eea --binary-syntax --close-stderr
Autolaunch error: X11 initialization failed.
mkszuba commented 4 years ago

Some of the problems described here appear to be out of date so let me just concentrate on the one mentioned in the topic, namely getting panctl to run. Well, the answer is right there in the error message - you cannot auto-launch a D-Bus session automatically so you launch one manually. For testing or one-off configuration, the simplest way is to use the command dbus-run-session in conjunction with a terminal multiplexer such as screen or tmux:

Getting this to work with the daemon started by systemd can, depending on how exactly you want to set this up, be trickier - but can be done, it's a matter of sharing the value of DBUS_SESSION_BUS_ADDRESS between processes.