[How-To] CrashPlan in FreeNAS 9.1 Jail (tested on 32bit)

Status
Not open for further replies.

thewiep

Dabbler
Joined
Jun 12, 2011
Messages
31
thanks to some great info on the internet (see links) I managed to get CrashPlan running in a FreeNAS 9.1 Jail.
I documented my steps below, I wanted to clean it up some more but I leave on holiday tomorrow and wanted to post this already..
The whole concept of jails is new to me so it's quite possible that there's a better or faster way to get it done.
If so, comments with tips are appreciated!

I currently only tested it on a 32bit system as my old server is 32bit..

Install CrashPlan in FreeNAS 9.1 Jail

real-time backup will not happen because inotify isn’t supported yet:
https://wiki.freebsd.org/linux-kernel

You can however run CrashPlan and force a verify every time you need to run a backup..

links

Full install guides, I couldn’t have done it without these:
http://worrbase.com/2012/03/31/Crashplan.html
http://www.1stbyte.com/2011/01/26/how-to-install-crashplan-on-freebsd/
http://blog.oddbit.com/post/installing-crashplan-under-freebsd-8

Various info
http://clicklog.org/article/274954428.html
https://crashplan.zendesk.com/entries/112498
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html
http://vocalbit.com/posts/freebsd-jails-using-zfs-and-bsdinstall.html

Install CrashPlan

first make sure you have a Disk added (check in WebGUI - Storage - Volumes - View Disks) and an Active Volume (check in WebGUI - Storage - Volumes - View Volumes)
if not, add one with WebGUI - Storage - Volumes - ZFS Volume Manager

enable SSH

WebGUI - Services - SSH
you also might want to enable “Login as Root with password” for now (click on the wrench key button)
create a folder on that Volume that will serve as root folder for our Jails

mkdir /mnt/mydata/jails

configure general Jail settings

WebGUI - Jail - Configuration - Jail Root
select /mnt/mydata/jails

create new Jail

WebGUI - Jails - Add Jails
click Advanced Mode
Jail Name: CrashPlan
IPv4 address: 192.168.1.111/24
autostart: checked
type: standard
VIMAGE: unchecked
NAT: checked
vanilla: checked

if you get an error about extraction failed, just click OK again and it should complete..

load linux module

(needed to install linux_base-f10 etc.. below)
kldload linux

check if linux.ko is loaded

kldstat | grep linux

check the JID of your Jail

jls

open the shell of your Jail with the JID

jexec 1 /bin/tcsh

now you’re in your Jail and we need to get a list of packages (in Jail)

portsnap fetch extract

if you get a message “... can't find either v4 or v6 networking ...” you might need to reboot FreeNAS
install the needed stuff (in Jail)

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

cd /usr/ports/sysutils/linux-f10-procps/
make install clean

cd /usr/ports/java/linux-sun-jre16
make install clean
this will now tell you that you need to manually download the java bin file, it will also tell you which version, in my case it was jre-6u45-linux-i586.bin which I downloaded from:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jre-6u45-oth-JPR
if you downloaded it to your PC you need to transfer it to FreeNAS in the distfiles dir where the Jail can access it
/mnt/mydata/jails/CrashPlan/usr/ports/distfiles
then try to install again, this should work
cd /usr/ports/java/linux-sun-jre16
make install clean

optionally you can install nano, I prefer it over vi as I find it easier :)
watch out though as it takes quite a while
cd /usr/ports/editors/nano
make install clean

get linprocfs loaded (inFreeNAS)

create a script that will mount proc (mounting will automatically load the linprocfs.ko module):
mount -uw /
nano /conf/base/etc/rc.d/mountproc

add (make sure the command in mountproc_start is on 1 line):
#!/bin/sh
# PROVIDE mountproc
# REQUIRE LOGIN

. /etc/rc.subr

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

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

mountproc_stop() {
echo "--- mountproc stopped ---"
}

load_rc_config $name
run_rc_command "$1"

make it executable
chmod +x /conf/base/etc/rc.d/mountproc

enable the variable so the script runs at boot:
nano /conf/base/etc/rc.conf
add:
mountproc_enable=”YES”

edit rc.conf to load linux module at boot (in FreeNAS)

mount -uw /
nano /conf/base/etc/rc.conf
add:
linux_enable=”YES”

reboot FreeNAS

install CrashPlan Linux (in Jail)

download CrashPlan for Linux from their site and move the file (CrashPlan_3.5.3_Linux.tgz) to your FreeNAS in the compat/linux folder of your Jail (/mnt/mydata/jails/CrashPlan/compat/linux)
open the shell of your jail
jexec 1 /bin/tcsh
cd /compat/linux
tar -xzf CrashPlan_3.5.3_Linux.tgz
cd CrashPlan-install
/compat/linux/bin/bash /compat/linux/CrashPlan-install/install.sh
now CrashPlan is installed but it won’t run just yet..

edit CrashPlan run.conf

we need to edit /compat/linux/usr/local/crashplan/bin/run.conf
and add following text to the end of the SRV_JAVA_OPTS line (still in the “)
-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider

select correct Java for CrashPlan (in Jail)

by default, CrashPlan uses /usr/local/bin/java
it seems to work fine but we can change that by the one we installed if we want...
nano /compat/linux/usr/local/crashplan/install.vars
change JAVACOMMON=”...” to JAVACOMMON=”/usr/local/linux-sun-jre1.6.0/bin/java”

if you switched to the Java we installed you need to load the linprocfs module on boot, it will automatically load when the mountproc script is started but will cause the crashplan script below to fail as the module is loaded too late.. (I need to check this..)
original Java works fine..
start CrashPlanEngine and check Status

you can start CrashPlanEngine now, this can be done from within or outside the Jail
within the Jail:
start:
/compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine start

get status:
/compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine status

outside the Jail:
start:
jexec 1 /compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine status

get status:
jexec 1 /compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine status

launch CrashPlan on jail boot

open the shell of your jail:
jexec 1 /bin/tcsh

now you’re in the shell of your jail, create a script that will start CrashPlan when your Jail is started:
nano /etc/rc.d/crashplan
add (make sure the command in crashplan_start & stop is on 1 line):
#!/bin/sh
# PROVIDE crashplan
# REQUIRE LOGIN

. /etc/rc.subr

name=crashplan
rcvar=crashplan_enable
start_cmd="${name}_start"
stop_cmd="${name}_stop}"

crashplan_start () {
/compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine start
}

crashplan_stop() {
/compat/linux/bin/bash /compat/linux/usr/local/crashplan/bin/CrashPlanEngine stop
}

load_rc_config $name
run_rc_command "$1"

make it executable
chmod +x /etc/rc.d/crashplan

still in your jail, enable the variable so the script runs at jail startup:
nano /etc/rc.conf
add:
crashplan_enable=”YES”

remote CrashPlan GUI

official way from CrashPlan:
http://support.crashplan.com/doku.php/how_to/configure_a_headless_client

both FreeNAS and the PC running CrashPlan Desktop are on the same network so I only changed the ui.properties file on the PC running CrashPlan Desktop.
I changed serviceHost from serviceHost=127.0.0.1 to serviceHost=<ip of jail>
add storage to Jail

WebGUI - Jails - Plugin Jails - CrashPlan - Storage - Add Storage
Source: something on your FreeNAS
Destination: /compat/linux/mnt
now CrashPlan can access this data from /mnt/

adopt another computer with CrashPlan (troubleshooting)

Adopting Another Computer
http://support.crashplan.com/doku.php/recipe/adopting_another_computer

I Don't See the "Adopt" Option
https://helpdesk.crashplan.com/entries/23709627-I-Don-t-See-the-Adopt-Option
double-click CrashPlan icon in CrashPlan Desktop
type
guid new
press enter

Changes needed after upgrading from FreeNAS 9.1RC1 to 9.1RC2


the Jail remains intact, only changes made to:
/conf/base/etc/rc.conf
and
/conf/base/etc/rc.d/mountproc
need to be done again
 

ofthores

Cadet
Joined
Aug 6, 2013
Messages
2
Thanks! Great tutorial.
I managed to get this working even on a 64bit freenas with Crashplan up and running and the Desktop UI connecting just fine.
My only problem was to get crasplan to start autmatically and I tracked this down to the fact that linproc was mounted too late. To fix this I had to do a small change:
1. Corrected a small typo in the mountproc script (added ":" after PROVIDE and REQUIRE) and added the BEFORE clause in the rc.d script:
#!/bin/sh
# PROVIDE: mountproc
# REQUIRE: LOGIN
# BEFORE: ix-jail
Additionally I added mountproc to the REQUIRE: section in the ix-jail and jail rc.d scripts. I don't know if this was necessary but at least this procedure got the mountproc executed before the jail and the crasplan service was started.
Again thanks a lot.
 

darkconz

Dabbler
Joined
Apr 23, 2013
Messages
32
Thanks! Great tutorial.
Additionally I added mountproc to the REQUIRE: section in the ix-jail and jail rc.d scripts. I don't know if this was necessary but at least this procedure got the mountproc executed before the jail and the crasplan service was started.
Again thanks a lot.


Thanks for the great tutorial and the additional notes. I am in the process of setting this up, ofthores, I am kinda lost to what you said here. Can you which files you modified by adding the REQUIRE:?

Thanks!
 

darkconz

Dabbler
Joined
Apr 23, 2013
Messages
32
I am testing the steps on 64bit VM. I got up to the part to install Crashplan but it wouldn't install. Here is the error:


root@Crashplan:/compat/linux/CrashPlan-install # /compat/linux/bin/bash /compat/linux/CrashPlan-install/install.sh

Welcome to the CrashPlan Installer.

Press enter to continue with installation.

Validating environment...
detected root permissions
49581 blocks
/usr/local/linux-sun-jre1.6.0/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
The current version of Java () is incompatible with CrashPlan.
Please install one of the following version of the Sun JRE or OpenJDK: 1.5 1.6 1.7


I also tried using Java SE Runtime 1.5 and 1.7. Neither of them worked.
 

darkconz

Dabbler
Joined
Apr 23, 2013
Messages
32
I have an update. I noticed what I did wrong. My VM is running 64bit so when I create the jail, there is a 32bit option (unckecked by default). I assume this creates a 32bit jail and I was correct. All the software require 32bit and having a 64bit jail in my previous attempts didn't work. Checking this box now made it working. :)
 

ofthores

Cadet
Joined
Aug 6, 2013
Messages
2
Hi drakconz,
I guess you figured it out now - but I put "REQUIRE: mountproc" in the /conf/base/etc/rc.d/ix-jail and /conf/base/etc/rc.d/jail. As I said I don't know if this was necessary, but the point is to run /conf/base/etc/rc.d/mountproc before the ix-jail script - otherwise the automatic start of crashplan failed. Starting it manually after startup worked just fine.
 

darkconz

Dabbler
Joined
Apr 23, 2013
Messages
32
Hi drakconz,
I guess you figured it out now - but I put "REQUIRE: mountproc" in the /conf/base/etc/rc.d/ix-jail and /conf/base/etc/rc.d/jail. As I said I don't know if this was necessary, but the point is to run /conf/base/etc/rc.d/mountproc before the ix-jail script - otherwise the automatic start of crashplan failed. Starting it manually after startup worked just fine.


Thanks for the info. I got it to work out yesterday and right now I am experimenting with encrypted volumes. The service doesn't auto start when the jail is located in the encrypted volume. I was forced to start everything manually after unlocking the volume.
 

tatonka

Dabbler
Joined
Jul 19, 2013
Messages
12
I have created an 32bit jail on a 64bit host. I still get the error

/usr/local/linux-sun-jre1.6.0/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
The current version of Java () is incompatible with CrashPlan.
Please install one of the following version of the Sun JRE or OpenJDK: 1.5 1.6 1.7

I tried to "setenv LD_LIBRARY_PATH" in the /etc/rc.conf of my jail, and made sure that the host does require mountproc like ofthores mentioned. I still get this error. Maybe someone of you can help me...
 

tatonka

Dabbler
Joined
Jul 19, 2013
Messages
12
Well, i think i got it. I had to modify the mountproc rc script. I had just copypasted it, so it tried to access /mnt/mydata. But my zpool is called /mnt/storage :D

I was able to call java inside my jail without errors and i am just rebooting to check if the rc script is properly executed at boot.
 

thewiep

Dabbler
Joined
Jun 12, 2011
Messages
31
so.. back from holiday :)

glad to see people are helping each other and info is being shared!

my system is currently verifying my backup after Adopting it in CrashPlan, it's been running 4 days now and still needs some time..
I think my linproc loaded at the correct time... will test later when my backup is finished.
Will also update the first post, clean it up a bit and mark the items that might need to be changed for each system then.

ofthores: I think if you change an rc.d script which is in the /conf/base dir, it will get overwritten when you update FreeNAS
 

tatonka

Dabbler
Joined
Jul 19, 2013
Messages
12
thewiep, ofthores: it is not. the /conf/base dir is the directory from where FreeNAS fetches the stock files which are resetting the actual config files after a reboot. So if you want a change to persist, you have to mount / as uw, and edit the /conf/base files. After a reboot, FreeNAS moves them to / and "executes" them.

I think we should expect every file outside the jail to be overwritten with stock versions after an upgrade, except the ones where the WebUI saves its settings. I don't know if the "config export" preserves these files as well.
But hey, it will be the first boot where the java can't be executed, and you have to copy&paste some values from this thread...i think it's a reasonable amount after upgrading a whole operating system.
 

mordysh

Cadet
Joined
Sep 25, 2012
Messages
5
Hi,
Thanks for the informatio. I followed it and it almost worked for me.

The thing that does not work is filenames with hebrew characters.

I set the locale to "he_IL.UTF-8" and indeed locale gives me the hebrew locale - but (there is always a but)
when i start the shell and type locale -a I get only the C and POSIX locale so it doen't help that I set it to hebrew.

It looks like locale inside the jail inside the bash shell don't know UTF-8 locales.

Can someone help?

mordy.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Just wanted to post that I was able to get Crashplan working without any modifications outside of the jail.

Basically, I installed openjdk7 and replaced the JTUX and JNA libraries in the Crashplan installation directory with those from here (look at the "Native (without LCE)" section). My understanding is that you won't get real-time backups anyway, because inotify hasn't been ported, so there's no advantage to linux compatibility.

Seems to be working fine so far.

Note that the JTUX / JNA page suggests adding two configs to your run.conf, but adding these caused the engine to fail to launch for me.

Also, if you change bin/CrashPlanEngine, line 83 as below, "CrashPlanEngine status" will properly report the status of the engine.

from starting with:
Code:
/bin/ps -eo 'pid,cmd'

to
Code:
/bin/ps -wweo 'pid,command'
 

aaron.oneal

Dabbler
Joined
Oct 7, 2013
Messages
10
@fracai: That works for me too until I reboot. CrashPlan won't save the .identity for the machine. I get this in the log.

Code:
[10.09.13 18:39:43.639 WARN    main                com.backup42.service.ComputerUniqueId  ] Unable to store computer identity. Not implemented on null, com.code42.exception.DebugException: Not implemented on null
com.code42.exception.DebugException: Not implemented on null
    at com.backup42.service.ComputerUniqueId.save(ComputerUniqueId.java:414)
    at com.backup42.service.ComputerUniqueId.setTransportKeyPair(ComputerUniqueId.java:286)
    at com.backup42.service.CPService.initPeerControllers(CPService.java:563)
    at com.backup42.service.CPService.start(CPService.java:443)
    at com.backup42.service.CPService.main(CPService.java:1749)
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
@fracai: That works for me too until I reboot. CrashPlan won't save the .identity for the machine. I get this in the log.
Yeah, same here. Crashplan support suggested copying the identity file from another machine.

Instead I'm going to try the new plugin, but I haven't had a chance yet.
 

aaron.oneal

Dabbler
Joined
Oct 7, 2013
Messages
10
I haven't had any luck with the new plugin. However, I think I fixed the identity issue with the other approach by adding the following to run.conf:

Code:
-Dos.name=Linux -Djava.nio.file.spi.DefaultFileSystemProvider=sun.nio.fs.BsdFileSystemProvider


I also fixed the automount timing issue to get the linux mounts loaded and unloaded with the jail (for those using the LCE approach).

1. cd /mnt/pool1/jails/.crashplan.meta (or whatever your folder is)
2. vi fstab
3. Make sure the mount points exist and add the following:
Code:
linproc /mnt/pool1/jails/crashplan/compat/linux/proc    linprocfs rw 0 0
linsys  /mnt/pool1/jails/crashplan/compat/linux/sys      linsysfs  rw 0 0
devfs  /mnt/pool1/jails/crashplan/compat/linux/dev    devfs    rw 0 0

4. chflags schg fstab

Step 4 prevents it from being overwritten. Use chflags noschg fstab to make it editable again.

I need to do some more testing but so far it seems to be working in either the LCE or non-LCE configuration.
 

Prashant

Cadet
Joined
Oct 14, 2013
Messages
3
HI Guys,

I am a newbie with just enough knowledge of linux to be dangerous :)
I am getting following error when installing linux_base-f10 emulator.

I have recently installed FreeNas 9.1.1 64bit

===> Building package for linux_base-f10-10_7
Creating package /usr/ports/emulators/linux_base-f10/work/linux_base-f10-10_7.tbz
Registering depends:.
Registering conflicts: linux_base-gentoo* linux_base-fc4-[0-9]* linux_base-fc6-[0-9]* linux_base-f7-[0-9]* linux_base-f8-[0-9]* linux_base-f9-[0-9]* linux_base-c* linux-glib2-*.
pkg_create: couldn't resolve path for prefix: /compat/linux: No such file or directory
*** [do-package] Error code 1
Thanks in advance....
 

aaron.oneal

Dabbler
Joined
Oct 7, 2013
Messages
10
How did you create your jail? What if you create the '/compat/linux' folder and then 'make install' again?

When I was running under the LCE, I created a standard, non-vanilla, 32-bit jail and used the package manager to install. e.g. 'pkg install linux_base-f10'. I think I built it from source during one test too but I don't recall having any errors like that.

If you still have trouble getting it working, the Linux compat environment isn't required if you install bash, openjdk, build JTUX, and replace the libjtux.so file that CrashPlan comes with.
 
Status
Not open for further replies.
Top