rtorrent running but can't connect to ruTorrent

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
MichaIng
Site Admin
Posts: 2262
Joined: Sat Nov 18, 2017 6:21 pm

Re: rtorrent running but can't connect to ruTorrent

Post by MichaIng »

Will try to replicate. Which webserver do you use? Default Lighttpd?
Chester007
Posts: 32
Joined: Sat Mar 04, 2017 3:57 pm

Re: rtorrent running but can't connect to ruTorrent

Post by Chester007 »

Yes, default. Tried on two separate freshly installed DietPi
User avatar
MichaIng
Site Admin
Posts: 2262
Joined: Sat Nov 18, 2017 6:21 pm

Re: rtorrent running but can't connect to ruTorrent

Post by MichaIng »

Test with Lighttpd: Fresh install works well, ruTorrent connects automatically.

ruTorrent config.php contains:
$scgi_port = 5000;
$scgi_host = "127.0.0.1";

which matches the default rTorrent .rtorrent.rc:
scgi_port = 127.0.0.1:5000

Hostname should not play a role. However testing to change hostname via dietpi-config + reboot:
... found it:

Code: Select all

root@VM-Stretch:~# sudo -u rtorrent rtorrent
rtorrent: Could not lock session directory: "/mnt/dietpi_userdata/downloads/.session/", held by "DietPi:+17696".
root@VM-Stretch:~# rm /mnt/dietpi_userdata/downloads/.session/rtorrent.lock
root@VM-Stretch:~# systemctl restart rtorrent
root@VM-Stretch:~# cat /mnt/dietpi_userdata/downloads/.session/rtorrent.lock
VM-Stretch:+1341
root@VM-Stretch:~# systemctl status rtorrent
● rtorrent.service - rTorrent (DietPi)
   Loaded: loaded (/etc/systemd/system/rtorrent.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-04-04 18:29:03 CEST; 2s ago
  Process: 1352 ExecStop=/usr/bin/screen -S rtorrent -X quit (code=exited, status=0/SUCCESS)
  Process: 1355 ExecStart=/usr/bin/screen -fa -dmS rtorrent /usr/bin/rtorrent (code=exited, status=0/SUCCESS)
 Main PID: 1356 (screen)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/rtorrent.service
           ├─1356 /usr/bin/SCREEN -fa -dmS rtorrent /usr/bin/rtorrent
           └─1357 /usr/bin/rtorrent

Apr 04 18:29:03 VM-Stretch systemd[1]: Starting rTorrent (DietPi)...
Apr 04 18:29:03 VM-Stretch systemd[1]: Started rTorrent (DietPi).
So the session lock is done based on hostname. When changing the hostname this lock needs to be removed to allow rTorrent creating a new lock with new hostname.

So again from above the solution is:

Code: Select all

rm /mnt/dietpi_userdata/downloads/.session/rtorrent.lock
systemctl restart rtorrent
@Chester007
Very good find! I added this to our docs to hopefully prevent other users running into this: viewtopic.php?p=2603#p2603
Would be great of rTorrent could print a meaningful error messages when running into this. It does when running it from terminal directly, but I guess it is a bid complicated through the systemd unit and the screen session below. The systemd unit creates output to the journal by default (journalctl and systemctl status rtorrent) but since the process is running inside a screen session again (and the screen process does not forward internal output reasonable), those messages do not reach somewhere. This should be handled way better with the new rTorrent internal daemon mode that allows to run it as daemon outside of a screen/tmux session. But this is new with version 0.9.7 and Debian Stretch still ships 0.9.6:
- https://github.com/rakshasa/rtorrent/wiki/Daemon_Mode
- https://packages.debian.org/de/stretch/rtorrent
Post Reply