Citrix Receiver on Raspberry Pi -Raspbian Jessie

Source

The Citrix Receiver for Linux has a dependency on glibc6 version 2.15-0 or later. Raspbian Wheezy currently ships with 2.13-38 as can be seen by checking the output of ldd –version:

pi@raspberrypi ~ $ ldd --version
ldd (Debian EGLIBC 2.13-38+rpi2+deb7u8) 2.13

Later versions of glibc aren’t available in the Debian Wheezy branch. They are however available in later Debian release branches. If you do manage to get it installed there are still changes you need to make to improve the performance to a usable level.

The Solution

As of today (1 Aug 2015) there isn’t a ready packaged solution. When Raspbian updates to a Debian “Jessie” derivative I’ll review which steps need to change. For example Jessie includes the required version of glibc6.

The Workaround

We also need to make some changes to the Citrix Receiver and the Raspberry Pi’s configuration.

Step 1: Update the glibc to version >= 2.15

The OS needs to be updated to add a newer version of glibc, this updated version isn’t available in the stable branch, instead we need to get this from the unstable (sid) branch.

1.1 Update package sources to include unstable packages

Edit files using vi, nano or whatever you like, such as Sublime Text on my Windows PC, see how here.

1.2 Install the updated glibc6 from the unstable branch
  • sudo apt-get update && sudo apt-get -t sid install libc6
  • When prompted update the packages, I had 14 to upgrade.
  • When prompted accept to install the packages that can’t be authenticated.
  • When prompted let it restart the services
  • Confirm the version of glibc6 has been updated to a version > 2.15:
    • ldd --version should report 2.19 i.e:
pi@raspberrypi ~ $ ldd --version
ldd (Debian GLIBC 2.19-19) 2.19
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

1.3 Change packages sources back to stable branch

To avoid accidentally updating the whole distribution to unstable packages, change the sources back

  • Undo the changes from step 1.1. Edit /etc/apt/sources.list un-comment the original package repository and comment out the unstable repository.
  • Refresh the packages with the original repository: sudo apt-get update

Step 2: Download and Install the Citrix Receiver

The Citrix Receiver has a number of package dependencies, some required some recommended. I’d recommend you use gdebi to install the packages as it will find and install the dependent packages and therefore simplify the setup. So if you don’t have it installed already run the command: sudo apt-get install gdebi (Thanks to Ben Waine for making me aware of gdebi).

Also ensure you download the ARMHF packages and not the ARMEL versions.

  • Download the Debian (.deb) packages of Citrix Receiver for Linux (ARMHF) and the (optional) USB Support Package from citrix.com. (Current links are to the 13.2 client, always best to check if there is a newer version).
  • Install the Receiver: sudo gdebi icaclient_13.2.0.322243_armhf.deb
  • (optional) Install the USB Support package: sudo gdebi ctxusb_2.5.322243_armhf.deb

Step 3: Test the Client

You’ll need to have GUI running if you haven’t already. If at a terminal prompt, enter the command startx to load the GUI

3.1 Configure the Citrix Receiver for Linux
  • Launch Citrix Receiver, either from the desktop menu item or run: /opt/Citrix/ICAClient/selfservice & 
  • Configure your connection. If using a StoreFront store you’ll need to use HTTPS and ensure you have the necessary pem formatted certificate download to the keystore/castore. For simplicity I’m going to use the PNAgent site on my XenApp 7.6 deployment.
    • The address of which I enter as: http://xa76.rowannet.local/Citrix/Store/PNAgent/config.xml
    • If you are looking for your PNAgent site URL, you’ll find it by running Citrix Studio, Open the Citrix StoreFront console node: Stores -> “Configure XenApp Services Support”. The dialog that appears will show if PNAgent is enabled and the URL.
  • Add one of your published resources (Applications or Desktops)
  • Connect. You should hopefully have a successful session.

 

Step 4: Optimising Performance

4.1. Measure Performance

You can measure some elements of session performance my examining information from Citrix HDX Monitor, which can be downloaded and run within the session. If you run it you’ll see something like the images below (though these are taken from a Windows Client):

 

An alternative to using HDX Monitor, the Receiver for Linux offers some client side metrics which can be enabled via parameters for WFICA_OPTS (see the section “Monitor real-time performance” in the Citrix Receiver for Linux OEM’s Reference Guide for more information on what each of these values do). Using these options we can assess the impact of the suggested changes. Before running the Citrix Receiver, run run command:  export WFICA_OPTS="-rm Dcdjfresot"

For my test I connected to a XenApp 7.6 Desktop at 1600×1200 and ran a 720p video using VLC. The frame rates and CPU usage values quoted are the average during video playback. The initial rate achieved before any (ok I’d fixed the CPU Governor to ondemand rather than powersave) optimisation was 6.8 FPS @ 45% CPU usage. After all the optimisations below are applied, including the Pi2 preset overclock; there was a 178% improvement to 19 FPS @ 34% CPU usage.

 

4.2 Check your PSU

If you ever see a small rainbow coloured square on the top right of your display, this is an indication that your Pi is not receiving sufficient power. You should review the PSU are using ideally you want a PSU with a 5V 2A (2000mA) output. The actual power draw of your Pi will be dependent on devices you have attached. In addition to the rainbow square, the Pi will not be able to run the CPU at maximum power.

4.3 CPU Governor (Pi Setting)

This controls the one of the power management features of the CPU, see: cpu-freq documentation.

  • Check the current mode of your CPU: cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  • My output: powersave
  • It appears to get the default to be ondemand, we simply need to update the Pi with the latest updates:
    • sudo apt-get update && sudo apt-get upgrade
  • Reboot your Pi (sudo reboot)
  • Login and repeat the 1st command to confirm the scaling_governor is now: ondemand

Performance: 6.8 FPS @ 45% CPU – Using Citrix Compatibility Graphics mode

4.4 Set the Framebuffer depth (Pi Setting)

  • Edit the file /boot/config.txt
  • You can place this change anywhere in the file, but it makes sense beneath the entries for framebuffer_height, which are commented out by default
  • Add the line: framebuffer_depth=32
    • Note: According to elinux.org setting the framebuffer_depth > 16 will also need: framebuffer_ignore_alpha=1. My basic testing didn’t observe any difference, so perhaps this has been resolved in more recent releases? 
  • Save and exit
  • Reboot your Pi (sudo reboot)

Performance: 8.9 FPS (+30%) @ 48% CPU (+5%) – Using Citrix H264 Graphics mode

4.5 Switch to accelerated jpeg libraries (libjpeg62-turbo) (Software packages)

The ARM processor in the Pi 2 supports some extensions to accelerate certain operations, called NEON. Intel has MMX and SSE2. Using these extensions libjpeg-turbo claims a 2x-4x speed improvement. The Citrix Receiver configuration needs to be modified a little to take advantage of this. Once again we have to use the unstable branch to access the required packages.

  • Switch package sources to the unstable branch. Follow the steps in 1.1 (above)
  • Install the libjpeg76-turbo package: sudo apt-get update && sudo apt-get install libjpeg62-turbo
  • Repeat step 1.5 from above to revert the changes to the repository locations
  • The Citrix receiver works through possible jpeg decoders it can use. On my Pi 2 it was using ctxjpeg_fb_8.so as /usr/lib/arm-linux-gnueabihf/libjpeg.so.8 was present, however this isn’t the accelerated version. So we need to rename this so that the Citrix Receiver doesn’t try and use the version 8 fallback.
    • sudo mv /opt/Citrix/ICAClient/lib/ctxjpeg_fb_8.so /opt/Citrix/ICAClient/lib/ctxjpeg_fb_8.so.DO_NOT_USE
  • Now the Citrix Receiver will use ctxjpeg_fb.so which is linked to the newly installed libjpeg62-turbo library.

Performance: No change as expected in H264 mode.

4.6 Disable H264 graphics mode (Citrix Setting)

A side effect of increasing the size of the frame buffer (step 5.1), is that by default connections will now switch to H264 mode. However this won’t give the best experience on a Raspberry Pi, so we’ll want to disable this for all connections.

  • Edit: /opt/Citrix/ICAClient/config/module.ini
  • Under the section for: [WFClient]
  • Add the line: H264Enabled=False
  • Save the file

Performance: 14 FPS (+105%) @ 35% CPU (-22%) – Using Citrix Compatibility Graphics mode

4.7 Disable Multimedia Redirection (Citrix Setting)

When you make a connection to your XenApp/XenDesktop Server you may want to try playing some video content. Citrix has a feature (HDX MediaStream aka RAVE) which can redirect video to be played using client side resources rather than playing it server side. The Pi, however doesn’t work well with this. So we’ll want to render our video server side.

  • Edit: /opt/Citrix/ICAClient/config/module.ini
  • Under the section for: [ICA 3.0]
  • Edit the line for: VirtualDriver =
  • Remove the entry for: MultiMedia
  • Save the file

Performance: No change as test uses server side rendered video.

4.8 Implement Thinwire+ (aka Project Snowball) (Citrix additional software)

The Thinwire+ feature is now available in XenApp/XenDesktop 7.6 Feature Pack 3, see: https://www.citrix.com/blogs/2015/10/01/feature-pack-3-for-xenapp-and-xendesktop-7-6-is-now-available/

Performance: 16.7 FPS (+145%) @ 34% CPU (-25%) – Using Citrix Compatibility Graphics mode with snowball private

Step 5: Further Performance (optional)

The raspi-config utility provides some simple steps to try out various levels over overclocking your Pi. Online you can buy heatsinks and cooling fans if you feel the need to push the limits of your Pi and go beyond some of the standard overclock settings. However if you push the limits it tends to lead to instability. Testing with Pi2 preset I didn’t have any issues with stability.

5.1 Setting overclock setting to the “Pi2” preset

 

  • Increases the maximum clock speed (arm_freq) by 11% to 1000MHz.(The min remains 600Mhz)
  • Increases the core (GPU) frequency (core_freq) by 100% to 500MHz
  • Increases the memory frequency (sdram_freq) by 25% to 500MHz
  • Increases the over_voltage to 2, effectively providing an additional 2 x 0.025V to the base 1.2V CPU voltage. This is generally needed to balance the increase power draw from increasing clock frequencies.

in my implementtion of these instrucitions, I received an error launching a web portal published application.  Probably due to the new client and an encryption error.

To fix the issue,

sudo ln -s /usr/share/ca-certificates/mozilla/* /opt/Citrix/ICAClient/keystore/cacerts

Worked like a charm after the copy.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s