- 2016-03-28 revision by redd (BTC/SJCX: 1GhLgxeaa58eCXkWCSCuxLKR18vYXi7Tvi) (pointer to fix enable ssh after DSM 6 upgrade)
- 2016-03-26 revision by skunk(BTC/SCJX: 18wfYoL4PvmTFUxz3KcH5p5ytbzCS5VT6Z)
- 2016-02-15 revision by jean (BTC/SCJX: 1JSyKVJJHeAk5QsP7BDZTjGWKwMhaYUZta) (make sure the right pip is used within chroot)
- 2016-02-01 revision by jean (BTC/SCJX: 1JSyKVJJHeAk5QsP7BDZTjGWKwMhaYUZta) (remove graphviz dependency as it is no longer needed)
- 2015-12-09 revision by jean (BTC/SCJX: 1JSyKVJJHeAk5QsP7BDZTjGWKwMhaYUZta) (introduces history, drops source.list modification, drops python3, markdown)
- ??? revision by reddd (BTC/SJCX: 1GhLgxeaa58eCXkWCSCuxLKR18vYXi7Tvi) ( with early steps (1-5) adaptation, Also thanks to dazh and danm for helping debug the guide)
- 2015-08-21 Scott’s Downstream Farmer synology guide (BTC/SJCX:1FvcdE9G6ZJrU7wbwYuYPe5d85Jgz37rVw)
This guide is presented as-is. Please understand that you will be making changes to your system and the authors and maintainers of this guide cannot be held responsible if something goes terribly wrong. That said, this is the method I used to install dataserv-client on my diskstation. It may not be the best method, but it worked for me.
- Log onto the NAS admin using an administrator account.
- Go to
Main Menu → Package Center → Settings → Package Sources
. - Click Add, and name the new package
SynoCommunity
at the locationhttp://packages.synocommunity.com/
. - Press OK.
- Under Trust Level, Allow Installation of packages published by: select “Synology Inc. and trusted publishers.”
- Go back to the Package Center and install the Debian Chroot package (Remember which volume you install Debian Chroot, as you will need this information later)
- Restart your NAS.
Go to Main Menu→Control Panel → Terminal & SNMP
, under the Terminal tab, click Enable SSH Service and then Apply.
Use a terminal client (for instance, PuTTY) to log into your Synology. Use root as the username, and your administrator password.
DSM 6 disabled root login preferring a normal user login then using sudo. Create a normal user with a password, make it part of the administrator group then use a terminal client (for instance, PuTTY) to log into your Synology. Once logged in, you can use the sudo -i
command to become root.
Please be sure to exercise best practices when selecting a password, as a server with ssh exposed to the internet will find itself under regular brute force attacks.
You should see a prompt:
DISKSTATION>
You can disconnect from the prompt using <CTRL>+D
At the prompt DISKSTATION>
, start Debian Chroot by entering the text below.
DISKSTATION> /var/packages/debian-chroot/scripts/start-stop-status chroot
This will present you with a new prompt root@DISKSTATION:/#
. When you see this prompt, you are working in the chroot environment.
You can exit this prompt and return to the default prompt using <CTRL>+D
. This allows you to go back and forth between the default prompt and the chroot prompt.
Debian Chroot basically simulates a Debian system within your Diskstation’s operating system. The simulated root directory is located at
/volume1/@appstore/debian-chroot/var/chroottarget/root/
within the Synology’s “real” file system. In theory, the simulated OS cannot see any files above the chroottarget directory, but there are ways around that (see xxxxxx).
Debian Chroot enables certain functions that your Diskstation’s stripped-down Linux cannot perform (such as apt-get). We will be installing running dataserv-client from within this special environment.
Run the following commands
apt-get update
apt-get install -y python-pip pkg-config python-dev pkg-config
The pip
command installed by apt-get when requesting python-pip
is pretty old (1.5.6) and the installation requires a more upto date version. The following command will update pip
:
easy_install --upgrade pip
On some systems the above is not enough to get the right version of pip. To make sure the correct pip command is used run the following 2 commands :
mv /usr/bin/pip /usr/bin/pipold && ln -s /usr/local/bin/pip /usr/bin/pip
mv /usr/bin/pip2 /usr/bin/pip2old && ln -s /usr/local/bin/pip2 /usr/bin/pip2
Now we can install dataserv-client
using pip
pip install dataserv-client
you can make sure it works with
dataserv-client version
At this point you should definitely check the quick start guide in the dataserv-client README
If the process is running in the background, you can type ps | grep dataserv
to identify the process id (PID) of the dataserv-client process, and terminate it by using the kill <pid>
command. If the process is running in the foreground, you can terminate it with <Ctrl>+C
. This works in both the chroot and normal environments.
When running poll
in the background, you will not see any output that confirms that the process is working. It can be helpful to use strace -p <PID>
(where PID is the process ID identified using ps
) in order to confirm that a ping is being sent every 15 seconds or so. You can terminate strace
(or rather, detach from the process) with <Ctrl>+C
. This works in both the chroot and normal environments.
You can use du ~/.storj/store
to track the size of your storage directory (in KB) as the shards are built (assuming that ~/.storj/store is your storage directory). By default the directory size is reported in kilobytes ,which can be unwieldy. Add a -h
tag to the end to make it more human readable (e.g. du ~/.storj/store -h
). This command (du
) works both inside and outside the chroot environment; just keep in mind that the directory path will be different in each one.
You can use top within the chroot environment in order to see how long dataserv-client has been running. Use this in conjunction with the du
command described above in order to calculate the rate of a build (as in, gigabytes/minute). You can use top in the regular environment, but it will not report a time.
To manually update, kill any existing dataserv-client processes (see above) and use pip
to remove and reinstall the package from git.
pip uninstall dataserv-client
pip install dataserv-client
Make sure you hang on the slack or follow releases on github to know when to upgrade.
By default, dataserv-client places built shards in /root/.storj/store. Within the “real” filesystem, this is actually located in /volume1/@appstore/debian-chroot/var/chroottarget/root/.storj/store
, where volume1 represents the volume in which you installed Chroot
.
I prefer to send the shards to a directory which I can access in DSM’s file manager. Therefore, I call the following commands outside the chroot environment, before running the build command:
DISKSTATION> mkdir ~/../volume1/storj
DISKSTATION> mount -o bind /volume1/storj/ /volume1/@appstore/debian-chroot/var/chroottarget/root/.storj
This first creates a directory under volume 1 to receive the shards then tells the server to redirect anything being sent to the latter directory (deep in the chroot filesystem) into the former directory (higher up, in the main filesystem). It’s sort of like making a shortcut that “tricks” the system and lets it place files in locations outside the chroot environment. You will have to remount this at every restart.
Dataserv-client has to send his signature and timestamp on every server request. Only a few seconds time difference are allowed or you will see a logmessage Invalid authentication headers. Synchronize your clock with an internet-based time server.
A slow CPU will need a few seconds to create the signature and even if the clock is perfect synced you will get the message. This performance enhancement will solve that problem.
apt-get install openssl
export PYCOIN_NATIVE=openssl
To ensure that dataserv-client will continue running after you close PuTTY, prefix it with the nohup
command. To make sure it runs in the background, add an &
character to the end of your command. When I run a build or a poll, I use both of these as in:
root@DISKSTATION:/# nohup dataserv-client --address=YourAddress poll &
This steps comes from the previous guides and wan't tested by jean
You must insert the appropriate commands into your /etc/rc.local file using a text editor such as vi
. Do the following at the default prompt (outside the chroot):
DISKSTATION> vi /etc/rc.local
Press i
to start insert mode
. Paste the lines below in the file, after optware
(if present) but before the exit code on the last line of the file.
# wait 30 seconds
sleep 30
# mount the storj directory into the chroot filesystem as /root/.storj. This is only necessary if you followed step 13A, and placed your build somewhere other than the default location.
mount -o bind /volume1/storj/ /volume1/@appstore/debian-chroot/var/chroottarget/root/.storj
# some chroot / linux book keeping, which is necessary if you carried out the above remounting step.
chroot ../volume1/@appstore/debian-chroot/var/chroottarget/ mount -t proc proc /proc
# start the farmer (make sure this command is valid for your version of dataserv-client)
chroot ../volume1/@appstore/debian-chroot/var/chroottarget/ dataserv-client --store_path=/root/.storj/store --config_path=/root/.storj/config.json farm &
- To save changes to rc.local and quit vi: press
Escape
, type:x
. - To exit without saving, press
Escape
, then type:q!