Tuesday, June 11, 2013

ALT TAB with Citrix ICA Remote Access Client

For some reason, the folks at Citrix don't feel that settings should be easily configurable nor should experiences be consistent.  If you are remoting into a machine, its my assumption that for the majority of cases, you would want to assume that remote machine as your own, ergo, all the commands you are used to using should be passed through and just work.  Alas, this is not the case.  Its very jarring when connected to a remote session, especially in full screen view, and you hit a key combination like ALT + TAB and you get thrown back into your host desktop.  Since I perform a lot of after hours support through Remote Access to my work, I want to ensure my experience is seamless since I often have dozens of windows open at a time.

The most reliable way to enable ALT+TAB I have found is to edit the wfclient.ini file.  This file is available whenever you install the Citrix Receiver client.

It can be found in the following locations:


Linux and OSX

In that file you want to find the [WFClient] and add the following to the end of the file.

Restart your ICA or Remote Access session and enjoy.  This should work whenever the session has focus regardless of if it is full screen or not.  If you only want it to pass through when its full screen, then change Remote to FullScreenOnly.

Thursday, April 04, 2013

Updating Time over HTTP on Raspberry Pi

The Raspberry Pi is a wonderful device that lends itself to creating all sorts of projects in remote locations. Network connectivity is the way to make the Pi sing and with the addition of a cheap wireless adapter based on a RTL8188CUS chipset, you can shove the Pi into some very non traditional installations.  Unfortunately, the Pi does not include a realtime clock due to cost and complexity concerns so network connectivity is required to bootstrap the current time and date.  By default, Raspbian ships with a NTP (Network Time Protocol) dameon which will fetch and set the current time and date from the configured network time servers.  The challenge arises if you need to set the time while connected behind a very restrictive proxy that doesn't allow for anything other than HTTP (TCP 80).  Welcome htpdate to the rescue which will allow you to set the system time within a second or two based on the http response headers of ordinary websites.  Unfortunately, there is no ARM based debian package for htpdate currently so apt-get install htpdate will say package not found.  I will show you a good way to get htpdate up and running on a raspberry pi running raspbian by building your own debian package which makes for easy uninstalls.  I recommend SSHing into your Raspberry Pi to make this as easy as possible.

Building and Installing htpdate as a Package

After ensuring you have a network connection, install checkinstall

sudo apt-get install checkinstall

Create a directory to download htpdate

mkdir ~/download/htpdate && cd  ~/download/htpdate

Find the URL to the current version of htpdate-xxx.tar.gz here.  I am currently using htpdate-1.0.5.tar.gz for this example.

Now download the current version using the URL you discovered above and extract it (of course change the version number if you are not downloading 1.0.5)

wget http://www.vervest.org/htp/archive/c/htpdate-1.0.5.tar.gz && tar -xvfz htpdate-1.0.5.tar.gz

Lets change into the extracted directory and compile the project (takes about 15s on the Model B)

cd htpdate-1.0.5 && make

Now we are ready to build the debian ARM package.  (Running this as root is very important)

sudo checkinstall -D make install

Accept the default set of package docs when asked

Should I create a default set of package docs?  [y]: y

You will be asked to provide a short description; I chose HTTP Time Protocol. (Note you have to hit ENTER twice)

Please write a description for the package.
End your description with an empty line or EOF.
>> HTTP Time Protocol

You will be asked if you want to change any of the default package values.  I opted not to since I am not publishing this package so just hit ENTER to continue.

Congrats.  The package has been built and installed.  You could even copy the resulting .deb file to another Pi and install it, changing the dir to the dir of your copied deb file.

sudo dpkg -i /home/pi/download/htpdate/htpdate-1.0.5/htpdate_1.0.5-1_armhf.deb

Testing and Verification of htpdate

Now that we have a package and its installed, we can move on to testing that htpdate does what we need.
Lets ensure that htpdate can reach out and fetch the dates from some websites that are geographically close to you.  -d infers debug and -q says to merely query the sites, don't set the time.

sudo htpdate -d -q  www.google.com wwww.nist.gov www.uic.edu

You should see some output similar to the below

#: 3 mean: 0 average: 0.333 Timezone: GMT-6 (CST,CDT) Offset 0.333 seconds

Looks good.  Now lets commit and set the date and keep it up to date by running this as a dameon. -D runs htpdate as a dameon, -s will force change the clock on the first poll and then provide adjustments there after, and -l will log the status to the syslog (/var/log/syslog)

sudo htpdate -D -s -l www.google.com wwww.nist.gov www.uic.edu

Making htpdate Startup on Boot

So far we have downloaded the source code, compiled it, created a nice installable and removable debian package, and shown how to query and set the date using htpdate.  Unfortnately, if you reboot or have the pi off for long periods of time, your system time will quickly drift.  To fix that, we can start the htpdate in dameon mode on boot.  This section assumes you have familarity editing text files on linux and I will use nano for my examples but feel free to use your favorite text editor such as vim or emacs.

Lets become root

sudo -s

Enter into the init.d directory, and create a new startup script for htpdate, and make it executable

cd /etc/init.d/ && nano htpdate && chmod +x htpdate

Paste the below into your text editor (modify HTPHOSTS with a list of your own geographically close sites if you wish) and then save (CTRL + O) and exit (CTRL + X)


# Provides:        htpdate
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start htpdate in daemon mode

# RUNASUSER will generally be pi, unless you've created your specific user account
export RUNASUSER='pi'
# Space delimited list of sites to pull time info from without the http://
export HTPHOSTS='www.google.com wwww.nist.gov www.uic.edu'

case "$1" in
    # if it's start, then start htpdate
    su $USER -c "/usr/bin/htpdate -D -s -l -i /tmp/htpdate.pid -u nobody:nogroup $HTPHOSTS"
    echo "Started htpdate for $RUNASUSER using /usr/bin/htpdate -D -s -l -i /tmp/htpdate.pid -u nobody:nogroup $HTPHOSTS"
    # if it's stop, then just kill the process and delete the pid file
 pkill -F /tmp/htpdate.pid
 rm -rf /tmp/htpdate.pid
 #kill any rogue instances of htpdate 
 killall -q -w htpdate 
    echo "htpdate stopped"
    echo "Usage: /etc/init.d/htpdate {start|stop}"
    exit 1
exit 0

Make sure that you have no mistakes by stopping and starting htpdate

/etc/init.d/htpdate stop && /etc/init.d/htpdate start

You should see that the process started Started htpdate...

Now lets add it to the startup process

update-rc.d htpdate defaults

Congratulations!  You can now reboot and htpdate will automatically update the time even if you have a restrictive firewall and will only do so after the network connection has been established.

Sunday, February 03, 2013

Issues with VirtualBox on Ubuntu 12.10


Are you having issues starting virtual box after installing updates?  Annoying isn't it?  Errors like the following:
Kernel driver not installed (rc=-1908)The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing'/etc/init.d/vboxdrv setup'as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
Maybe you have an issue with the networking card when operating in bridged mode and get an error similar to the following (note might also say HostInterfaceNetworking-wlan0) :
Failed to open/create the internal network 'HostInterfaceNetworking-eth0' (VERR_PERMISSION_DENIED). Failed to attach the network LUN (VERR_PERMISSION_DENIED)


VirtualBox recommends you run sudo /etc/init.d/vboxdrv setup but unfortunately this is not available on most Ubuntu installations.  I would recommend running the following:
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get --reinstall install virtualbox virtualbox-dkms 
sudo modprobe vboxdrv
sudo modprobe vboxnetflt
sudo modprobe vboxnetadp

Good luck!

Saturday, January 12, 2013

How to set Full Pixel on a Sony KDL-55EX720

I recently got a Monoprice mini DisplayPort to HMDI w/Audio adapter for my Dell XPS 13 running Ubuntu 12.10 Quantal Quetzal.  I am happy to report that audio over HDMI works just fine out of the box with no software to install as long as the device receiving the signal supports audio over HDMI such as my Sony KDL-55EX720. Unfortunately, the picture was overscanned (cut off on the edges).

In order to fix this, you have to set your Display Area to full pixel.  Unfortunately I could not find out for the life of me how to get to this option on my TV.  Fortunately, I ended up stumbling onto it.

  1. Hit the HOME button on your Sony remote.
  2. Scroll to the input connection that your computer or other overscanned device is on (mine is HDMI 3).
  3. Hit the RIGHT arrow on the circle pad until you get to the options menu (i-Manual, Preferences, Sound, Picture and Display, etc)
  4. Select Picture & Display by hitting the Select button (center of circle pad)
  5. Scroll down to Screen and hit Select
  6. Scroll down to Auto Display Area and hit Select and turn that option Off.
  7. Scroll down to Display Area and set this to Full Pixel
  8. Hit RETURN until you exit the menu.  Your display should now full fill the screen.
If you have issues with getting the picture to show up at all, then open you Display control panel and click Detect Displays.