Tuesday, January 29, 2008

Getting SubVersion up and running on the DNS-323

I was expecting a smooth ride in getting SubVersion up and running on my DNS-323 given that there are precompiled binaries for the box as well as a dedicated HOWTO page on the wiki. So I managed to work though all the steps (including setting up authentication) and got svnserve running in less than 30 mins. I could even browse my (empty) repository anonymously from a Windows XP machine using tortoiseSVN.

However, when I tried to do a test import, I got stuck at the authentication stage with the client returning an error message "Internet server error in authentication". Strange since I'm using the same setup as the wiki. Dug a little deeper via Google and found this.

Apparently, my box is missing the pseudo random number generator /dev/random. Still figuring out why this is so but the quick work around is to (1) roll your own using the command "mknod /dev/random c 1 8" or (2) do a symlink to /dev/urandom (which is another random number generator but a little less secure. For details, look here). I prefer (2) as we won't get into the situation of running out of entropy in our little embedded headless environment in exchange for that little bit of extra security (this is just a home NAS for goodness sake!).

To survive reset on the box, I've modified the svnserve.sh to include a check for the file and do the symlink if not found. For the benefit of others, the relevant code is as below:


svnserve_start() {
if [ -x "${BINDIR}/svnserve" ]; then
echo "Starting svnserve deamon... "
${BINDIR}/svnserve -d -r ${REPOSITORY}
if [ ! -e "/dev/random" ]; then
echo "/dev/random not found, creating symlink to /dev/urandom..."
ln -s /dev/urandom /dev/random
fi
else
echo "ERROR: svnserve not found or not executable"
fi
}

1 comment:

Jeff said...

Thanks for posting that :)

I've been having the same problem trying to authenticate! Wonder why its not on the wiki...