Как запустить приложения X11 удаленно?

5619
jpaugh

Как запустить приложения X11, размещенные на удаленном сервере, с учетом следующих целей:

  • Запустите все, что будет работать локально на сервере. Это включает в себя приложения OpenGL, которые используют GLX.
  • Непревзойденная интеграция с локальным рабочим столом, то есть приложения выглядят так, как будто они работают локально, без отдельной области рабочего стола. Таким образом, мне нужно решение X11, а не протокол оболочки.
  • Предпочтительно, чтобы приложения продолжали работать, если я отключился; затем я могу снова открыть запущенные приложения при повторном подключении.

Я видел много советов о суперпользователе, но многие из них являются частичным исправлением или просто плохим.

  • Обычный ssh X11-Forwardingотсутствует: он не может запускать определенные приложения, особенно те, которые используют расширение GLX.
  • Настройка LIBGL_ALWAYS_INDIRECT=1 не работает для меня.
  • Xephyrтакже отсутствует. В настоящее время он не поддерживает GLX, хотя я видел некоторые работы GLX в дереве разработки. Возможно, в будущем это будет самый чистый путь.
  • xmoveтакже отсутствует. Это слишком стар, чтобы рассмотреть дальше.
  • VNC отсутствует. Он пересылает весь рабочий стол и не может использовать протокол X.

РЕДАКТИРОВАТЬ: Я боролся за выходные, чтобы выработать несколько предложений, и xpraэто то, что работает лучше всего. Я описал мои настройки в ответе ниже, и я надеюсь, что это поможет кому-то еще.

5

1 ответ на вопрос

8
jpaugh

Xpra (as mentioned here) does what I want. It allows running arbitrary X applications, which can be forwarded to multiple clients, either on the same computer, or on another machine. It supports running OpenGL apps, too, and allows your apps to continue running even after the last client disconnects — giving you the chance to reconnect later.

xpra comes in two parts: a client and a server. To start up the server, run the following on the remote machine:

$ xpra start :100 

This starts up xpra on a new X display. (There's a workaround to use with a proxy.)

To have an application controlled by xpra, run it on the same display as the xpra server, like this:

$ export DISPLAY=:100 $ firefox& $ blender& ... 

This can all be done through an ssh connection (with or without X11-Forwarding) with no problems.

To start up a client, do one of the following:

$ ssh -X user@remotehost <gain remote connection> $ xpra attach :100 

or

$ xpra attach ssh:user@remotehost:100 

Note that the latter requires the xpra client to be installed on your local machine; the former does not.

The xpra client will put an icon in your window manager's task bar/panel allowing you to disconnect the client. (Or, you can just kill it, so long as you're careful not to kill the server.) You can then reattach later, as long as the xpra server is still running. If you have a single xpra server running on the host, you can also simply omit the display number, and xpra attach will figure it out.

One very nice feature of xpra is that it allows you to start a server on a pre-existing display. This allows you to recover a session if the xpra server crashes (as long as the X server on that display is still running). To do this, run

$ xpra start --use-display :100 

Caveats:

  • xpra runs as a window manager. Although it plays pretty nicely with embedding in other window managers, it doesn't play so well with the X apps themselves: It doesn't allow, e.g. rxvt-unicode to remove its title bar; also it doesn't tell windows how much space they have to work with on-screen, e.g., drop-down boxes and menus fall off-screen. I think the latter problem is a matter of fixing my configuration, however.

  • Keys get repeated. Frequently. This can be solved by using xpra attach --no-keyboard-sync, but the man page warns that this doesn't work well with certain games. I'm keeping my fingers crossed that I don't find myself yearning to use one of these games.

For these reasons, Xephyr may well be a better solution (once it supports GLX), because it runs as an X server, not a window manager. I haven't investigated whether it supports resuming previously disconnected sessions, however.

Вы можете просто отредактировать свой основной пост вместо того, чтобы делать это как ответ. Kruug 10 лет назад 0
Я хотел бы получить несколько конкурирующих ответов. В идеале кто-то выложит что-нибудь получше. jpaugh 10 лет назад 0
Конечно, но тогда вы подождите их ... также проверьте Xming ... http: //sourceforge.net/projects/xming/ Kruug 10 лет назад 1
Хороший, спасибо. мне также пришлось добавить arg на сервер, сделав его `xpra start: 100 --start-via-proxy = no` - ошибка была` Предупреждение: не удалось использовать системный прокси для подкоманды 'start', не удалось подключиться к '/ run / xpra / system': [Errno 2] Нет такого файла или каталога`. HankCa 6 лет назад 1
@HankCa. Спасибо, я обновил текст. Я не использовал XPRA в течение некоторого времени. Как это работает для вас? jpaugh 6 лет назад 0
@jpaugh Да, мне нравится возможность подключаться к сеансам пользовательского интерфейса. У меня была проблема, при которой клиент не мог подключиться, и мне пришлось начать заново. Я уверен, что есть кое-что, что я все еще должен решить! HankCa 6 лет назад 0