Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic DISPLAY selection over ssh #612

Closed
totaam opened this issue Jul 10, 2014 · 13 comments
Closed

automatic DISPLAY selection over ssh #612

totaam opened this issue Jul 10, 2014 · 13 comments

Comments

@totaam
Copy link
Collaborator

totaam commented Jul 10, 2014

Issue migrated from trac ticket # 612

component: server | priority: minor | resolution: fixed

2014-07-10 22:32:58: totaam created the issue


Split from #172.

Remote start via ssh no longer needs a display to be specified. The difficulty is twofold:

  • we don't know in advance if the other end supports displayfd, and if it doesn't we need to detect that this is what happened and tell the user
  • the connection string we generate for the client uses the display... and we don't have it yet. There is currently no way of knowing what display was chosen either!
@totaam
Copy link
Collaborator Author

totaam commented Jun 2, 2015

2015-06-02 16:06:15: antoine changed status from new to assigned

@totaam
Copy link
Collaborator Author

totaam commented Jun 2, 2015

2015-06-02 16:06:15: antoine commented


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)

@totaam
Copy link
Collaborator Author

totaam commented Jun 19, 2015

2015-06-19 14:29:34: antoine changed status from assigned to new

@totaam
Copy link
Collaborator Author

totaam commented Jun 19, 2015

2015-06-19 14:29:34: antoine changed owner from antoine to afarr

@totaam
Copy link
Collaborator Author

totaam commented Jun 19, 2015

2015-06-19 14:29:34: antoine commented


done in r9683 + r9684.

@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.

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:22:43: maxmylyn commented


Attempted to start a r9688 Trunk Fedora 21 Server:

  • Got the following traceback when starting with 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..)

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:26:46: antoine commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:29:40: antoine commented


Here's another way of triggering those same errors using an invalid display with the X11 client:

DISPLAY="" xpra attach

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:32:19: maxmylyn commented


Now that I've confirmed I'm a moron:

  • Started from my Fedora 20 box (same version) against Fedora 21 (same version) with

xpra start --start-child=xterm ssh:uname@testvm

Everything works as expected.

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:34:14: antoine changed status from new to closed

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:34:14: antoine set resolution to fixed

@totaam
Copy link
Collaborator Author

totaam commented Jun 22, 2015

2015-06-22 18:34:14: antoine commented


@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.

@totaam totaam closed this as completed Jun 22, 2015
@totaam
Copy link
Collaborator Author

totaam commented Jun 26, 2015

2015-06-26 17:28:36: antoine commented


@maxmylyn: FYI, as of r9721, the error message has been improved:

  • gtk2:
$ 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
  • gtk3:
$ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant