HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Marvell Kirkwood based
barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Fri Jan 09, 2015 3:57 pm

Description:
Deluge is a full-featured ​BitTorrent client for Linux, OS X, Unix and Windows. It uses ​libtorrent in its backend and features multiple user-interfaces including: Windows GUI, GTK+ (Linux), web and console. It has been designed using the client server model with a daemon process, that handles all the bittorrent activity. The Deluge daemon is able to run on headless machines with the user-interfaces being able to connect remotely from any platform. Deluge is ​free software and is licensed under the GNU General Public License. More info about deluge is on homepage.

Prerequisites: FFP 0.7-arm, updated slacker sites (repositories) with Uli's uwsiteloader.sh script. This post contains install instructions. For upgrading take a look at the second post.


Keep in mind before proceeding this tutorial!
Deluge installation requires to update many FFP packages, manual python modules installation and time. In very rare cases, this can break your currently running FFP programs, if they require particular or older versions of libraries (this is just theoretical assumption). One more thing-stop and disable Transmission daemon, if you are using it. Two running bitorrent programs, can heavily load NAS CPU, memory and HDD.


If the statement in red doesn't frighten you, then let's begin. All the steps below should be done logged as root user in FFP shell enviroment.

Install stage on NAS
1. Deluge is written in python programming language, so firstly we will install python together with others dependent libraries for deluge. Note regarding slacker tool using: "slacker -UuiA packagename" command will exclude already installed packages and will show only those, which needs to be installed or upgraded.

Code: Select all

slacker -UuiA br2:{python-2.7.*,setuptools,pip,boost,deluge,icu4c,libffi,libtorrent,geoip,ncurses,readline,intltool,gettext,libiconv,expat,gcc-solibs,uClibc-solibs,openssl,sqlite,gdbm,db5,zlib,bzip2}
2. Deluge needs some additional python packages to be installed (step 4). Before that, we will install/upgrade tools, required for building (compiling) python packages. This step will update main FFP toolchain libraries.

Code: Select all

slacker -uiA br2:{gcc,gcc-solibs,gmp,mpfr,mpc,autoconf,automake,binutils,make,m4,pkg-config,libtool,check,dejagnu,expect,tcl,help2man,flex,texinfo,bison,intltool,libiconv,gettext,ncurses,perl-modules,uClibc,uClibc-solibs,findutils,patchutils,perl-5.*,grep,bzip2,zlib} s:{gawk,diffutils,gzip,coreutils,patch} mz:kernel_headers
3. Python-pillow package was added to the list of dependent python modules for deluge since 1.3.11 version. Installation of pillow requires some graphics and font libraries to be present on system:

Code: Select all

slacker -uiA br2:{libtiff,libwebp,freetype} s:{giflib,libjpeg,libpng}
4. Lastly we will build (compile) external python packages-dependencies for deluge:

Code: Select all

pip install cryptography pyOpenSSL service-identity twisted pyxdg chardet setproctitle mako pillow
It taken about 17 min. to complete this command on my NSA310, so be patient and wait until it finishes.

Configure stage on NAS
Next, start Deluge server and wait about 1 minute. It is important, because on first start after fresh install deluge creates ssl certificates and config files, which can take some time:

Code: Select all

sh /ffp/start/deluged.sh start
You will see the following output on screen:
It seems, that you are running deluged for the first time after install or deluged home_dir path is changed.
Let it run for a 1 minute to create necessary files. Then stop deluged and start it again.

Starting deluged...done! [ OK ]
An interesting thing on this action is that only part of config files is created on first daemon startup. The next part is created, when daemon is exiting-stopping first time.

Next, stop Deluge server:

Code: Select all

sh /ffp/start/deluged.sh stop
and start it again

Code: Select all

sh /ffp/start/deluged.sh start
On the second start (only in case of freshly installed deluge) you will see the following output:
Your login name for Deluge thin client is deluged and password IC1y9s8p. Password is generated randomly.
You can change them by editing /ffp/var/lib/deluge/auth file manually and restarting deluged.

Starting deluged...done! [ OK ]
This login name and password will be used by PC client (so called Deluge thin client) for remote management of deluge server running on NAS.
NOTE: DON'T use any usernames and passwords, that you are using for login to NAS, for samba/cifs shares and so on. Use unique username with strong password.
Here is the most strangest thing in deluge-it stores usernames and passwords in plain text. That is the real security issue, even strong restrictions permissions are used for auth-authentication file, preventing others to view info inside it.
Anyway move forward. Now deluge daemon is up, running and ready for administration.

Install and configure stage on PC
For that purpose, you will need to install and configure desktop client. Go to http://dev.deluge-torrent.org/wiki/Download , choose version corresponding to FFP deluge package version and suitable for your OS, download and install deluge on your PC.
Then open deluge on PC and go to:
1.In Preferences -> Interface and disable (untick) Classic Mode
2.Restart deluge and you should now see the Connection Manager pop up.
3.Remove the localhost daemon, if not needed.
4.Click "Add" and for 'Hostname' enter your server's-NAS IP.
5.Leave the Port as default, 58846
6.Enter the Username and Password you added to the authentication file then finish by clicking 'Add'. If this was successful a green tick should now appear as the status for the daemon you just added.
7.Optional step: Expand Options and select 'Automatically connect to selected host on startup' and 'Do not show this dialog on start-up'.
8.Click on Connect and the Connection Manager should disappear.
Congratulations! You can now access and manage Deluge daemon running on NAS via the GUI.

Additional info:
Deluge home-config-main directory is
/ffp/var/lib/deluge
Default download directory - pre-defined share on Zyxel NAS'es
/mnt/HD_a2/video
Log file path is:
/ffp/var/log/deluged-warning.log
Enable autostart on NAS boot-up:

Code: Select all

chmod 755 /ffp/start/deluged.sh
Disable autostart on NAS boot-up:

Code: Select all

chmod 644 /ffp/start/deluged.sh

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Mon Mar 30, 2015 9:44 am

Upgrade instructions:
For upgrading deluge and python related packages, use slacker and run the following command:

Code: Select all

slacker -UuiA br2:deluge/ br2:python/
It will display selected list of updated packages, which can be upgraded by pressing OK button.
If you are getting this output,:
No packages found (status iu, pattern (br2:deluge/|br2:python/))
that means all your packages is up to date and there is nothing to update. Another possible reason might be not updated slacker sites (repositories) with Uli's uwsiteloader.sh script.

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Mon Mar 30, 2015 10:08 am

Today updated deluge, libtorrent, python, pip and setuptools packages has been uploaded to br2 slacker repository.

Winterwolf
Posts: 283
Joined: Thu Jun 06, 2013 12:56 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Winterwolf » Thu Apr 09, 2015 11:44 pm

Hi barmalej2,
I wouldnt mind trying this, but also dont want to mess up my current config lol ...... Is there anyway I can just take a backup of my setup/FFP etc, and just restore it if it all goes pear shaped?
NAS: NSA 325
FW : NSA325_V4.70(AAAJ.0)
FFP : v0.7 on HDD
  • Running SickBeard (vMaster)
    Running NZBGet (v15)
    Running Transmission (v2.84)
    Running Darkstat

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Fri Apr 10, 2015 8:49 am

Which FFP type are you using? Zypkg or usb stick?
What OS is on your PC?
For FFP-zypkg simple

Code: Select all

cp -a /ffp /some/backup/dir
should be enough I think.
For FFP-stick, I have used HDD-Raw-Copy-Tool http://hddguru.com/software/HDD-Raw-Copy-Tool on Windows. It creates (clones) exact usb image backup by sectors, which can be later burned to usb stick back. I would advise to run fsck tool, using gparted live USB http://gparted.org/liveusb.php to check files and system consistency on FFP-stick, before creating backup image with HDD-Raw-Copy-Tool. Instructions how to use fsck you can find here:
http://www.cyberciti.biz/tips/repairing ... ystem.html

Winterwolf
Posts: 283
Joined: Thu Jun 06, 2013 12:56 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Winterwolf » Fri Apr 10, 2015 10:00 am

Cheers, i'm using FFP on Zypkg, so will try this tonight. My PC OS is Win7
NAS: NSA 325
FW : NSA325_V4.70(AAAJ.0)
FFP : v0.7 on HDD
  • Running SickBeard (vMaster)
    Running NZBGet (v15)
    Running Transmission (v2.84)
    Running Darkstat

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Fri Apr 10, 2015 10:20 am

Well, breakage after update probability is only theoretical, imho everything should be fine. It is just precautionary measures. I'm a bit paranoid :lol: Good luck.

Durandle
Posts: 23
Joined: Thu Oct 09, 2014 10:51 am

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Durandle » Thu May 14, 2015 7:08 am

My Deluge can no longer function with https based trackers, it just reports "bttracker.tv: Error:" and nothing more. I assume this is going to be some lib issue with Python/OpenSSL or similar - any ideas?

EDIT: Debug log shows:

[DEBUG ] 07:36:12 alertmanager:123 tracker_announce_alert: Totally_Legit_Download.mkv (https://tracker.sometracker.tv:8443/ann ... 6c9s00a54a) sending announce (started)
[DEBUG ] 07:36:12 torrentmanager:988 on_alert_tracker_announce
[DEBUG ] 07:36:12 alertmanager:123 tracker_error_alert: Totally_Legit_Download.mkv (https://tracker.sometracker.tv:8443/ann ... 6c9s00a54a) (-1) unknown state "" (3)
[DEBUG ] 07:36:12 torrentmanager:1008 on_alert_tracker_error

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Thu May 14, 2015 8:15 am

Since when it started? After upgrading?
Give ouput of these commands:

Code: Select all

pip list
and

Code: Select all

funpkg -q deluge libtorrent python
I assume this is going to be some lib issue with Python/OpenSSL
To me seems as well. Might be pyopenssl related also.

Durandle
Posts: 23
Joined: Thu Oct 09, 2014 10:51 am

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Durandle » Thu May 14, 2015 8:43 am

I'm aware my setup is likely not exactly as yours, as some changes are there to support SickGear running on the NAS.

pip list:
--------------
certifi (14.5.14)
cffi (0.9.2)
characteristic (14.1.0)
chardet (2.3.0)
Cheetah (2.4.4)
CherryPy (3.6.0)
cryptography (0.9)
deluge (1.3.11)
enum34 (1.0.4)
idna (1.1)
ipaddress (1.0.7)
Mako (1.0.0)
Markdown (2.5.1)
MarkupSafe (0.23)
Pillow (2.8.1)
pip (6.1.1)
pyasn1 (0.1.7)
pyasn1-modules (0.0.5)
pycparser (2.13)
pyOpenSSL (0.15.1)
python-libtorrent (1.0.4)
pyxdg (0.25)
service-identity (14.0.0)
setproctitle (1.1.8)
setuptools (15.2)
six (1.9.0)
Twisted (14.0.2)
yenc (0.4.0)
zope.interface (4.1.1)

funpkg -q deluge libtorrent python:
--------------
deluge-1.3.11_git20150330-arm-2
libtorrent-1.0.4_svn10909-arm-2
pip-6.0.8_python2.7.9-arm-1
python-2.7.9-arm-1
setuptools-14.3.1_python2.7.9-arm-1

openssl version:
--------------
OpenSSL 1.0.1g 7 Apr 2014

EDIT: https requests in SickGear (which is Python based) seem to work fine.

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Thu May 14, 2015 9:31 am

Well you have updated openssl version. I'm not sure, is the problem related with it, but I can try to figure out. Meanwhile more output is required:

Code: Select all

python

Code: Select all

import ssl

Code: Select all

ssl.get_default_verify_paths()
Then copy output of last command and type Ctrl+d to exit.

Also it would be great to compare your openssl configuration with my current:

Code: Select all

strings /ffp/lib/libcrypto.a  | grep -in 'etc/ssl'

Durandle
Posts: 23
Joined: Thu Oct 09, 2014 10:51 am

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Durandle » Thu May 14, 2015 10:04 am

Thanks for looking in to this. Deluge + SickGear is such a great combo, when its works :P

I was tempted to try one of the methods of booting Debian on the NSA 325 off a USB stick, since that'd make it far easier to install and manage all sorts of packages, but holding back cos of the extra risk of totally breaking my NAS!

ssl.get_default_verify_paths()
DefaultVerifyPaths(cafile='/ffp/etc/ssl/cert.pem', capath='/ffp/etc/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/ffp/etc/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/ffp/etc/ssl/certs')

4231:OPENSSLDIR: "/ffp/etc/ssl"
24497:/ffp/etc/ssl/private
24498:/ffp/etc/ssl
24499:/ffp/etc/ssl/certs
24500:/ffp/etc/ssl/cert.pem

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Thu May 14, 2015 10:20 am

Outputs are identical to mine, so openssl should not be a problem, I think. I will try to download some files from https tracker(s) later this evening (after 7-8 hours) and report here back.
You can update python certifi meanwhile:

Code: Select all

pip install --upgrade certifi
One more question. Do downloading from others https trackers also fails?

Durandle
Posts: 23
Joined: Thu Oct 09, 2014 10:51 am

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by Durandle » Thu May 14, 2015 1:25 pm

pip install --upgrade certifi - This updated stuff but didn't solve it.

This is the only https tracker I have to hand - the only tracker I actually use in fact. Also, it was working directly before updating and stopped working directly afterwards - though I know there is room for coincidence there.

barmalej2
Posts: 2388
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install/Upgrade Deluge BitTorrent on FFP 0.7-arm

Post by barmalej2 » Thu May 14, 2015 2:44 pm

Houston we have a problem :lol: . I have checked and am a bit disappointed that none of my ever used trackers supports https :? . I can't do test download myself :( Need assistance from your side.
Please run from command line:

Code: Select all

c_rehash
Paste output for me. Restart deluge daemon and try to download again.
If that not helps, then try to downgrade python. Python 2.7.9 has major changes related to ssl module.

Code: Select all

funpkg -u /ffp/funpkg/cache/br2/python/python-2.7.8-arm-1.txz
Restart deluge daemon and try to download again.
If still no changes, upgrade back to latest python 2.7.9

Post Reply