[How-To] CrashPlan PROe / Code42 Edge 4.1.6.3 on FreeNAS 9.3 in a Jail

Is CrashPlan PROe on FreeNAS useful for you in a commercial setting?

  • I am not sure I need to backup to the FreeNAS server.

    Votes: 0 0.0%
  • This is of no use at all.

    Votes: 0 0.0%

  • Total voters
    7
Status
Not open for further replies.

SkitzoTek

Cadet
Joined
May 18, 2015
Messages
4
I was excited to see there was a plug-in for CrashPlan on FreeNAS. However after reading the license agreement closely and assessing our requirements, I realised that it would be unsuitable for use in a corporate environment. Still needing an onsite backup solution, finding CrashPlan PROe is about half the price if self-hosted and not wanting to deploy yet another computer I tried to get Code42 Edge 4.1.6.3 to work in a FreeNAS jail using the Linux Compatibility Environment.

This is mostly just a rehash for CrashPlan PROe from:

https://forums.freenas.org/index.php?threads/how-to-crashplan-in-freenas-9-1-jail-tested-on-32bit.14099/

Any mistakes are definitely mine as I have absolutely no idea about FreeBSD, jails, java or sed, so YMMV.

Initial Setup

Make sure that you have FreeNAS running with a Storage Volume already configured for jails. We will assume that you have /mnt/Data/jails set up for jails, so adjust any paths as required.


Create a Jail
WebGUI - Jails - Add Jail.
Click Advanced Mode
Jail Name: Code42Edge
IPv4 ...: <Fill in appropriate IP address info>
Autostart: Ticked
VIMAGE: Ticked
NAT: Unticked

Note: FreeNAS creates a new dataset: Data/jails/Code42Edge that you can snapshot at any time through the process below to undo any mistakes.

Note: Don’t install FreeBSD bash into the jail unless you change the procedure below as we are instead going to use the Linux one to make things simpler.


Ensure linux.ko module loaded on boot for Linux compatibility in jail (below):

WebGUI - System - Tunables - Add Tunable
Variable: linux_enable
Value: YES
Type: rc.conf
Comment: Load Linux compatibility module
Enabled: Ticked


Load linux.ko module now without rebooting (get Linux compatibility now): (in FreeNAS)
kldload linux


Check if linux.ko is loaded: (also check after a restart for tunable working if desired)
kldstat | grep linux
(Should return line with Name: linux.ko)


Log into your jail:
WebGUI - Jails - Code42Edge - Shell, OR
Putty into FreeNAS:
jexec Code42Edge /bin/tcsh

Retrieve list of FreeBSD packages (in jail):
portsnap fetch extract

Note: Use whereis <command> to locate where a command is in ports if desired.

Make and install Linux compatability (in jail):

cd /usr/ports/emulators/linux_base-f10/
make install clean

Install Linux proc (in jail):
cd /usr/ports/sysutils/linux-f10-procps/
make install clean


Now that we have the
/compat/linux/proc/ directory in the jail, we can get FreeNAS to mount the Linux proc filesystem there for the jail to use (in FreeNAS):
exit (if you are in the jail, exit to FreeNAS)

Script to Automatically load linprocfs for Linux jail compatibility (in FreeNAS):

Create an rc.d script to automatically mount proc and load the linprocfs.ko module. NOTE: edit the mount line suitable for your setup:
ee /conf/base/etc/rc.d/mountproc

Add into the mountproc file:

#!/bin/sh
# PROVIDE: mountproc
# REQUIRE: LOGIN
# BEFORE: jail

. /etc/rc.subr

name=mountproc
rcvar=mountproc_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop"

mountproc_start() {
/sbin/mount -t linprocfs linproc /mnt/Data/jails/Code42Edge/compat/linux/proc
}

mountproc_stop() {
/sbin/umount /mnt/Data/jails/Code42Edge/compat/linux/proc
echo "--- mountproc stopped ---"
}

load_rc_config $name
run_rc_command "$1"


Make the script executable:
chmod +x /conf/base/etc/rc.d/mountproc

Ensure linprocfs.ko module loaded on boot for Linux compatibility in jail (below):
WebGUI - System - Tunables - Add Tunable
Variable: mountproc_enable
Value: YES
Type: rc.conf
Comment: Mount proc to Code42Edge jail and load linprocfs.ko module
Enabled: Ticked


Load linprocfs.ko module now without rebooting (get proc mounted to jail now): (in FreeNAS)
service mountproc start


Check if linprocfs.ko is loaded: (also check after a restart for tunable working if desired)
kldstat | grep linprocfs
(Should return line with Name: linprocfs.ko)


Get Code42 Edge Server into jail:
Download Code42 Edge / CrashPlan PROe Linux Platform Installer from http://support.code42.com/Administr...ng/Code42_Platform_Installers#Current_Version

Copy to /mnt/Data/jails/Code42Edge/compat/linux/ (in FreeNAS).


Make a directory (or preferably ZFS dataset) for CrashPlan PROe to save its archives outside of the jail into and mount it in the jail (WebGUI):
WebGUI - Storage - <select parent dataset> - Create Dataset - … <crashplanarchive>
WebGUI - Jails - Storage - Add Storage:
Jail: Code42Edge
Source: /mnt/Data/<crashplanarchive>
Destination: /compat/linux/var/opt/proserver/backupArchives
Read-Only: Unticked
Create directory: Ticked


Back to the jail:
jexec Code42Edge /bin/tcsh

OPTIONAL JAVA INSTALL as CrashPlan PROe can download and configure its own local Java which could be jre-7u45-linux-i586.bin at this stage. To install our own (in jail):
cd /usr/ports/java/linux-sun-jre17
make install clean


This will ask you to manually fetch a Java Runtime Edition such as jre-7u80-linux-i586.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/index.html and to place it in your jail’s /usr/ports/distfiles directory. You may need an Oracle account to download the java runtime. After downloading get it into the required location by copying it to the FreeNAS base system (assuming that the jail filesystem is rooted at /mnt/Data/jails/Code42Edge):

Copy the java download to:
/mnt/Data/jails/Code42Edge/usr/ports/distfiles

After downloading, try the install again and it should work this time:
cd /usr/ports/java/linux-sun-jre17
make install clean


Make Linux bash the default bash:
Not sure if this is really the best way to do it, but it is convenient:
Link /bin/bash to /compat/linux/bin/bash so that all of the CrashPlan related stuff executes on the Linux compatibility layer (in jail):
WARNING: all bash use in the FreeBSD jail will invoke the Linux Compatibility bash:
ln -s /compat/linux/bin/bash /bin/bash


Unpack the Code42 Edge server (in jail):
cd /compat/linux/
tar –xzf CrashPlanPROServer_4.1.6.3_Linux.tgz


We cannot run the installer just yet, as it uses the FreeBSD sed and find instead of the Linux ones which correctly do everything inside of /compat/linux. Edit the installer to get a working version by inserting /compat/linux before ${OPTDIR} in the line with B42_PROPERTIES_FILE for use by sed and before $OPTDIR used by find .

Edit install.sh (in jail):
cd /compat/linux/CrashPlanPROServer_4.1.6.3_Linux
sed -e 's:B42_PROPERTIES_FILE=":B42_PROPERTIES_FILE="/compat/linux:' \
-e 's:find :find /compat/linux:' install.sh > compatinstall.sh
chmod +x compatinstall.sh


Install CrashPlan PROe server, assuming that /bin/bash is /compat/linux/bin/bash (in jail):
./compatinstall.sh

Either the install script will use the Java you installed above, or offer to download one.
Go with the defaults except for starting the server.

Answer no to starting the server as it will not work until the lack of inode monitoring (causing Guice errors, which I have no clue about?) is worked around (see https://wiki.freebsd.org/linux-kernel#Workarounds).


Add the java inode workaround flag indicated by the previous URL:
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider
to JAVA_ARGS in /compat/linux/opt/proserver/bin/proserver and change cmd to command in the ps line as we are using the FreeBSD ps, not the Linux ps and add a few –w otherwise we miss the CPServer appname:

Some sed for the edit (in jail): (1st 2 lines are on one line)
sed -i .bak -e 's/JAVA_ARGS="-server -Dn/JAVA_ARGS="-server -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -Dn/' \
-e 's/ PID=\`ps -eo pid,cmd/ PID=\`ps -wweo pid,command/' \
/compat/linux/opt/proserver/bin/proserver


Unfortunately the init.d scripts will need to be redone as rc.d scripts. Make a CrashPlan PROe startup script (in jail):
ee /etc/rc.d/proserver
Copy the following to the file:

#!/bin/sh
# PROVIDE: proserver
# REQUIRE: LOGIN

. /etc/rc.subr

name=proserver
rcvar=proserver_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop"

proserver_start() {
/compat/linux/bin/bash /compat/linux/opt/proserver/bin/proserver start
}

Proserver_stop() {
/compat/linux/bin/bash /compat/linux/opt/proserver/bin/proserver stop
}

load_rc_config $name
run_rc_command "$1"


Make the script executable (in jail):
chmod +x /etc/rc.d/proserver

Autostart proserver at jail startup (in jail):
ee /etc/rc.conf
Add the line:
proserver_enable="YES"


RECOMMENDED: Take a Code42Edge jail snapshot:
WebGUI - Volumes - select jails/Code42Edge - Create Snapshot

Test that the Edge server starts (in jail):
service proserver start
sockstat

You should get a large list of connections.


Test that CrashPlan PROe starts automatically by restarting FreeNAS.

Log into the CrashPlan PROe administration console:
Open a web browser in some GUI environment to:
http://<your jail>:4280/console
OR
https://<your jail>:4285/console

CrashPlan PROe guides:
http://support.code42.com/Administrator/4/Administration_Console_Reference


OPTIONAL: Create a jail template.
According to http://doc.freenas.org/9.3/freenas_jails.html#managing-jail-templates we make an mtree and tar of the jail. Tar first (in jail):
service proserver stop
cd /
tar czvf Code42Edge.tgz --exclude Code42Edge.tgz /


Now for the mtree (in FreeNAS):
cd /mnt/Data/jails
mtree -c -p /mnt/Data/jails/Code42Edge -k sha256digest > Code42Edge.mtree


Upload the files and create the template according to the URL above.

Maintenance on Updates:
After Code42 Edge server update: may need to re-edit the /compat/linux/opt/proserver/bin/proserver file in the jail to make the same adjustments again.

After FreeNAS update: may need to remake the /conf/base/etc/rc.d/mountproc file in FreeNAS.


Thanks:
To all of the incredible guides that others have done so that I could just "copy & paste" solutions for this little How-To, to Code42 for a great backup product and of course to the FreeNAS team ... now I can sleep peacefully at night ;).
 
Last edited:

kingtj

Dabbler
Joined
Jun 21, 2011
Messages
26
This is *EXACTLY* what I was hoping to set up in our offices, as we were already using FreeNAS as a way to recycle some of the older Windows servers and we recently purchased licensing for CrashPlan Pro-E as our corporate backup solution!

I just got FreeNAS 9.3 installed on a Lenovo box I put some RAM and storage in, and am going through your guide right now.

Unfortunately, I'm getting stuck on the steps under "Make and install Linux compatibility (in jail)".
When I issue the make install clean commands in the specified folders, I get:

===> linux_base-f10-10_9 linuxulator is not (kld)loaded.
*** [install] Error code 1
 
Last edited:

SkitzoTek

Cadet
Joined
May 18, 2015
Messages
4
My bad, we need to kldload linux.ko in FreeNAS before trying to install the Linux compatibility in the jail. I have adjusted the order of instructions to place the kernel module load before the jail compatibility build now. Sorry for the inconvenience. (Mine was loaded at the time because I had the CrashPlan home plugin installed to a jail which automatically does this as part of the jail install process).

Thank you for pointing out the error :).
 
Last edited:
Status
Not open for further replies.
Top