Wednesday, December 30, 2009

fence_vmware and the root user

When using the fence_vmware agent to manage a VMware guest via VMWare ESX, be aware that the root user cannot be used for the ssh session to the ESX node (the '-l' argument for fence_vmware). A separate user should be created on the ESX node for the purpose of allowing ssh access for the fence_vmware agent. (Note though that it is safe to use the root user for within the VMware Service console -- the '-L' argument for fence_vmware).

Though may possible to manually launch an ssh session to the ESX node from the command-line, the fence_vmware agent isn't able to do so due to programmatic restriction in the fencing framework. (The reason is that the fencing framework expects a particular format for the shell prompt following login, which the root user's shell does not use.)

One may argue that remotely logging in as the root user is not a good idea to begin with; as such the fencing framework may have been intentionally designed with this restriction in mind. However there may be cases where practicality prevails, such as when setting up a closed test environment.

I did not find this restriction documented anywhere, and only discovered it after debugging the python scripts contained in the fencing framework. It is briefly mentioned here that "ssh is not allowed for user root"; however this is misleading in that it does not explain that the limitation is within the fencing framework and not with ssh itself. (Those of you familiar with ssh server administration may be aware that there is an item in the ssh config file to allow/deny remote access to the root user.)

While on the subject, kudos to the people behind this VMWare fencing documentation. Though I make a small clarification to their work in the previous paragraph, this guide is quite helpful in explaining the methods by which to fence a VMware guest.

Friday, March 6, 2009

OSX Terminal colors

The OSX Terminal application can support font/highlighting colors when connecting to a remote system that supports this. However depending on your choice of Terminal's background color some of the colors can be difficult to read.

For example, I tend to prefer Terminal's "Pro" color scheme, where the background is black. But when I log into a linux box, some of the text colors are difficult to read against the black background.

I looked for a way to adjust the font colors used, but found a much simpler way to adjust this. Turns out there is an option in Terminal's Preferences titled "Use bright colors for bold text". This option can be found under Terminal -> Preferences -> Settings -> Text.

Enabling this option has yielded the text much easier to read.

Thursday, March 5, 2009

Real-time Navigation on OSX using Motorola i335 Cell Phone

This post explains real-time navigation using the GPS from a Motorola i335 cell phone with Google Earth a Mac OSX laptop. (Note: for the best experience, be sure to read up on using Google Earth in offline mode.)

There are some problems when allowing Google Earth to auto-detect the GPS for tracking. Basically Google Earth auto-probes the serial devices which it thinks might be a GPS; this is problematic in that it can sometimes select the wrong device. For example, in this case Google Earth is auto-selecting the BlueTooth dial-up adapter of my phone instead of using the USB serial connection. Since I have not found a way to force Google Earth to use a specific device, I came up with another method of getting the real-time GPS information into Google Earth.

IMPORTANT: Whatever you do, DON'T use the Google Earth GPS stuff (Tools->GPS); if you've already tried it, reboot your Mac before you proceed with this guide. As I mentioned above, Google Earth trips-up when trying to auto-detect the GPS, and creates a bunch of gpsbabel processes that cannot be killed and which conflict with the steps I provide below.

Connect Motorola i335 phone via usb cable.

Look for the device on the OSX the filesystem:
ls /dev/tty.*

Mine shows up as /dev/tty.usbmodem3d11
(Yes, this is the same serial interface as for the modem. I don't yet know if they are mutually exclusive, meaning either GPS or modem.)

On Moto phone, navigate to the GPS menu. Select Interface. Select NMEA Out, and set to ON. (Important: be sure to set NMEA Out back to 'Off' when you are done; else this will continue to run and considerably impact the phone's battery charge after unplugging the USB cable.)

After switching NMEA Out to "On", you should see a new icon on the phone that represents the GPS running. If you don't see the icon, something might not be functioning properly (see my troubleshooting section below).

Launch GPS babel; Google Earth already includes a version of it, so we'll use it rather than downloading another copy.

In a Terminal window enter:

cd /Applications/Google\
./gpsbabel -T -i nmea -f /dev/tty.usbmodem3d11 -o kml,points=0,line_color=640000ff,max_position_points=10 -F /tmp/nmea.kml

This continuously reads the real-time NMEA coordinates from the Motorola i335 and writes them to a file in the KML format that Google Earth uses.

Now launch Google Earth. We'll need to create a Network Link by which to get Google Earth to read the coordinates that the i335/gpsbabel are putting out.

From the menu bar, Click Add -> Network Link.
In the Name field, enter Motorola i335 GPS
In the Link field, enter /tmp/nmea.kml
Click on the Refresh tab. Change Time-Based Refresh from Once to Periodically. Check Fly to View on Refresh
Click OK.

Now on the left-hand side of the Google Earth in the Places window you should see a folder titled "Motorola i335 GPS", and under that folder you'll see either "ESTIMATED Position" or "Position", depending on whether or not the GPS has locked onto your coordinates. Make sure that the "Motorola i335 GPS" and "Position" folders have check marks in their boxes; this is needed in order for Google Earth to use the GPS data.

Once the coordinates are found, Google Earth should pan and zoom to your location.

If you've made it this far, congratulations and have fun. I encourage you to read up on using Google Earth in offline mode for the best experience with this setup.


  • Motorola phone not putting out coordinates (is USB connected? NMEA out enabled? Can phone acquire GPS information?)
  • GPSbabel not properly reading from Motorola GPS (are command line options correct?)
  • GPSbabel not properly writing kml (are command line options correct?)
  • Google Earth is not reading the proper kml file (are the file paths correct?)

If you don't see the GPS icon on the phone after enabling NMEA Out, you might want to disconnect the phone and power cycle it, as well as rebooting the Mac and starting this guide again from the beginning.

Don't know if this is possible yet with BlueTooth; there is a serial device that appears under the BT profile, though I haven't spent the time to see if it can output the GPS NMEA information. An additional reason for using the USB cord is that the NMEA out will eat up the battery much faster than when set to off, and when using the USB cord you're effectively using USB power instead of the phone's battery.

DISCLAIMER: Be smart when using this while operating a vehicle. Don't be distracted; if you need to reference the map or use the computer in any way, pull over or have a passenger do it. I'm not responsible for any mishaps.

Cites: Thanks to these guys for the ideas behind this solution, who did something similar on Linux.