CoEPP RC
 

XPRA

Introduction

  • Xpra stands for X Persistent Remote Applications. It emerged as a valid replacement of FreeNX which has became old and unmaintained.
  • Xpra allows to run X programs, usually on a remote host, and direct their display to your local machine.
    • It also allows you to display existing desktop sessions remotely. It is sometimes referenced as 'screen of X windows'.
  • Xpra is “rootless” or “seamless”
    • Sessions can be accessed over SSH, or password protected and encrypted over plain TCP sockets.
  • Xpra adapts to bandwidth constraints and is fully open-source.

Installation

  • Both remote and local machines will need XPRA
    • The RC team will install it on all CoEPP UIs.
    • You will need to install it on your local laptop or desktop machine.
  • For the XPRA Linux release:
    • There is no explicit packaging for SL6 but it is possible to use the XPRA Centos6 release.
1) Download the repo key
# rpm --import http://winswitch.org/gpg.asc

2) Install the repo
# cd /etc/yum.repos.d/; curl -O https://winswitch.org/downloads/CentOS/winswitch.repo

3) Install xpra (and corresponding dependencies)
$ yum install xpra
(...)
============================================================================================================================================================
 Package                                      Arch                         Version                                  Repository                         Size
============================================================================================================================================================
Installing:
 python-pillow                                x86_64                       2.8.1-1.el6                              winswitch                         838 k
     replacing  python-imaging.x86_64 1.1.6-19.el6
 xpra                                         x86_64                       0.14.22-1.el6_6                          winswitch                         2.6 M
Installing for dependencies:
 PyOpenGL                                     noarch                       3.1.0final-3.el6                         winswitch                         2.3 M
 PyOpenGL-accelerate                          x86_64                       3.1.0-2.el6                              winswitch                         603 k
 ffmpeg-xpra                                  x86_64                       2.4.7-1.el6                              winswitch                         1.6 M
 freeglut                                     x86_64                       2.6.0-1.el6                              sl                                171 k
 gtk2-immodule-xim                            x86_64                       2.24.23-6.el6                            sl                                 62 k
 gtkglext-libs                                x86_64                       1.2.0-11.el6                             sl                                106 k
 libfakeXinerama                              x86_64                       0.1.0-3.el6                              winswitch                         7.1 k
 libvpx-xpra                                  x86_64                       1.4.0-1.el6                              winswitch                         788 k
 libwebp-xpra                                 x86_64                       0.4.3-1.el6                              winswitch                         706 k
 libxkbfile                                   x86_64                       1.0.6-1.1.el6                            sl                                 73 k
 pygtkglext                                   x86_64                       1.1.0-7.1.el6                            sl                                119 k
 python-crypto                                x86_64                       2.6.1-2.el6                              winswitch                         893 k
 python-lz4                                   x86_64                       0.7.0-0.el6                              winswitch                          22 k
 python-netifaces                             x86_64                       0.5-1.el6                                epel                               12 k
 python-rencode                               x86_64                       1.0.3-1.el6                              winswitch                         117 k
 system-setup-keyboard                        x86_64                       0.7-4.el6                                sl                                 10 k
 x264-xpra                                    x86_64                       20141208-1.el6                           winswitch                         523 k
 xkeyboard-config                             noarch                       2.11-1.el6                               sl                                748 k
 xorg-x11-drv-dummy                           x86_64                       0.3.6-15.xpra3.el6                       winswitch                          54 k
 xorg-x11-drv-void                            x86_64                       1.4.0-23.el6                             sl                                 12 k
 xorg-x11-server-Xorg                         x86_64                       1.15.0-25.sl6                            sl-security                       1.3 M
 xorg-x11-server-common                       x86_64                       1.15.0-25.sl6                            sl-security                        49 k
 xorg-x11-xkb-utils                           x86_64                       7.7-4.el6                                sl                                 85 k

Transaction Summary
============================================================================================================================================================
Install      25 Package(s)
(...)

Usage

General

  • xpra works in a server / client base.
  • The underlying idea is that an xpra server can be started on the remote host making available an application through a specific DISPLAY.
  • Once the xpra server is running, the xpra client (running on a local host) can be used to attach to that DISPLAY.
  • The xpra client can detach from the DISPLAY, and attach again some time later.

A general Xpra use case with xterm

  • A generic use case is to start an xterm application using Xpra, and then use that xterm to configure and start other remote applications (ex: root, xemacs, firefox, …). For this use case to work properly, the user must have a '$HOME/.bashrc' file (or equivalent in csh) similar to example bellow, in the remote host.
$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
  • All following operations can be done on the localhost.
  • The DISPLAY ID has to be unique. Therefore, we will use the $RANDOM env var in bash to guarantee unique DISPLAY IDs.
  • Start the Xpra server in the remote machine, start the application, and attach the Xpra client to the DISPLAY $ND. xterm should shortly appear in your local machine.
[localhost ~]$ ND=$RANDOM
[localhost ~]$ xpra start ssh:goncalo@sydui4.syd.coepp.org.au:$ND --start-child=xterm &
2015-04-15 11:03:40,484 xpra client version 0.14.22
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2015-04-15 11:03:40,738 OpenGL_accelerate module loaded
2015-04-15 11:03:40,738 Using accelerated ArrayDatatype
2015-04-15 11:03:40,841 keyboard layouts: us,us
2015-04-15 11:03:40,907 detected keyboard: rules=evdev, model=pc105, layout=us,us
2015-04-15 11:03:40,908 desktop size is 2560x1440 with 1 screen(s):
2015-04-15 11:03:40,908   ':0.0' (677x381 mm) workarea: 2560x1413 at 0x27
2015-04-15 11:03:40,908     DVI-D-0 (597x336 mm)
Entering daemon mode; any further errors will be reported to:
  /home/goncalo/.xpra/:100.log
2015-04-15 11:03:42,225 server: Linux Scientific Linux 6.6 Carbon, Xpra version 0.14.22 (runknown)
  • Once xterm starts, the user can use it to launch other remote applications. All the windows applications will be properly redirected to the local machine.
  • At any time, you can detach from the DISPLAY, and attach later one
[localhost ~]$ xpra detach ssh:goncalo@sydui4.syd.coepp.org.au:$ND
server failure: disconnected before the session could be established
server requested disconnect: done (1 other clients have been disconnected)
Killed by signal 15.
2015-04-15 14:06:48,594 server requested disconnect: detach request
Killed by signal 15.
2015-04-15 14:06:48,802 Connection lost

[localhost ~]$ xpra attach ssh:goncalo@sydui4.syd.coepp.org.au:$ND &
[1] 26790
2015-04-15 14:08:30,737 xpra client version 0.14.22
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
2015-04-15 14:08:30,968 OpenGL_accelerate module loaded
2015-04-15 14:08:30,968 Using accelerated ArrayDatatype
2015-04-15 14:08:31,061 keyboard layouts: us,us
2015-04-15 14:08:31,111 detected keyboard: rules=evdev, model=pc105, layout=us,us
2015-04-15 14:08:31,111 desktop size is 2560x1440 with 1 screen(s):
2015-04-15 14:08:31,112   ':0.0' (677x381 mm) workarea: 2560x1413 at 0x27
2015-04-15 14:08:31,112     DVI-D-0 (597x336 mm)
2015-04-15 14:08:31,770 server: Linux Scientific Linux 6.6 Carbon, Xpra version 0.14.22 (runknown)
2015-04-15 14:08:31,771 Attached to ssh:goncalo@sydui4.syd.coepp.org.au:100 (press Control-C to detach)
  • When you close the xterm window, you close the application. However, the Xpra server continues to control the $ND DISPLAY, and the Xpra client continues to be attached to it (if you did not detached). You can actually reuse that DISPLAY to launch the same or other application via, for example, ssh. In this example, we are starting xemacs.
$ ssh -l goncalo sydui4.syd.coepp.org.au "DISPLAY=:$ND xemacs&" &
  • The server will continue running in the remote side until it is stopped (which should be done when you finish working)
$ xpra stop ssh:goncalo@sydui4.syd.coepp.org.au:$ND
2015-04-15 11:38:32,914 server requested disconnect: server shutdown
server requested disconnect: server shutdown
Killed by signal 15.
Killed by signal 15.
Sent shutdown command

Other use cases

Trouble Shooting

  • If you have problems starting your Xpra server in the remote machine:
    1. check if the DISPLAY ID you are using is not under the control of other Xpra server. Execute ps xuawww | grep xpra in the remote machine to check
    2. check the xpra logs (stored under $HOME/.xpra/:<DISPLAY>.log
    3. If you are unable to start the Xpra server, and there is no Xpra servers running under your ownership, delete the $HOME/.xpra directory in the remote host
  • If you have problems attaching to the DISPLAY controlled by a Xpra server from a local machine:
    1. check in the remote machine if the xpra server is really running
    2. check if the DISPLAY ID is correct and not under the control of other Xpra server. Execute ps xuawww | grep xpra in the remote machine to check
    3. check the xpra logs (stored under $HOME/.xpra/:<DISPLAY>.log
    4. If you are unable to attach to the Xpra server, try to delete the $HOME/.xpra directory in the local host, and retry

References

xpra.txt · Last modified: 2016/08/05 12:24 by scrosby
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki