From The World according to Vissie
Jump to navigation Jump to search


I will do my notes here on how to get and maintain rtorrent-PS. It took me some time to get my head around this.


I THINK I used this last time. Lets say I did.

Create ansible account on box

On Debian strech:

sudo apt-get install dirmngr --install-recommends

Install ansible

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install ansible

I had to install autoconf first

sudo apt-get install autoconf

Become ansible

Checkout the code

which git || sudo apt-get install git
mkdir -p ~/src; cd $_
git clone "https://github.com/pyroscope/pimp-my-box.git"
cd "pimp-my-box"

I had issues with pycrypto not wanting to install:

source ~/.local/venvs/ansible/bin/acativate
mkdir /home/$USER/tmp
pip install pycrypto

Become root

groupadd $account
useradd -g $account -G $account,users -c "Ansible remote user" -s /bin/bash --create-home $account
eval chmod 0750 ~$account
passwd -l $account


vim: /home/rtorrent/rtorrent/_rtlocal.rc
throttle.global_down.max_rate.set_kb = 0
throttle.global_up.max_rate.set_kb = 0

# Set the max amount of memory address space used to mapping file chunks. This refers to memory mapping, not
#  physical memory allocation. Default: `1GB` (`max_memory_usage`) 
# This may also be set using ulimit -m where 3/4 will be allocated to file chunks.
pieces.memory.max.set = 5120M

# Maximum number of connections rtorrent can accept/make (`sockets`)
network.max_open_sockets.set = 999

# Maximum number of open files rtorrent can keep open (you have to modify the system wide settings with ulimit!) (`set_max_open_files`)
network.max_open_files.set = 6000

# Maximum number of simultaneous HTTP request (used by announce or scrape requests) Default: `32` (`set_max_open_http`)
network.http.max_open.set = 640

# Maximum and minimum number of peers to connect to per torrent.
min_peers = 1
max_peers = 150

# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = 1
max_peers_seed = 50

# Maximum number of simultanious uploads per torrent.
max_uploads = 20

# Maximum number of simultaneous downloads
max_downloads_global = 100
max_uploads_global = 300

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 0

# Change the limits, the defaults should be sufficient.

schedule2 = watch_plex_tv, 10, 10, "load.start=~/rtorrent/watch/plex/tv_show/*.torrent,d.directory.set=/data/plex/TVShow/,d.delete_tied="
schedule2 = watch_plex_movie, 10, 10, "load.start=~/rtorrent/watch/plex/movie/*.torrent,d.directory.set=/data/plex/Movies/,d.delete_tied="
schedule2 = watch_ratio_ipt, 10, 10, "load.start=~/rtorrent/watch/ratio/ipt/*.torrent,d.directory.set=~/rtorrent/ratio/IPT/,d.delete_tied="
schedule2 = watch_ratio_phd, 10, 10, "load.start=~/rtorrent/watch/ratio/phd/*.torrent,d.directory.set=~/rtorrent/ratio/PHD/,d.delete_tied="
schedule2 = watch_ratio_tday, 10, 10, "load.start=~/rtorrent/watch/ratio/tday/*.torrent,d.directory.set=~/rtorrent/ratio/TDay/,d.delete_tied="
schedule2 = watch_dwl_neo, 10, 10, "load.start=~/rtorrent/watch/dwl/neo/*.torrent,d.directory.set=/data/dwl/Neo/,d.delete_tied="
schedule2 = watch_dwl_spa, 10, 10, "load.start=~/rtorrent/watch/dwl/spa/*.torrent,d.directory.set=/data/dwl/SPa/,d.delete_tied="

I had to install php 5.6

sudo apt-get install apt-transport-https lsb-release ca-certificates
curl https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list


sudo vim /etc/apt/sources.list.d/php.list
deb https://packages.sury.org/php/ stretch main
apt-get update
apt-get install php5.6
vim: /./roles/rutorrent/vars/os_default.yml
php_version: 5.6
php_etc_dir: php/5.6
php_apcu: php5.6-opcache

When in dougt....

sudo systemctl restart php5.6-fpm.service

To understand the GUI better here is a explanation:


If you keen, the manual.


Some nice tipes on getting data out of rtorrent and conky and scrips etc.


Lets try and have this in a semi chronological order.


I had issues. What solved them for me was to have en_US-UTF-8 to make my glyphs show up.

sudo apt-get install locales
sudo dpkg-reconfigure locales

You'll see a long list of locales, and you can navigate that list with the up/down arrow keys. Pressing the space bar toggles the locale under the cursor. Make sure to select at least one UTF-8 locale, for example en_US-UTF-8 is usually supported very well. (The first part of the locale name stands for the language, the second for the country or dialect, and the third for the character encoding).

In the next step you have the option to make one of the previously selected locales the default. Picking a default UTF-8 locale as default is usually a good idea, though it might change how some programs work, and thus shouldn't be done servers hosting sensitive applications.

Most of the time it works to set all of these to the same value. Instead of setting all LC_ variables separately, you can set the LC_ALL. If you use bash as your shell, you can put these lines in your ~/.bashrc and ~/.profile files:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8

To make these changes active in the current shell, source the .bashrc:

source ~/.bashrc

Locales: check Run the locale program. The output should be similar to this:


If not you've made a mistake in one of the previous steps, and need to recheck what you did.

Activating bash completion

To add pyrocore‘s completion definitions to your shell, call these commands:

sudo apt-get install bash-completion
pyroadmin --create-config
touch ~/.bash_completion
grep /\.pyroscope/ ~/.bash_completion >/dev/null || \
    echo >>.bash_completion ". ~/.pyroscope/bash-completion.default"
   . /etc/bash_completion

Make sure your path is set correctly

Firstly, check your original path:

echo $PATH

It should show something like this:


Now add your program to that path, ensuring your using the entire path all the way from / to your program.

export PATH=$PATH:/path/to/my/program

Add this line to ~/.bashrc (you use PATH rather then CONFIG_PATH)

export PATH=$PATH:/path/to_directory_containing_program
export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/

Environment variables should be set in either ~/.pam_environment or ~/.profile, not ~/.bashrc.


Vim may mistake the syntax of the config file, causing errors in the highlighting. To resolve this you can append a modeline # vim: set syntax=conf: to ~/.rtorrent.rc.

Maybe a syntax file



The screen program can work with UTF-8 if you tell it to.

The easiest (and sometimes the only) way is to start it with the -U option:

screen -U

and also when detaching (screen -Urd or so).

Inside a running screen you can try Ctrl+a :utf8 on<return>. If that doesn't work, exit your screen and start a new one with -U

Some usability options


mktor creates *.torrent files (metafiles), given the path to a file, directory, or named pipe (more on that below) and a tracker URL or alias name (see UserConfiguration on how to define them). Optionally, you can also set an additional comment and a different name for the resulting torrent file. Peer exchange and DHT can be disabled by using the --private option.


lstor lists the contents of bittorrent metafiles. The resulting output looks like this:

NAME pavement.torrent
SIZE 3.6 KiB (0 * 32.0 KiB + 3.6 KiB)
HASH 2D1A7E443D23907E5118FA4A1065CCA191D62C0B
URL  http://example.com/
PRV  NO (DHT/PEX enabled)
TIME 2009-06-06 00:49:52
BY   PyroScope 0.1.1
pavement.py                                                             3.6 KiB

screen settings

Maybe I can use this in my screen?

For example, the command rtcontrol up=+0 up=-10k will list all torrents that are currently uploading any data, but at a rate of below 10 KiB/s. See the ‘rtcontrol’ Examples for more real-world examples, and the following section on basics regarding the filter conditions.


deb 9 setup guide


older notes

This is a good start to get "normal" colour in your rtorrent.


Pimp by box

If ruTorrent give error, try this:


vim: /etc/php5/fpm/pool.d/www.conf
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
# /etc/init.d/php-fpm restart

If you get "FAILED => Missing become password”

The problem is related to sudo. In /etc/ansible/ansible.cfg there is a commented out setting called ask_sudo_pass which needs to be uncommented out and set to Yes. Alternatively you can set the group the user belongs to to be able to use sudo without a password, but that's a security risk in my opinion.


~/bin$ vim ./_event.download.finished-log.sh