CrashPlan Headless Client

From SynologyWiki
Jump to: navigation, search

Contents

Introduction

CrashPlan is a backup software which allows storing backups locally as well as on remote computers. Additionally, a paid service is offered to store backups online. This article explains how to install the CrashPlan Headless Client on a Synology DiskStation.

Compared to other online backup services like Backblaze, Carbonite or Mozy (just to name a few), CrashPlan offers two features the others do not:

  • Windows, Mac OS X, Linux and Solaris support
  • Backups can be stored online as a paid service as well as on your own storage but also on computers of your friends.

The support of Linux makes it possible to install the CrashPlan Headless Client on a Synology DiskStation.

The instructions given here were tested with a Synology DiskStation DS411+II (DSM 3.2-1922, 4.0-2198, 4.1-2647). But on other DiskStations with x86-compatible processor (e.g. Intel Atom) it should work as well. According to its specifications CrashPlan's minimum requirement is 1 GB main memory.

CrashPlan will not work on ARM-based devices following these instructions alone.

You may want to check out the PC Load Letter CrashPlan packages for easy installation via the DSM Package Center.

Preconditions

Precondition for installing CrashPlan is that IPKG has been installed according to Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc#Installing_compiled.2Fbinary_programs_using_ipkg.

Installation of the CrashPlan Headless Client

Preparation

1. Login to the DiskStation as user root using ssh. It is assumed that the DiskStation is named disksstation.

user@linux:~$ ssh root@diskstation

2. The CrashPlan installation script requires commands from the IPKG pakets bash, coreutils and cpio. Thus these pakets have to be installed using ipkg install.

DiskStation> ipkg update
DiskStation> ipkg install bash
DiskStation> ipkg install coreutils
DiskStation> ipkg install cpio

3. The editor nano will be used in the following steps. Also nano can be installed using ipkg.

DiskStation> ipkg install nano

Installation

1. Download CrashPlan. If a new version has been released in the meantime you can download it from the CrashPlan download page.

DiskStation> cd /volume1/@tmp
DiskStation> wget http://download.crashplan.com/installs/linux/install/CrashPlan/CrashPlan_3.4.1_Linux.tgz

2. Extract CrashPlan.

DiskStation> tar -xvf CrashPlan_3.4.1_Linux.tgz

3. The path to bash has to be adjusted in the installation script. In the first line replace #!/bin/bash by #!/opt/bin/bash.

DiskStation> cd CrashPlan-install
DiskStation> nano -w install.sh

4. Start the installation script.

DiskStation> ./install.sh 

5. During installation the script will ask a few questions. The first question is whether the JRE (Java Runtime Environment) shall be downloaded and installed. The request should be acknowledged by entering y.

No Java VM could be found in your path
Would you like to download the JRE and dedicate it to CrashPlan? (y/n) [y] y
  jre will be downloaded

6. In the next step the installation asks if you agree with the EULA (end user license agreement). Acknowledge by entering y if you want to proceed.

You must review and agree to the EULA before installation.

Press enter to read the EULA.

Do you accept and agree to be bound by the EULA? (yes/no) yes

7. Then, a few installation paths can be adjusted. These are the recommended paths for an installation on a Synology DiskStation. The backups are kept separate from the installation directory.

What directory do you wish to install CrashPlan to? [/usr/local/crashplan] /opt/crashplan
/opt/crashplan does not exist.  Create /opt/crashplan? (y/n) [y] y

What directory do you wish to link the CrashPlan executable to? [/usr/local/bin] /opt/bin

What directory do you wish to store backups in? [/opt/crashplan/manifest] /volume1/CrashPlan/backupArchives
/volume1/CrashPlan/backupArchives does not exist.  Create /volume1/CrashPlan/backupArchives? (y/n) [y] y

What directory contains your SYSV init scripts? [/etc/init.d] 

What directory contains your runlevel init links? [/etc/rc.d] /usr/syno/etc/rc.d

8. Finally, the installation script shows the selected paths and asks for affirmation. When everything is correct acknowledge by entering y.

9. Now the installation script downloads and installs Java and copies CrashPlan's files. The error message

./install.sh: /opt/crashplan/bin/CrashPlanEngine: /bin/bash: bad interpreter: No such file or directory

is anticipated. The script CrashPlanEngine has to be adjusted to the ipkg environment.

10. When you see the following line the script is finished.

Installation is complete. Thank you for installing CrashPlan for Linux.

11. Now /opt/crashplan/bin/CrashPlanEngine has to be adjusted to the ipkg environment.

a) Replace #!/bin/bash in the first line with #!/opt/bin/bash.
DiskStation> nano -w /opt/crashplan/bin/CrashPlanEngine
b) nice has to be called with its complete path /opt/bin/nice.
DiskStation> sed -i "s/nice -n/\/opt\/bin\/nice -n/" /opt/crashplan/bin/CrashPlanEngine
c) ps' arguments have to be replaced.
DiskStation> sed -i "s/ps -eo 'pid,cmd'/ps w/" /opt/crashplan/bin/CrashPlanEngine

12. The startup script has to be renamed. Otherwise CrashPlan would not start when the DiskStation boots.

DiskStation> mv /usr/syno/etc/rc.d/S99crashplan /usr/syno/etc/rc.d/S99crashplan.sh

Operation Test

1. You can now start the CrashPlan Headless Client manually.

DiskStation> /etc/init.d/crashplan start

2. If you pass the argument status to the script it checks whether CrashPlan is running or not.

DiskStation> /etc/init.d/crashplan status

3. To check whether CrashPlan connected to its assigned TCP Ports use netstat.

DiskStation> netstat -an | grep ':424.'
tcp        0      0 0.0.0.0:4242            0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.1:4243          0.0.0.0:*               LISTEN

4. You can now restart the DiskStation. During reboot CrashPlan should be started automatically. You can check this by repeating steps 2 and 3.

DiskStation> reboot

Configuration

A DiskStation is usually not connected to a monitor. Therefore, the configuration of CrashPlan is done remotely from a computer on which CrashPlan is already installed. Instructions how to do this can be found on the CrashPlan support page Connect to a Headless CrashPlan Desktop.

Instructions how to remotely administrate CrashPlan with the help of a script can be found in a post of the LinuxHints Blog.

Making CrashPlan work with non US-ASCII characters

Although Synology uses the UTF-8 character encoding for the file system their Linux does not have internationalization support built in. Because of that the JavaVM running CrashPlan is not able to handle non US-ASCII characters. As a result CrashPlan will not be able to back up files and directories with non US-ASCII characters in their names.

The solution for this disaster is to add the missing localization support to the DiskStation's Linux. Luckily Synology provides all the needed files with the Synology NAS GPL Source package.

The following describes the steps necessary to add UTF-8 support to your DiskStation. Remember that these steps have to bee repeated after every DSM update.

1. Go to http://sourceforge.net/projects/dsgpl/files/ and select the tool chain matching your DSM version. For example, choose "DSM 4.1 Tool Chains" when you are running DSM 4.1.

2. Next you need to know the processor of your DiskStation. You can find out by using the following command line:

DiskStation> cat /proc/cpuinfo | grep model
Intel(R) Atom(TM) CPU K525 Intelx86 Pineview

3. After selecting the matching processor you need to know whether your Linux is 64 bit or 32 bit.

DiskStation> uname -m

If the command above returned x86_64 your Linux is 64 bit. Else it is 32 bit.

4. Now download the matching archive to the /volume1/@tmp folder. The following will assume a DS411+II with DSM 4.1. You need to adjust the URL and paths accordingly if this does not match your setup.

DiskStation> cd /volume1/@tmp
DiskStation> wget http://downloads.sourceforge.net/project/dsgpl/DSM%204.1%20Tool%20Chains/Intel%20x86%20Linux%203.2.11%20%28Pineview%29/gcc420_glibc236_x64-GPL.tgz

5. Extract the archive and cd into it.

DiskStation> tar -xzvf gcc420_glibc236_x64-GPL.tgz
DiskStation> cd x86_64-linux-gnu/x86_64-linux-gnu

6. Copy the missing locale and localedef programs as well as the localization info.

DiskStation> cp sys-root/usr/bin/locale /opt/bin 
DiskStation> cp sys-root/usr/bin/localedef /opt/bin 
DiskStation> cp -r sys-root/usr/share/i18n /usr/share

7. Now the en_US.UTF-8 locale can be created.

DiskStation> mkdir /usr/lib/locale
DiskStation> localedef -f UTF-8 -i en_US en_US.UTF-8

8. Verify that everything worked out as planned. The following command should return a list of locales including en_US.utf8.

DiskStation> locale -a
C
POSIX
en_US.utf8

9. Add the following lines to /etc/profile and /opt/etc/profile to force all applications (which support it) to use UTF-8 encoding and en_US local settings. This includes the JavaVM and thus CrashPlan.

LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
export LANG LC_ALL

10. Restart the Diskstation to activate the changed settings.

DiskStation> reboot

11. After the DiskStation started again check whether the settings became active.

DiskStation> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

12. Finally, in CrashPlan all directories with special characters need to be deselected, the settings saved and then directories can be added again. Now the backup should work correctly.

Known Issues (YOUR HELP NEEDED)

This section describes problems for which no solutions is known yet. Can you help resolving these issues?

Real-Time Backup

Currently CrashPlan is not notified when a file is changed. So real-time backup is not working. As a workaround the time after which the selection is verified can be lowered.

CrashPlan relies on inotify for file change notification. Although inotify is available on the DiskStation it still does not work. All the checks proposed on Troubleshoot Real-Time Backup page seem not to give a clue.

The problem is most likely not linked to the problems CrashPlan 3.0.3 has with Linux 3.0. DSM 3.2-1922 and 4.0-2198 runs on Linux 2.6.32.12. See the Unable to back up on demand - arrow greyed out? discussion.

Resolved Issues

All issues described here were once a problem but have been resolved with the help of the community.

CrashPlan does not backup non US-ASCII files and directories

This has been solved by installing the missing internationalization support. Remember that this has to be redone after every DSM update.

CrashPlan does not start any more after updating DSM

It has been reported that CrashPlan does not start any more after updating DSM. This can be resolved by recreating the missing symbolic link.

DiskStation> ln -s /etc/init.d/crashplan /usr/syno/etc/rc.d/S99crashplan.sh 

CrashPlan silently crashes, and restarts (sometimes repeatedly) or stops after working for awhile

If there are large or many files in the backup set, it is possible that the Java VM runs out of memory and crashes. This would be evident if a GUI is connected as it will complain about loss of connection. It may be possible to find "Caused by: java.lang.OutOfMemoryError: Java heap space" in /opt/crashplan/log as well.

This situation can be resolved by increasing the maximum heap size for the virtual machine, if the device has enough RAM to support it. The -Xmx switch determines the maximum size, while -Xms is the initial (minimum) size. Note that the maximum size CAN be set larger than installed RAM, which may be necessary in certain cases. Although this may cause swapping, it will only occur if necessary, and the performance loss may not be noticeable depending on workload.

Suggested values for devices with 1GB RAM and 2GB swap, not running any other memory intensive applications: modify the first line in /opt/crashplan/bin/run.conf

from:

SRV_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanService -DappBaseName=CrashPlan -Xms20m -Xmx512m ... 

to:

SRV_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanService -DappBaseName=CrashPlan -Xms128m -Xmx1536m ...

(These lines are very long. Everything after the heap sizes represented by the ellipses should remain the same)

Experimentation may be necessary to find optimal -Xmx parameter that is large enough to not result in crashing, but is small enough to not impact performance.

CrashPlan stopped working after an automatic update

The reason that an existing installation of CrashPlan stopped working after a new release of CrashPlan is that the update scripts are not compatible with the DiskStation. Instead of fixing the update scripts simply reinstall CrashPlan.

To reinstall CrashPlan do the following. First, stop CrashPlan and move the installation directory to a save place.

DiskStation> /etc/init.d/crashplan stop
DiskStation> mv /opt/crashplan /opt/crashplan.old

Then follow the installation instructions above but do not start CrashPlan yet. Do not forget to follow the instructions to make CrashPlan work with non US-ASCII characters, too.

If you had backups in /opt/crashplan/manifest make sure to move them back before starting CrashPlan. Move /opt/crashplan.old/manifest to /opt/crashplan/manifest or to your new backup directory, e.g. /volume1/CrashPlan/backupArchives. You can start CrashPlan now.

Once CrashPlan is started you should connect to the headless client and log in using your credentials. CrashPlan will then start synchronizing file information which is rather quick. After that it will synchronize block information which will take a longer time.

You should only delete /opt/crashplan.old once you are sure that everything works like before.

IPKG commands are not found any more after DSM upgrade

After upgrading DSM it happens very often that commands from already installed packges (ipkg, bash, nano) are not found any more when trying to start them from the command line. Instead of simply reinstalling IPKG redo the modifications to /root/.profile mentioned in the installation instructions (Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc#Installing_compiled.2Fbinary_programs_using_ipkg).

Please note that the steps to install the missing internationalization support most likely need to be redone, too.

References

CrashPlan Headless Client (German)
Kenneth Larsens blog: HOW-TO: Using crashplan with ATOM-based Synology NAS
IWarez on Subsonic Forum about installing internationalization support on a DS710
Synology Online Community Forum: Crashplan backup sw allows backing up to a friend's computer
CrashPlan Support: Connect to a Headless CrashPlan Desktop
LinuxHints Blog: Crashplan headless
Forrst: Remote Access for CrashPlan (headless server) with Desktop UI
PC Load Letter's Synology Packages for CrashPlan

Personal tools
Community Resources