Saturday, June 25, 2011

Running Crashplan on the Excito B3 server

I was lucky enough to actually WIN an Excito B3 server a few months ago. *big smile* I'm using the little box for all kind of things like SVN server, SSH and VPN tunneling, personal cloud, wiki, etc...

Some time ago I also got a subscription to Crashplan+, so I could backup the familiy pictures to the Crashplan Central servers. Up until now, I always ran their backup software from my main desktop. So the desktop was on many nights in order to backup the 50+ GB pictures to the Crashplan servers over my slow internet connection. I didn't want to do it during the day while I was working on the desktop, to not saturate the bandwidth.

I wasn't happy with this situation. So in order to automate the backups completely I decided to try to run the Crashplan software directly from the B3 server. Because it is always on anyway and idle 99.5% of the time.

I encountered a few problems along the way. I will explain my working solution.

First of al, the B3 server is headless, it has no screen attached. If you get the box from Excito and plug it into your network, all configuration is to be done through a webinterface.

So first thing, I enabled SSH login for my the user, using the B3 webinterface.

Second, the Crashplan software is Java based, so we need a Java Virtual machine on the B3 in order to get it running. Just change to root privileges on the B3 (the B3 runs Debian) and install the following packages:

su #use root password of your B3
apt-get install openjdk-6-jdk
apt-get install libjna-java

Next, reading up on the headless installation howto on the crashplan support page, it looked easy enough. I got the installation files for Linux, unpacked it on the B3, changed to root privileges and started the installer.

wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.0.3_Linux.tgz
tar zxvf CrashPlan_3.0.3_Linux.tgz
cd CrashPlan-install
su #use root password of your B3
./install.sh

Now, the Crashplan software consists of 2 parts, the engine, and the client. The idea is that you run the engine headless on the B3, and connect to the engine using the client on a computer with an attached screen / GUI. In order to connect to that engine from your computer, you need to trick the client into thinking it connects to a local port. That local connection will be forwarded to a port on the B3 server over an SSH tunnel.

You can read all about setting it up on the Crashplan support site.

Right, time to start the backups... I had hoped. But I was wrong. When connecting from the computer to the B3 with the Crashplan client, I kept giving me "connection failed" messages.

/usr/local/crashplan/bin# channel 3: open failed: connect failed: Connection refused

I went over to the B3 to see what ports were listening for connections. But the 4243, the default Crashplan engine port to connect to from the client, was not in the list.

netstat -an | grep LISTEN

I read the Crashplan logs and encountered an issue... The libjtux.so (http://basepath.com/aup/jtux/) package driver that is included with the Crashplan installer was compiled for a 32 bit Intel system, but that won't run on the ARM cpu that is in the B3 server.

The location of the Crashplan logfile in my case is /usr/local/crashplan/log/engine_error.log
It contained the message:

java.lang.UnsatisfiedLinkError: /usr/local/crashplan/libjtux.so: /usr/local/crashplan/libjtux.so: cannot open shared obj
ect file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)



Next on the list was to recompile libjtux.so for the ARM platform and replace the one from Crashplan with our own ARM compiled version. The source for jtux I got from this location: The jtux.tar.gz

If you extract it, you will see there is no "makefile" present. You will need to patch the source code with a file you can get from here: jtux.PS3-YDL6.1.patch.txt

First you install the tools you need to compile and patch the jtux on your B3 server.

su #use root password of your B3
apt-get install gcc
apt-get install patch

In order to compile the code, extract the downloaded file and apply the patch. This will fix a few bugs and the makefile will be present so you can compile the code.

tar zxvf jtux.tar.gz
cd #to your extracted directory
patch <jtux.PS3-YDL6.1.patch.txt

Now edit the makefile and modify first line to the java include files to point to: /usr/lib/jvm/java-1.6.0-openjdk/include

Compile it by running "make" and you should have a libjtux.so that should work.

make

Backup and replace the libjtux.so from your original crashplan installation folder with the one you just compiled.

mv /usr/local/crashplan/libjtux.so /usr/local/crashplan/libjtux.so_original
cp libjtux.so /usr/local/crashplan/libjtux.so

At this point the crashplan engine will start but wont be able to backup anything due to jna errors that will show up in one of the logfiles.

To fix this, just edit /usr/local/crashplan/bin/CrashPlanEngine and find the line that begins with FULL_CP=

Just add "/usr/share/java/jna.jar:" (without ") to the begining of the line after the "=".

When this is done crashplan engine should startup fine. It almost took 4 minutes to get the engine started on my B3. During that time the cpu was constantly running at 100%.


Startup crashplan with one of the following commands with root privileges:

/etc/init.d/crashplan start
/etc/init.d/crashplan restart
/usr/local/crashplan/bin/CrashPlanEngine start

It's running fine now for me. I got it working thanks to this forum post.

If things are not working out... I have all the files mentioned in this post in source and compiled versions, backed up at Crashplan ;-). I'll be happy to send them to you or help you out.


EDIT: Somebody asked me about the ARM compiled version of the /usr/local/crashplan/libjtux.so file. Here it is.

2 comments:

Bostjan said...

Hi Jo,

I would like to get already compiled libjtux.so (I have a B3 myself). How can I get in touch with you?

Unknown said...

Crashplan/Code42 seems to have changed their site and the "patch" file you reference is no longer there. I'll ask the Crashplan folks about this, but is there any chance you'd be willing to either post your copy of the file, or post its contents if they are readable?

Thanks!