This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

ruTorrent extension?

XigmaNAS Extensions / Add-ons

Moderator: crest

Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
cp.engr
Starter
Starter
Posts: 22
Joined: 09 Jul 2012 03:55
Status: Offline

ruTorrent extension?

Post by cp.engr »

Hi all,

I'm looking into possibly making an ruTorrent (forums) extension for NAS4Free.

Questions:

1. Is anyone else already working on this?
2. Would others be interested in using it?
3. From what I understand, having it run in a jail is recommended--or is it required?
4. It's been suggested that I use the jails guide (link above), and use another extension as a template / example. Any other tips for how to do it?

(Yes, I know Transmission comes with N4F, but AFAICT, ruTorrent with its own plugins is more featureful--and better looking, IMHO.)


P.S. I know I'm new, but given the nature of the post, I took the liberty of posting it here (not in newbies). I hope that's okay.

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4865
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: ruTorrent extension?

Post by raulfg3 »

2 - I´m interesing and aprecciate your efforts.
3 - not sure , but I think that is recommended, not requiered
12.1.0.4 - Ingva (revision 7743) on SUPERMICRO X8SIL-F 8GB of ECC RAM, 11x3TB disk in 1 vdev = Vpool = 32TB Raw size , so 29TB usable size (I Have other NAS as Backup)

Wiki
Last changes

HP T510

User avatar
ChriZathens
Forum Moderator
Forum Moderator
Posts: 758
Joined: 23 Jun 2012 09:14
Location: Athens, Greece
Contact:
Status: Offline

Re: ruTorrent extension?

Post by ChriZathens »

Yes!!!
Thanks a lot for offering to do this!
I would definitely use it
I currently have one PC dedicated for downloader (rutorrent+rtorrent) . Perhaps I could get rid of it lol... (OK, maybe not - it has a lot more besides rtorrent)
My Nas
  1. Case: Fractal Design Define R2
  2. M/B: Supermicro x9scl-f
  3. CPU: Intel Celeron G1620
  4. RAM: 16GB DDR3 ECC (2 x Kingston KVR1333D3E9S/8G)
  5. PSU: Chieftec 850w 80+ modular
  6. Storage: 8x2TB HDDs in a RaidZ2 array ~ 10.1 TB usable disk space
  7. O/S: XigmaNAS 11.2.0.4.6625 -amd64 embedded
  8. Extra H/W: Dell Perc H310 SAS controller, crosflashed to LSI 9211-8i IT mode, 8GB Innodisk D150SV SATADOM for O/S

Backup Nas: U-NAS NSC-400, Gigabyte MB10-DS4 (4x4TB Seagate Exos disks in RaidZ configuration - 32GB RAM)

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

I've managed to get the rutorrent web-front-end to start working, and connecting it to rtorrent/libtorrent with xmlprc, however, there is currently a bug in libtorrent that makes the CPU go up 200% when download in 0-400 KB/s this makes your machine unusable and of course the rtorrent/libtorrent hangs. As I dont posses the knowledge to compile and make the patch work (link below) im stuck until the developer updates the code, then wait for the new version port to be available. After that i will post a guide to add rTorrent and ruTorrent to N4F :D

More about this here
https://github.com/rakshasa/libtorrent/pull/21

cp.engr
Starter
Starter
Posts: 22
Joined: 09 Jul 2012 03:55
Status: Offline

Re: ruTorrent extension?

Post by cp.engr »

Hi all,

Sorry for the delay. So much to do...

I researched, and spent some time in IRC...and it seems that there isn't an actual "plug-in" or "extension" framework to NAS4Free (like Firefox's Add-Ons, for instance, where you can install with a couple mouse clicks). There are ways to package things with custom installer scripts so that they are "extension-like", and you can make a php page for it to go under "Extensions" in the webgui. Jails are recommended for that, but I don't want to go there.

So instead of an extension-like package, I planned on getting it working for myself with simple pkg_adds and union_mounts, and then writing a howto. To that end, I do have rtorrent, rutorrent, and dtach installed in a NAS4Free VM, and I've started it running and connected to it, and things looked good before (although I think something broke recently)...

I still need to figure out how to run rtorrent (daemonized) automatically at startup. I think I can put a command in "System|Advanced|Command scripts" using sudo (so that it does not run as root) and dtach that should do the trick.

Babovand, a couple of things:

1. Since you mentioned writing a howto...well, I don't know if you want to try to work together, or let me do it, or race, or what...feel free to PM me if you want.

2. I haven't noticed the bug you described yet, but I haven't even put this on real hardware yet, and I've only downloaded a few files with it.

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

Hi cp.engr!

Yes, forgot to tell all that what i've done is NOT an extension like this viewtopic.php?f=71&t=1278
As you described it is possible to make "extension-like" which installs all the ports necessary for rutorrent to work, however, I can only see more problems with this, since N4F is constantly updating we/someone may need to update that script when necessary. Thats why my how-to guide will be command copy-paste (as you said simple_pkg add commands).

Yeah jails are recommened, but I really dont understand why, its good if you run a system with multiple users and want to isolate them from each other and the system itself, but its a big waste of time and totally unnecessary for a home-owned media server/NAS, I doubt enterprise systems would ever consider installing Rtorrent, hence jails are unnecessary.

Also forgot to tell that i've managed to compile and patch libtorrent so I've fixed the 100 CPU issue in the link above. Rutorrent is amazing and should replace transmission.
I still need to figure out how to run rtorrent (daemonized) automatically at startup. I think I can put a command in "System|Advanced|Command scripts" using sudo (so that it does not run as root) and dtach that should do the trick.
Having problems with this also, tried both screen and dtach to make it work, it wont run as a command script, since that terminal that runs it will be "stuck" in the screen and dtach "mode" running rtorrent.

We could work together on this, but, the FreeBSD or *BSD really love to complicate even the easiest of tasks, now, i cant seem to run the newest build .323 in vmware, getting stuck on the BTX loader, and since it do not want to play around with my real machine, im stuck.

the-razer
Starter
Starter
Posts: 26
Joined: 09 Jul 2012 18:42
Status: Offline

Re: ruTorrent extension?

Post by the-razer »

cp.engr wrote: I still need to figure out how to run rtorrent (daemonized) automatically at startup. I think I can put a command in "System|Advanced|Command scripts" using sudo (so that it does not run as root) and dtach that should do the trick.
Does rtorrent create a file in /etc/rc.d? If yes, you should do a unionfs mount there too and start it via this init script. Perhaps you have to enable it with something like rtorrent_enable=YES in rc.conf, which you can alter via the NAS4Free web gui.

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

the-razer wrote:Does rtorrent create a file in /etc/rc.d? If yes, you should do a unionfs mount there too and start it via this init script. Perhaps you have to enable it with something like rtorrent_enable=YES in rc.conf, which you can alter via the NAS4Free web gui.
Good Idea, but sadly it does not create any scripts/files in the rc.d folder, there are scripts out there in the web for FreeBSD, but they are not designed for N4F, and needs some editing.

cp.engr
Starter
Starter
Posts: 22
Joined: 09 Jul 2012 03:55
Status: Offline

Re: ruTorrent extension?

Post by cp.engr »

Babovand wrote:Also forgot to tell that i've managed to compile and patch libtorrent so I've fixed the 100 CPU issue in the link above.
Care to share with the class?

I mean, is the fix merged into the release, or did you merge and build it yourself? Please give details on whatever you did.

cp.engr
Starter
Starter
Posts: 22
Joined: 09 Jul 2012 03:55
Status: Offline

Re: ruTorrent extension?

Post by cp.engr »

Hey all,

I did get it working. I hope to post a HOW-TO draft here soon (within a few days/weeks). I have several open questions still. After we resolve enough of them, then I will make a new thread for the HOW-TO.

CPU usage does go kinda high sometimes, like 90% - 99% sometimes while downloading. Babovand, please let us know what you did to resolve this issue.

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

cp.engr wrote:Hey all,

I did get it working. I hope to post a HOW-TO draft here soon (within a few days/weeks). I have several open questions still. After we resolve enough of them, then I will make a new thread for the HOW-TO.

CPU usage does go kinda high sometimes, like 90% - 99% sometimes while downloading. Babovand, please let us know what you did to resolve this issue.
I thought i was the only one that had the problem, did'nt know!
It was quite complicated but I can explain what I did.
I downloaded FreeBSD 9.0 and installed it in a virtual machine, then i downloaded the source to the libtorrent port using make extract, edited the source code myself with a fix that was applied in the link about the issue, this fix has not yet been added by the developer, (https://github.com/Yamagi/libtorrent/co ... 7fcd264c53), when I was done i did make build (for compile the "new" libtorrent", then make install (to install it), after the install was complete I made a package file (pkg_create) and uploaded the package to my N4F machine and installed it with pkg_add.

Anyhow...i uploaded the fixed libtorrent here on dropbox so you can just upload it yourself and pkg_add it to your system :D
https://www.dropbox.com/s/un7np6yrpfnvp ... 0.13.2.tbz

And btw it might fail for you due to a package that is installed in N4F that is old, just replace this package with the version that it demands or higher, this occurred because the newer version of that package was on the FreeBSD machine when i compiled libtorrent, cant remember what the name of the package was, but I remember that i fixed it easy, you might have to replace several,

wow i just loved Free*BSD when that happend, Im very new to the *BSD operating system, and to be honest so far it has been a pain in the ass, but love ZFS, and N4F ofc :)

EDIT: if you want more details on all the commands i did for applying the fix, I could write it here, but at the time of writing iam (was) tired, and i uploaded i fix so i thought it would be unnecessary

EDIT2: You will need another 2 packages that i forgot to upload, the pkg_conf package was the packages that needed to be replaced, the one i forgot about.
Anyhow here is the links for all package files required.

libtorrent-0.13.2.tbz
https://www.dropbox.com/s/un7np6yrpfnvp ... 0.13.2.tbz
libsigc++-2.2.10.tbz
https://www.dropbox.com/s/b05ra0m2jzst5 ... 2.2.10.tbz
pkgconf-0.8.9.tbz
https://www.dropbox.com/s/9utwdcil32e8q ... -0.8.9.tbz
Last edited by Babovand on 18 Oct 2012 06:20, edited 1 time in total.

cp.engr
Starter
Starter
Posts: 22
Joined: 09 Jul 2012 03:55
Status: Offline

Re: ruTorrent extension?

Post by cp.engr »

Babovand wrote:
cp.engr wrote:CPU usage does go kinda high sometimes, like 90% - 99% sometimes while downloading. Babovand, please let us know what you did to resolve this issue.
I thought i was the only one that had the problem, did'nt know!
Just to be clear, it's not all the time for me, but sometimes.
Babovand wrote:It was quite complicated but I can explain what I did.
I downloaded FreeBSD 9.0 and installed it in a virtual machine, then i downloaded the source to the libtorrent port using make extract, edited the source code myself with a fix that was applied in the link about the issue, this fix has not yet been added by the developer, (https://github.com/Yamagi/libtorrent/co ... 7fcd264c53), when I was done i did make build (for compile the "new" libtorrent", then make install (to install it), after the install was complete I made a package file (pkg_create) and uploaded the package to my N4F machine and installed it with pkg_add.
Is the file you uploaded a package, or a port? I thought that packages are binaries, and that ports are source...but inside the tarball I see both.
Babovand wrote:Anyhow...i uploaded the fixed libtorrent here on dropbox so you can just upload it yourself and pkg_add it to your system :D
https://www.dropbox.com/s/un7np6yrpfnvp ... 0.13.2.tbz
Will the file you posted also work on NAS4Free 64-bit 9.1.0.1 - Sandstorm (revision 344) / FreeBSD 9.1-RC2 (reldate 901000)? Or is the patch even already included there?
Babovand wrote:And btw it might fail for you due to a package that is installed in N4F that is old, just replace this package with the version that it demands or higher, this occurred because the newer version of that package was on the FreeBSD machine when i compiled libtorrent, cant remember what the name of the package was, but I remember that i fixed it easy, you might have to replace several,

wow i just loved Free*BSD when that happend, Im very new to the *BSD operating system, and to be honest so far it has been a pain in the ass, but love ZFS, and N4F ofc :)
Thanks for sharing.
Babovand wrote:EDIT: if you want more details on all the commands i did for applying the fix, I could write it here, but at the time of writing iam (was) tired, and i uploaded i fix so i thought it would be unnecessary
I'm interested in learning some more, if it's not much trouble for you to share some of the details.

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

Just to be clear, it's not all the time for me, but sometimes.
The high CPU issue only kicks in when downloading/uploading a torrent, even at low speeds the CPU will get high usage, try and you will see.
Is the file you uploaded a package, or a port? I thought that packages are binaries, and that ports are source...but inside the tarball I see both.
Only packages can be installed with pkg_add, so yes its a package :p, the package is created from a port (like all packages are), the libtorrent (port) source code.
The inside of the tarball is not the package, the tarball itself IS the package!
( pkg_add libtorrent-0.13.2.tbz ) is the command to install libtorrent, libtorrent-0.13.2.tbz being the file I posted.
Will the file you posted also work on NAS4Free 64-bit 9.1.0.1 - Sandstorm (revision 344) / FreeBSD 9.1-RC2 (reldate 901000)? Or is the patch even already included there?
I would'nt have uploaded it if it was not included :D
The libtorrent program/package dosen't care which version of FreeBSD that its using, no package/port/porgram does, as long as the operating system can support the functions of the program, and yes it will work as Iam using it myself at the moment with NAS4Free 64-bit 9.1.0.1 - Sandstorm (revision 344).

The file i posted is a compiled package with the patch included (compiled) so you or anyone else don't have to download the port, edit the source code, then compile it, and then create a package, the work is alredy done (by me :p), just add the package and you will have the fixed libtorrent
I'm interested in learning some more, if it's not much trouble for you to share some of the details.
Okey, will do this soon :)

Babovand
Starter
Starter
Posts: 46
Joined: 23 Jun 2012 16:25
Status: Offline

Re: ruTorrent extension?

Post by Babovand »

cp.engr wrote:
Babovand wrote:EDIT: if you want more details on all the commands i did for applying the fix, I could write it here, but at the time of writing iam (was) tired, and i uploaded i fix so i thought it would be unnecessary
I'm interested in learning some more, if it's not much trouble for you to share some of the details.
For this to work you need FreeBSD 9.0 or 9.1 dont matter , installed in a real machine or vmware/virtualbox, 15GB space minimum, just to be safe.(not Nas4Free, the real FreeBSD 9.0/9.1 operating system)

Okey after you have installed it, you need to download and upgrade the ports, this will take alot of time, so go do some coffee or tea while you wait.

Code: Select all


portsnap fetch
portsnap extract
portsnap update
Do fetch, wait for it to complete, then do extract, then update. in order.

now cd into the libtorrent port directory and download the source code using make extract.

Code: Select all

cd /usr/ports/net-p2p/libtorrent
make extract
a new folder has now been created in the libtorrent port folder, the name of the folder is work, and inside it is another folder named libtorrent-0.13.2 here is the source code.
here you can edit the source code, i will not go in detail on how to do this, i used nano and edited the right file with the patch that i've linked before.

Code: Select all

cd /work/libtorrent-0.13.2
When you are done editing the source code, cd back to the first liborrent folder and use make build to compile the porgram with our new source code that we edited. This will also take alot of time. if a screen appears with alot of options, just hit enter, this is the default settings.

Code: Select all

cd /usr/ports/net-p2p/libtorrent
make build
When thats done, do make install to install the port to your system with your now edited compiled source code.

Code: Select all

make install
now do

Code: Select all

pkg_info
This will show what packages/ports are installed in the system, and hopefully you will see libtorrent in the list. Lets create a package of the custom libtorrent we just made!

Code: Select all

pkg_create -Rb libtorrent-0.13.2_1
now do ls and you will see that a new file is in the current folder, libtorrent-0.13.2.tbz, libsigc++-2.2.10.tbz, pkg_conf-0.8.9. the option -Rb creates all packages that libtorrent needs, i just noticed it and will also upload these, check earlier post, the pkg_conf package is old in N4F (that was the package that needed to be replaced, just add it with pkg_add)

Code: Select all

ls
This file is now a package from the port (that we edited with the fix) and can now be installed on N4F or any other FreeBSD machine with the pkg_add command.
If you have edited the source code exactly as i did, you will now have the same package tarball as i've alredy uploaded, and this method works with any port/program.

If packages did'nt exist, we all would have to compile each program and install them, and if its a slow machine it could take forever just to install a couple of programs. with package, this process becomes almost instant.

Now transfer your new package file with SFTP/FTP/USB whatever you want to use, to the machine you want to install libtorrent on.

Post Reply

Return to “Extensions / Add-ons”