Saturday, October 15, 2011

Running GUI applications in PlanetLab

I had to run GUI applications from PlanetLab for a Project. X11 forwarding (necessary to run GUI applications over SSH connections) is not enabled on the PlanetLab machines due to security reasons. Another option was to install a VNC server on each of the nodes, which provides a GUI enabled remote access to these machines.

I had setup a vnc-server on the planet lab nodes using the instructions given in http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/.

Step-1:
First you need to setup vnc-server on the planetlab node.
sudo yum install vnc-server

You need to have a remote user account that you can use with VNC. Your planetlab account should suffice.

Step-2:
Next you need to configure the vncservers config file. In Fedora Core or Red Hat based distros in general, all we have to do is define the VNC server instances in /etc/sysconfig/vncservers. These will be started by the vncserver initscript. This has to be done as root. Edit this file so that it contains the following lines. Below planetlabaccount is your slice name that you use for logging into planetlab.
VNCSERVERS="3:planetlabaccount"
VNCSERVERARGS[3]="-geometry 1024x768 -depth 16"

With these we define that a vnc server instance should be started as user 'planetlabaccount' on display 3 and we also set some options for this server such as resolution and color depth. Each VNC server instance listens on port 5900 plus the display number on which the server runs. In our case, planetlabaccount’s vnc server would listen on port 5903.

For multiple vnc instances /etc/sysconfig/vncservers would look like this:
VNCSERVERS="1:tiger 2:albatros 3:leopard"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
VNCSERVERARGS[2]="-geometry 800x600 -depth 8"
VNCSERVERARGS[3]="-geometry 1024x768 -depth 16"
These would listen on ports 5901, 5902, 5903 respectively.

Step-3:
You need to setup planetlabaccount’s vnc password. So, as user planetlabaccount give the command:
vncpasswd

We are prompted for a password. This is the password that we will use when we connect to planetlabaccount’s vnc server instance. This password is saved in /home/<planetlabaccount>/.vnc/passwd.

Step-4:
After the initial configuration is done we restart the vnc service. As root:
sudo /etc/init.d/vncserver restart

You can make VNC server to start on boot. The command looks like (I haven't tested it out):
chkconfig vncserver on

Step-5:
When vncserver is restarting you will see a message like
New '<planetlabmachine>:3 (planetlabaccount)' desktop is <planetlabmachine>:3
Here "planetlabmachine" is your planetlab node name, eg: "planetlab1.poly.edu"

You need to check if the DISPLAY environment variable is set using the command:
echo $DISPLAY

If you see a blank like, try setting it with the desktop name seen above "<planetlabmachine>:3"
export DISPLAY=<planetlabmachine>:3

Now any GUI applications like xterm or Firefox you run from the terminal will be active in your vncserver's desktop.

Step-6:
Now install a vncviewer like xvnc4viewer or xtightvncviewer on your local machine. If using windows, use realvnc's vnc viewer. Once you login to the planetlab's vnc server, you should be able to see all your GUI applications (like xclock and Firefox) running. Though the display is not so colorful and not so fast, it might serve the purpose.

Step-7 (OPTIONAL):
If working with Firefox, remember to install x11 fonts for Firefox to work. The command you need to give is:
sudo yum install xorg-x11-fonts-Type1
With regular VNC, you wont be able to move or resize the windows as there is no window manager running. You need to run "Metacity" a GNOME window manager. Run the command from the terminal:
metacity &

Reference:
1. http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/.
2. http://forums.fedoraforum.org/showthread.php?t=201885

How to start Dell Webcam after it stopped working

I have a Dell Inspiron 1440, bought two years back in 2009. Yesterday, my inbuilt webcam was not getting recognized by any application. When I launched Dell Webcam Central it showed a message "Please Plugin a Supported Device". I looked up Dell forums and people suggested to update the Webcam Driver or re-install the Webcam central application.

Re-installing the Webcam central software did not help. I tried looking up for drivers on http://support.dell.com/ website, but the website was down for some reason. Another way to update the driver was to launch Device Manager and look for webcam listing and update driver from there. However, I could not find the "Imaging Device" listing in the Device Manager (Right click computer -> Manage -> Device Manager). After digging through Dell Forums I landed on this page (http://en.community.dell.com/support-forums/laptop/f/3518/p/19271842/19476201.aspx). One of the last comments suggested to boot in safe mode (pressing F8 before windows OS starts loading once you boot) and look for Imaging Device listing in the Device Manager. I was able to find it in Safe Mode and tried updating the driver. I already had the latest driver. So, I just disabled and enabled the device and rebooted the machine. Now the webcam works fine and I am able to find it listed in Device Manager.