You are not logged in.
Hi.
I've moved my rTorrent storage directory to external drive and despite everything seem to work (I can download and upload) there is one problem...
When I start rTorrent (configured as tmux service) and my external drive is not mounted, then I have to restart rTorrent having storage directory mounted (it's obvious). But is strange for me is that rTorrent starts to download everything from the very beginning while actually files on disk have already their final size. I noticed that triggering hash recheck helps (after recheck is done I can simply seed my torrents) - but it's not so cool to trigger hash recheck every time on 100 GB of files.
.rtorrent.rc
# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.
# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
#max_peers = 100
# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
#max_peers_seed = 50
# Maximum number of simultanious uploads per torrent.
#max_uploads = 15
max_downloads_global = 3
max_uploads_global = 30
# Global upload and download rate in KiB. "0" for unlimited.
#download_rate = 0
#upload_rate = 0
# Default directory to save the downloaded torrents.
directory = /home/kuba/torrents
# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/kuba/.session
# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=./watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=200M
# The ip address reported to the tracker.
#ip = 127.0.0.1
#ip = rakshasa.no
# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no
# Port range to use for listening.
#port_range = 6890-6999
port_range = 49164-49164
# Start opening ports at a random position within the port range.
#port_random = no
# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
#check_hash = no
# Set whether the client should try to connect to UDP trackers.
#use_udp_trackers = yes
# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa
# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
# encryption = allow_incoming,enable_retry,prefer_plaintext
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
# dht = auto
# UDP port to use for DHT.
#
# dht_port = 6881
# Enable peer exchange (for torrents not marked private)
#
# peer_exchange = yes
color_inactive_fg = 4
color_dead_fg = 1
color_active_fg = 3
color_finished_fg = 2rt@.service
[Unit]
Description=rTorrent
Requires=network.target local-fs.target
[Service]
Type=forking
KillMode=none
User=%I
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
WorkingDirectory=/home/%I/
Restart=on-failure
[Install]
WantedBy=multi-user.targetstorage directory as symlink from home dir
lrwxrwxrwx 1 kuba users 41 02-22 22:03 torrents -> /run/media/kuba/ExtStorage/stuff/torrents/lsblk
sdb 8:16 0 298,1G 0 disk
├─sdb1 8:17 0 40G 0 part
├─sdb2 8:18 0 4G 0 part
└─sdb3 8:19 0 254,1G 0 part /run/media/kuba/ExtStorageLast edited by jakub (2015-02-23 22:18:50)
Offline
This sounds like rtorrent (or its library) not having support for checking pre-downloaded files before writing to them (unless done manually). It's actually the case for all linux torrent clients I know, sadly. I'm having a similar issue with qBittorrent, where it silently overwrites files unless you use the "import torrent" dialog.
So it'd be best to file a bug/feature request upstream.
[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]
Offline
And while you're waiting for the fix, make your rt.service wait until the drive is mounted before starting.
Offline
And how to achieve this? is simple
cd storage_directory &&...in front of ExecStart enough or it's too primitive? (if such approach it's fine it would be better to create simple script which can read directory from .rtorrent.rc)
Offline
And how to achieve this?
Make it dependent on the relevant .mount unit.
systemctl list-units --all "*.mount"Edit: added '--all' in case relevant unit is inactive.
Last edited by alphaniner (2015-02-23 22:10:01)
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
Great hint. Works really well. Now rTorrent service is not starting when storage directory is not mounted thus no hash rechecking is required. It helps a lot. So only nice thing to have now would be to add the service autostart in case the .mount unit is active (changes state from inactive to active actually, which will happen when I turned on my laptop without having USB drive connected / fstab configured)
if anyone wants to know how final rt@.service looks like, this it the file:
[Unit]
Description=rTorrent
Requires=network.target local-fs.target run-media-kuba-ExtStorage.mount
[Service]
Type=forking
KillMode=none
User=%I
ExecStart=/usr/bin/tmux new-session -s rt -n rtorrent -d rtorrent
ExecStop=/usr/bin/tmux send-keys -t rt:rtorrent C-q
WorkingDirectory=/home/%I/
Restart=on-failure
[Install]
WantedBy=multi-user.targetLast edited by jakub (2015-02-23 22:18:29)
Offline
There is one more question. After rebooting machine (reboot on console) I had to rerun hash check on all my downloaded torrents. So it seems like I have to turn off rtorrent before shutting down / rebooting system. Does systemctl stop rt@<user> shut down rtorrent nicely enough to get rid of hash recheck requirement?
I'm confused right now because I haven't seen such problem after doing reboots while I was storing torrents on internal drive. Is it possible that the problem is related to order in which system unmounts drive and shuts down rTorrent service?
Last edited by jakub (2015-03-09 22:04:22)
Offline
Ahhh... I still can't working solution
I tried systemctl stop rt@... before shutting down my machine, but after restart when I run rTorrent all my torrents have "Inactive: Download registered as completed, bu hash check returned unfinished chunks" annotation and I have to rerun hash check anyway.
Offline
You're probably going to have to do some testing to figure out the point of failure. First, check past boots in the journal and see if everything is happening according to plan at shutdown. If so, maybe the problem occurs before that. Without shutting down, try stopping the service and manually starting rtorrent, restarting the service with systemctl restart, restarting the service with systemctl stop;systemctl start, etc.
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline