Friday, December 16, 2005

X11 over SSH to a Mac

Every once in a while I use SSH to connect to a Linux box from my Mac Mini. When running X11 apps over this connection I would experience weird crashes, especially with GTK apps. Some apps would crash randomly, others would crash immediately when the window came up. For GVim, this is a showstopper.

Frustrated by always seeing errors like this:

The program 'gvim' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAtom (invalid Atom parameter)'.
(Details: serial 148 error_code 5 request_code 20 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

I decided to consult the oracle of Google. Turns out this is a know issue, and has something to do with the default settings for SSH in Tiger. Mac OSX Hints has an article on the issue.

Summary of the fix: Don't use "ssh -X" to connect to the remote box; use "ssh -Y".

Tuesday, November 22, 2005

The New Outsourcing

Primate Programming Inc.

Where's Charlton Heston when you need him?

Sunday, November 20, 2005

RSS Feeds for Castanet

Last week Castanet added RSS feeds to their news site. I really like that they've done this with separate feeds for each news category -- I'm now subscribed to their Kelowna news and Okanagan Valley news via Bloglines. Even their "Dear Cop" section and the always entertaining letters to the editor have feeds.

The only down side? Even more things for a news junkie like myself to read!

Wednesday, November 16, 2005

Google Sightseeing: Berlin

I totally forgot I submitted a Google Maps link to the Brandenburg Gate in Berlin to Google Sightseeing, so I was pretty surprised to see my name (along with several others) under it when it was posted today. Right now they're running quite a bit of scenery from Europe. This is pretty hard to do since there are no street names to go by. Very cool. Should've included a link to this blog.

I'm still waiting for google to add more high-resolution imagery for the entire Okanagan here in BC...

For now, here's where my uncle lives in Berlin. It's the triangular building in the middle of the map.

Monday, November 14, 2005

Alberta's Centennial Quarter

I found one of these in my change today:

More info from the Alberta Centennial Site.

Reminded me of a sticker I saw stuck to a cash register many years ago: "Alberta currency accepted at face value".

First Frost

Bit of frost on the car this morning. This is the first time it's happened this year. No scraping needed though; I slept in late enough that it had melted everywhere except for a bit on the rear window.

Wednesday, November 09, 2005

A tale of two webcams

Two webcams: one with better resolution, the other with better weather:

Yesterday I watched a beautiful sunset on the Vernon webcam. The view out the office window (and the Burrard webcam) only gave me a gray, dreary afternoon and evening. I think it's time to head back up to the Okanagan.

Thursday, November 03, 2005

Subversion and SSH

A while back, I set up a Subversion repository on my home Linux server to keep a handle on all of my projects. Since this machine was really also my main desktop (and MythTV box), there were really no issues that couldn't be handled from the commandline.

A while later, I expanded my computer collection and wanted to try to get at the SVN repository from there as well. Also, I had accumulated several scripts at home that I wanted *easy* access to from work. Pairing SSH with SVN makes all of this as easy as accessing the SVN repository from the local server.

First order: get SSH working using public key authentication. There are lots of tutorials on the web for this, but the following worked for me:

  1. On the server, generate your keys: "ssh-keygen -t dsa -b 1024". See ssh-keygen manpage for details on this command. Basically, this creates a 1024 bit DSA key pair for you. Don't forget to enter a good passphrase for the key!
  2. Make sure that your private key (~/.ssh/id_dsa) and the .ssh directory are only readable by you -- The directory should be "chmod 700" and the file "chmod "600". Many ssh servers will not allow key-based authentication if this is not the case!
  3. Copy the public part of the key (~/.ssh/ to each client. Append it to the file "~/.ssh/authorized_keys2"
SSH should now be working using the keys. When you ssh from one of the clients to your server you should be prompted for your key passphrase, but NOT your server password. Once you enter it, you should be in.

Now, entering a passphrase every time you want to use SSH sucks, doubly so when using Subversion as you will be prompted for it several times for each transaction. Not fun. To get around this, you can run an ssh-agent locally that will hang onto your decrypted key for you. All you need to do is enter the passphrase *once* using the "ssh-add" command and all logons to the server won't prompt you. This works, but you need to have the agent running, and there should be environment variables set pointing to it. If you start the agent in one xterm and want to use it in another, well, this also gets tricky. Fortunately, Keychain can handle all of this for you. It's a simple shell script that handles the agent for you. All I did was add a line to start it to my .bashrc and another line to source the environment variables it sets:

 # Start keychain for ssh-agent

 [[ -f $HOME/.keychain/$HOSTNAME-sh ]] &&     
    source $HOME/.keychain/$HOSTNAME-sh
Now, all I need to do is enter my ssh passphrase once after logging on using ssh-add, and everything works smoothly from there.

On to Subversion! When I initially created my Subversion repositories, I put them on the server at /subversion. With SSH from each client working, accessing this was disappointingly simple. On the client:

svn co svn+ssh://username@my_svn_server/subversion/project1
Compare this to what I would do on the local server:
svn co file:///subversion/project1
It's a bit more typing, but this is really only needed once when checking out the code. After that, svn commands such as "svn stat" work as they always do.

The only thing to watch out for is if the Subversion repository is going to be shared by several people. Because of how the svn client runs the Subversion server on the remote end, it will be running as the user. This can mess up filesystem permissions in the repository if things aren't set up correctly. There's a whole section on this in the Subversion book, and this applies to local SVN access just the same as it does to SSH access.

One final thing -- since Mac OS X doesn't come with Subversion preinstalled, I needed to grab some binaries for this. The Subversion Page lists both Fink packages and prebuilt binaries (from Being lazy, I grabbed the prebuilt binaries and haven't had a problem with them.