Run rtorrent in a Docker container

Ok, So i’ve been using rtorrent with OSMC for quite some time, more specifically I’ve installed it using this script.

I recently upgraded to RPI 3 B+ and learned that that script isn’t beeing maintained anymore, so now I can’t install rtorrent using that method anymore and since the dev of the script is redirecting to his docker container, I thought I’d try that instead.

I think I successfully installed docker using the instructions posted here. and I can successfully run the hello-world example container;

osmc@Sovrum:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
61ddb93a5f93: Pull complete
Digest: sha256:f5233545e43561214ca4891fd1157e1c3c563316ed8e237750d59bde73361e77
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(arm32v5)
 3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

but I can’t seem to get any life into the kerwood/rtorrent-lxc container.

osmc@Sovrum:~$ sudo docker run --name rtorrent -v /home/osmc/Downloads:/downloads -p 8181:80 -p51121:51121 -d kerwood/rtorrent-lxc
Unable to find image 'kerwood/rtorrent-lxc:latest' locally
latest: Pulling from kerwood/rtorrent-lxc
3d77ce4481b1: Pull complete
a50557b9db64: Pull complete
199a192b00aa: Pull complete
dc2f12a7312e: Pull complete
f8e06d831565: Pull complete
3fa168a22f36: Pull complete
9c30e1687226: Pull complete
ec3949e0cf27: Pull complete
c6842e0a292d: Pull complete
1a980bea8927: Pull complete
def2e01ef2d3: Pull complete
118f88be7507: Pull complete
fa350d88a82e: Pull complete
Digest: sha256:33f4c5992a8f58225a26a3a7b3c48a7afe0ae9fbafdb79c881933565e16e3ca7
Status: Downloaded newer image for kerwood/rtorrent-lxc:latest
c453b27c2b6fd28d5a461b38e55dc35fa30ed334f579e7a8fd56986f2599f303
`

I can’t access rutorrent web server on http://ip:8181. I know I’m probably doing something wrong, but what?

Try enter the container and check netstat to see if the container is running.

Why is Docker a requirement?

I obviously have no idea what I’m doing :stuck_out_tongue_winking_eye:

osmc@Sovrum:~$ sudo docker run --name rtorrent     -v /home/osmc/Downloads:/downloads     -e RTORRENT_PORT=52002-52002     -p 52002:52002     -p 8181:80  -d kerwood/rtorrent-lxc
docker: Error response from daemon: Conflict. The container name "/rtorrent" is already in use by container "c453b27c2b6fd28d5a461b38e55dc35fa30ed334f579e7a8fd56986f2599f303". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
osmc@Sovrum:~$ sudo docker run -d kerwood/rtorrent-lxc
def51c4d029904dbb2f813ce3880bc1d757a0df1bed3af785e0ab1d2e2401707
osmc@Sovrum:~$ sudo docker ps -a
CONTAINER ID        IMAGE                  COMMAND             CREATED             STATUS                         PORTS               NAMES
def51c4d0299        kerwood/rtorrent-lxc   "/startup.sh"       27 seconds ago      Exited (1) 23 seconds ago                          dreamy_perlman
c453b27c2b6f        kerwood/rtorrent-lxc   "/startup.sh"       About an hour ago   Exited (1) 33 minutes ago                          rtorrent
97ccc370933b        hello-world            "/hello"            About an hour ago   Exited (0) About an hour ago                       compassionate_bose
e86ecf8993ba        armhf/hello-world      "/hello"            2 days ago          Exited (0) 2 days ago                              angry_lumiere
osmc@Sovrum:~$ 

Well Docker isn’t really a requirement for me, I just think it’s to much fuzz to install rtorrent+rutorrent without the script referred to earlier. The script worked fine on earlier versions of OSMC, but since I can’t go back to any earlier versions with the rpi 3B+ I thought I’d try using Docker instead. I like the idea of containers, but I obviously don’t know how to use them :-/

Just a question, why not use the deb-package of rtorrent? and flood (need node.js, but that wasn’t hard to install)

Yeah sure, didn’t know about that. Is rutorrent included? Because if I remember it correctly, rutorrent was a pain to install (years ago, raspbmc time I think)

yeah rutorrent is a pain, that’s why i went with flood (https://github.com/jfurrow/flood)
all you had to do was install node.js (newer then the one that comes with stretch) How to Install NodeJS on Debian 9 Stretch Linux - LinuxConfig.org

Took a while but i’m more happy with flood then I ever was with rutorrent.

Thanks! I’ll give it a go and make sure to post back here :+1:

Ok, so rtorrent is installed and up and running, I can use it with screen.

Installed node.js without issues

installed node-gyp as that seems to be needed now aswell

currently stuck(?) at “extracting” XMLRCP after issuing the sudo npm i --unsafe-perm command
It’s been stuck at this for about 30 mins maybe… I’ll let it sit while I go do other stuff and hopefully be able to come back to see it finished so that I can continue

osmc@Sovrum:~/Flood$ ls
flood-master  master.zip
osmc@Sovrum:~/Flood$ rm master.zip 
osmc@Sovrum:~/Flood$ ls
flood-master
osmc@Sovrum:~/Flood$ ls -lah
totalt 12K
drwxr-xr-x  3 osmc osmc 4,0K jun 27 18:52 .
drwxr-xr-x 11 osmc osmc 4,0K jun 27 18:51 ..
drwxr-xr-x  6 osmc osmc 4,0K maj 21 01:02 flood-master
osmc@Sovrum:~/Flood$ cd flood-master/
osmc@Sovrum:~/Flood/flood-master$ ls
CHANGELOG.md  CODE_OF_CONDUCT.md  config.template.js  flood.png  package.json       README.md  shared
client        config.docker.js    Dockerfile          LICENSE    package-lock.json  server
osmc@Sovrum:~/Flood/flood-master$ mv config.template.js config.js
osmc@Sovrum:~/Flood/flood-master$ nano config.js 
osmc@Sovrum:~/Flood/flood-master$ nano /home/osmc/.rtorrent.rc 
osmc@Sovrum:~/Flood/flood-master$ nano config.js 
osmc@Sovrum:~/Flood/flood-master$ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> 
KeyboardInterrupt
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> 
osmc@Sovrum:~/Flood/flood-master$ ls
CHANGELOG.md  CODE_OF_CONDUCT.md  config.js   flood.png  package.json       README.md  shared
client        config.docker.js    Dockerfile  LICENSE    package-lock.json  server
osmc@Sovrum:~/Flood/flood-master$ sudo npm i --unsafe-perm
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! 
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
[              ....] - extract:xmlrpc: sill doParallel extract 1838

Have you installed build essentials?
sudo apt-get install build-essential

Hmm… well I haven’t at the time, but I did after your post and tried the command again, and it’s got stuck again…

I’ll try rebooting and making sure rtorrent isn’t running… maybe that’s whats causing the problem?

Ok, so I finally managed to get it to finish, had to ‘sudo systemctl stop mediacenter’ otherwise the system either hanged or crashed.

Unfortunately build is failing, any idea why?

osmc@Sovrum:~/Flood/flood-master$ sudo npm i --unsafe-perm                 
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump                                                              npm WARN prefer global node-gyp@3.7.0 should be installed with -g
> argon2@0.19.3 install /home/osmc/Flood/flood-master/node_modules/argon2  > node-gyp rebuild                                                         

    osmc@Sovrum:~/Flood/flood-master$ sudo npm run build

    > flood@1.0.0 build /home/osmc/Flood/flood-master
    > node client/scripts/build.js

    Creating an optimized production build...
    Failed to compile.

    ./client/src/sass/style.scss
    Module build failed: Error: Node Sass does not yet support your current environment: Linux Unsupported architecture (arm) with Node.js 6.x
    For more information on which environments are supported please see:
    https://github.com/sass/node-sass/releases/tag/v4.9.0

    ./client/src/sass/style.scss
    Module build failed: ModuleBuildError: Module build failed: Error: Node Sass does not yet support your current environment: Linux Unsupported architecture (arm) with Node.js 6.x
    For more information on which environments are supported please see:
    https://github.com/sass/node-sass/releases/tag/v4.9.0


    npm ERR! Linux 4.14.26-2-osmc
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
    npm ERR! node v6.14.3
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE
    npm ERR! flood@1.0.0 build: `node client/scripts/build.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the flood@1.0.0 build script 'node client/scripts/build.js'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the flood package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node client/scripts/build.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs flood
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls flood
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/osmc/Flood/flood-master/npm-debug.log
    osmc@Sovrum:~/Flood/flood-master$

Edit:

osmc@Sovrum:~/Flood/flood-master$ node --version
v6.14.3
osmc@Sovrum:~/Flood/flood-master$ npm --version
3.10.10
osmc@Sovrum:~/Flood/flood-master$

Edit 2:
Rebooted and tried again, seems to me like the process is to resource heavy for the Pi, and gets killed?

osmc@Sovrum:~/Flood/flood-master$ sudo npm run build

> flood@1.0.0 build /home/osmc/Flood/flood-master
> node client/scripts/build.js

Creating an optimized production build...
Killed

npm ERR! Linux 4.14.26-2-osmc
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! flood@1.0.0 build: `node client/scripts/build.js`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the flood@1.0.0 build script 'node client/scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the flood package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node client/scripts/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs flood
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls flood
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/osmc/Flood/flood-master/npm-debug.log
osmc@Sovrum:~/Flood/flood-master$

strange, i just remember it being simple, might be an update to node or flood. Will try to set it up on another machine and make a how to for you.

Wow thanks, but don’t bother quite yet. I just successfully compiled it. I was missing some dependencies (node-sass, npm make) and now it finished fast.

I’m at work atm, but I’ll try to get it started when I get the chance and get back to yoy

Still no luck…

Fired up rtorrent and tried starting flood but I end up getting this message

osmc@Sovrum:~/Flood/flood-master$ sudo npm run build

> flood@1.0.0 build /home/osmc/Flood/flood-master
> node client/scripts/build.js

Creating an optimized production build...
DEPRECATION WARNING on line 1, column 8 of stdin:
Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.
Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.

DEPRECATION WARNING on line 1, column 8 of stdin:
Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.
Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.

Compiled successfully.

File sizes after gzip:

  401.54 KB  assets/static/js/main.6c7e340a.js
  16.26 KB   assets/static/css/main.7debea69.css
osmc@Sovrum:~/Flood/flood-master$ npm start

> flood@1.0.0 start /home/osmc/Flood/flood-master
> node server/bin/start.js

Failed to start web server:
Error: Could not locate the bindings file. Tried:
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/out/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/out/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/default/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/compiled/6.14.3/linux/arm/argon2.node

npm ERR! Linux 4.14.26-2-osmc
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! flood@1.0.0 start: `node server/bin/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the flood@1.0.0 start script 'node server/bin/start.js'.npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the flood package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server/bin/start.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs flood
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls flood
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/osmc/Flood/flood-master/npm-debug.log
osmc@Sovrum:~/Flood/flood-master$ sudo npm start

> flood@1.0.0 start /home/osmc/Flood/flood-master
> node server/bin/start.js

Failed to start web server:
Error: Could not locate the bindings file. Tried:
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/out/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/Debug/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/out/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/Release/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/build/default/argon2.node
 → /home/osmc/Flood/flood-master/node_modules/argon2/compiled/6.14.3/linux/arm/argon2.node

npm ERR! Linux 4.14.26-2-osmc
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! flood@1.0.0 start: `node server/bin/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the flood@1.0.0 start script 'node server/bin/start.js'.npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the flood package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server/bin/start.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs flood
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls flood
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/osmc/Flood/flood-master/npm-debug.log
osmc@Sovrum:~/Flood/flood-master$

As I said, I will try to make an installation after this weekend. And hopefully get a howto out of that. Have a nice weekend

Here is a small how to install rTorrent + Flood(web UI):

sudo apt-get update
sudo apt-get install build-essential libssl-dev screen rtorrent git
rtorrent

Go to this page: Download | Node.js

and copy the direct link for armv7 download. Open another ssh sesion

wget [the link you copied]
tar -xvf [downloaded-filename]
cd [node-version-info-from-your-download]
rm CHANGELOG.md
rm LICENSE
rm README.md
sudo cp -R * /usr/
cd ~/
sudo npm install -g node-gyp
git clone https://github.com/Flood-UI/flood.git
cd flood
mv config.template.js config.js
nano config.js

What to configure

  1. Be sure to create a long and unique secret (bottom of the file)
  2. Change floodServerHost: to the local-network ip of your machine (192.168.0.123)

CTRL+x, y to save the changes

npm install

This will take a while

npm run build

Another time consuming process then we do a test start of flood

npm start

Now it’s time to configure flood for where to find you rTorrent client. So lets go:
http://[ip of your flood installation]:[port you chose in config.js]

  • Name and password is for authenticating you on later page visits
  • rTorrent IP is self explanatory
  • Port is the scgi port (default is 5000 i think)

Back to ssh and CTRL+c to close flood.
Time to close rTorrent again, change to your first ssh-session and CTRL+q
Now you can close the session that had rTorrent running.

Now we can start rTorrent in the background of the still open ssh session.

screen -S rtorrent
rtorrent

CTRL+a d (to detach the screen)

screen -S Flood
cd flood
npm start

To reattach the detached screens, use this command:

screen -r Flood

or

screen -r rtorrent

The issue i had was that there was no .rtrrrent.rc and .rtorrent-session/ after starting rtorrent. I had to copy a working .rtorrent.rc file from another machine and mkdir .rtorrent-session, mkdir the download directory, else flood webinterface would lock while searching for rtorrent process. So I made the needed directorys and copied a .rtorrent.rc and restarted flood and everything worked.

If you need help auto starting these when your OSMC device restarts, look a few post later in this thread.

2 Likes

Wow, thanks @joakim_s

Will make sure to try this tonight when I get home from work. I’ll do a fresh install of OSMC before I try this.

I have my old rtorrent.rc file I’d like to use and all my rtorrent associated folders and files are on a remote nfs mount, but that shouldn’t be a problem I guess.

I’ll make sure to report back here when done.

Thanks again!
Cheers

Awesome @joakim_s ! really easy to follow and everything worked perfectly, a BIG thank you to you!!

Flood looks absolutely stunning!

Any ability to add plugins like rutorrent? Really missing the ability to add/remove trackers. Saw that there was an issue already open on the topic over at github.

I would have never, ever managed to install Flood without your help :slight_smile:
I would love some help with autostarting flood+rtorrent.

Tack bror :beers:

Wow, I have been using Transmission for years and wanted to switch to Rtorrent but always considered it to be too much of a hassle, especially because the webUI needs stuff like Apache and PHP.
You have made it soo tempting to switch! A simple guide installing rtorrent+Flood. I will definitely do this tomorrow and start modifying my Flexget config to work with rtorrent.

Hope the OSMC App Store will get some dev attention as this seems to be a good candidate for the Store :slight_smile:

edit: perhaps this post could be moved to the HowTo section of the forum?

How would we modularise this? If Apache is already installed, what should we do?

Sam