Split from #172.
Remote start via ssh no longer needs a display to be specified. The difficulty is twofold:
Now that we don't support older distros, we can assume displayfd is available. (except maybe for some older Ubuntu versions? Meh, don't care about those)
@afarr: this is just a FYI, but feel free to test or just close this ticket.
This should now work as long as the server has xpra installed:
xpra start --start-child=xterm ssh:hostname
Previous versions required the form:
xpra start --start-child=xterm ssh:hostname:DISPLAY
Which required choosing a display number in advance, without knowing if it would actually be free.
Attempted to start a r9688 Trunk Fedora 21 Server:
xpra start --start-child=xterm ssh:localhost
:
[max@schlafanzug ~]$ xpra start --start-child=xterm ssh:localhost /usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display warnings.warn(str(e), _gtk.Warning) /usr/lib64/python2.7/site-packages/xpra/client/gtk2/__init__.py:7: GtkWarning: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed from xpra.x11.gtk_x11 import gdk_display_source /usr/lib64/python2.7/site-packages/xpra/gtk_common/gtk_util.py:181: GtkWarning: IA__gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed default_Cursor = gdk.Cursor(gdk.X_CURSOR) xpra main error: Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 114, in main return run_mode(script_file, err, options, args, mode, defaults) File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 898, in run_mode return run_remote_server(error_cb, options, args, mode, defaults) File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 1357, in run_remote_server app = make_client(error_cb, opts) File "/usr/lib64/python2.7/site-packages/xpra/scripts/main.py", line 1294, in make_client toolkit_module = __import__(client_module, globals(), locals(), ['XpraClient']) File "/usr/lib64/python2.7/site-packages/xpra/client/gtk2/client.py", line 24, in <module> from xpra.gtk_common.gtk_util import gtk_main, color_parse File "/usr/lib64/python2.7/site-packages/xpra/gtk_common/gtk_util.py", line 181, in <module> default_Cursor = gdk.Cursor(gdk.X_CURSOR) RuntimeError: could not create GdkCursor object
In addition, the server crashes.
For what it's worth: Also specifying a display number also outputs the same traceback. Not sure if it's legitimately broken or I have no idea how to start an ssh session. TCP is working, however (which is how I'm typing this comment..)
This means that you are attempting to start a session from a terminal which cannot access your display - this won't work, whether you specify the remote display or not: (and has little to do with this ticket!)
/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
You need to run this command from a client, without starting a server in advance - it will be started for you.
Here's another way of triggering those same errors using an invalid display with the X11 client:
DISPLAY="" xpra attach
Now that I've confirmed I'm a moron:
xpra start --start-child=xterm ssh:uname@testvm
Everything works as expected.
@maxmylyn: LOL - thanks for testing!
FWIW: I do have plans to refactor the gtk initialization code as part of #640, which would allow us to bail out earlier when the DISPLAY is not set, giving a more friendly error message for those cases.
@maxmylyn: FYI, as of r9721, the error message has been improved:
$ DISPLAY= python2 /usr/bin/xpra attach --no-speaker /usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display warnings.warn(str(e), _gtk.Warning) xpra initialization error: cannot access the display
$ DISPLAY= python3 /usr/bin/xpra attach --no-speaker Unable to init server: Could not connect: Connection refused xpra initialization error: cannot access the display
I could also intercept the gtk2 warnings, but I think this is clear enough as it is.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/612