Find Corrupted Torrents
This guide will cover how to find and remove a corrupted torrent in your torrent client. Occasionally, a torrent can become corrupted and cause your torrent client to crash. This can be somewhat complicated to troubleshoot and diagnose, as there are many reasons for why a torrent client might crash.
Before we begin, let's introduce the available torrent clients, their strengths, and weaknesses. The information below will help you decide what torrent client to use. Please note that the below characteristics are highly subjective and may not align with your specific use case. The number of torrents listed is are soft limits.
- Deluge - Unstable and fast downloading, with a limit of 100 torrents for v1 and 2000 torrents for v2
- qBittorrent - Stable and fast seeding, with a limit of 10K torrents
- rTorrent - Unstable and slow seeding, with a limit of 2000 torrents
- Transmission - Slow and featureless, with a limit of 25K torrents
These torrent clients are running in a shared environment on Ultra.cc. We do not recommend nor officially support torrent clients with torrent sessions above these limits.
Deluge
If your Deluge instance fails to start or crashes shortly after startup, a corrupted torrent file or session state file may be the cause. Deluge stores its torrent session state in ~/.config/deluge/state. This directory contains one <hash>.torrent file per torrent, along with the torrents.state and torrents.fastresume files, which store the session details for all torrents.
- Connect to your Ultra.cc service via SSH.
- Stop Deluge from the Apps tab on the UCP, or by executing
app-deluge stop. - Back up your Deluge config directory before making changes, so you can restore it if needed. Execute the following command:
cp -r ~/.config/deluge ~/.config/deluge.bak- Next, execute the following command to find corrupted torrent files. The command checks every torrent file in the session state directory and lists the files that are empty or are not valid torrent files:
for f in ~/.config/deluge/state/*.torrent; do [ -f "$f" ] || continue; [ "$(head -c 1 "$f")" = "d" ] || echo "$f"; done- The command lists the corrupted torrent files as
<hash>.torrent. Take note of these files. - If the command returns no output, no corrupted torrent files were found. Continue to the
torrents.statesteps below. - To delete a corrupted torrent file, execute the following command for each file you noted:
- Replace the alphanumerical string with the file names you noted previously.
rm ~/.config/deluge/state/4cc1f979463a4852574e0de8e111084c19342f83.torrent- Restart Deluge from the Apps tab on the UCP, or by executing
app-deluge restart. - If Deluge still crashes, the
torrents.stateortorrents.fastresumefile may be corrupted. Deluge keeps a previous copy of these files with a.bakextension. - Stop Deluge from the Apps tab on the UCP, or by executing
app-deluge stop. - Execute the following command to check if the backup files exist:
ls -l ~/.config/deluge/state/torrents.*- If
torrents.state.bakandtorrents.fastresume.bakare listed, execute the following command to restore them: - Any changes made to your torrent session after the backup files were last saved are lost.
cp ~/.config/deluge/state/torrents.state.bak ~/.config/deluge/state/torrents.state && cp ~/.config/deluge/state/torrents.fastresume.bak ~/.config/deluge/state/torrents.fastresume- Restart Deluge from the Apps tab on the UCP, or by executing
app-deluge restart. - If Deluge starts without issues, open the Deluge Web UI and confirm that your torrents are listed.
qBittorrent
If your qBittorrent instance is able to start up, but immediately becomes unreachable, it is possible that you have torrent files that are corrupted. To locate a corrupt torrent file in qBittorrent, you need to monitor the log output. Logging is enabled by default in qBittorrent and no further action is needed to get started.
- Connect to your Ultra.cc service via SSH
- Before you begin troubleshooting, you should backup your qBittorrent instance by following the instructions here.
- Alternatively, to manually backup qBittorrent, you can make copies of the below directory paths.
~/.local/share/qBittorrent~/.config/qBittorrent- Next, you can begin monitoring the qBittorrent log file in real-time by executing the following command:
- To stop the real-time monitoring, press
CTRL+C.
tail -f ~/.local/share/qBittorrent/logs/qbittorrent.log- While you are monitoring the qBittorrent log file in real-time, proceed to restart your qBittorrent instance.
- Restart qBittorrent from the Apps tab on the UCP, or by executing
app-qbittorrent restart. - During the restart of qBittorrent, keep an eye on the real-time monitoring of the log file and look for any errors.
- If errors are found, take note of the error and exit the real-time monitoring by pressing
CTRL+C. - Next, if there were any corrupted torrents, you will see errors such as
Unable to resume torrent '<hash>'and/orFile error alert. - Your next course of action would be to locate these torrents, which can be done by executing the following command:
cat ~/.local/share/qBittorrent/logs/qbittorrent* | grep -i unable- The above command will list all the corrupted torrent files as
<hash>.torrent. Take note of these files. - The format to note would look like this:
fe44aede8630g8dab52263da06e1e1lblc693136.torrent - Next, stop qBittorrent from the Apps tab on the UCP, or by executing
app-qbittorrent stop. - Once qBittorrent has been stopped, you can proceed to delete all the corrupted torrents.
- To delete a torrent, execute the following command for each of the corrupted torrents:
- Be sure to replace the alphanumerical string with the filenames that you have noted previously.
rm ~/.local/share/qBittorrent/BT_backup/fe44aede868a38dab52263da06e1e1bddc693136.torrent- Once all the corrupted torrents have been deleted, you can proceed to restart qBittorrent.
- Restart qBittorrent from the Apps tab on the UCP, or by executing
app-qbittorrent restart - If all went well, qBittorrent should start up without issues. However, if qBittorrent still crashes upon start up, you need to restart the procedure and monitor the log file while restarting qBittorrent.
rTorrent
To locate a corrupt torrent file in rTorrent, you need to monitor the log output during the crash of rTorrent. By default, rTorrent logging is disabled and needs to be enabled.
- Connect to your Ultra.cc service via SSH
- Stop rTorrent from the UCP, or by executing
app-rtorrent stop - Create a
logdirectory and backup torrent session by executing the following command:
mkdir ~/.config/rtorrent/logs && cp -r ~/.config/rtorrent/session ~/.config/rtorrent/session.bak- Next, to enable logging in rTorrent, open
.rtorrent.rcwith the nano editor:
nano ~/.rtorrent.rc- At the end of the configuration file, paste the following:
- Next, restart rTorrent from the UCP, or by executing
app-rtorrent restart - Now, wait until rTorrent crashes and then check the logs to see what torrent was last logged
- To output the log in your terminal, execute the following command:
tail ~/.config/rtorrent/logs/storage.log- Find the last torrent logged and execute the command in the box below:
- The
TORRENTIDwill be in the format of4CC1F979463A4852574E0DE8E111084C19342F83 - Make sure to include the
*at the end of the command, as it will remove all related files.
rm ~/.config/rtorrent/session/TORRENTID*- Then, restart rTorrent from the UCP, or by executing
app-rtorrent restart - Next, if rTorrent crashes again, repeat the process.
- Stop rTorrent
- Find the latest torrent ID in the log
- Remove the files associated with the torrent ID
- Restart rTorrent
- Once rTorrent no longer crashes, you can disable logging.
- Stop rTorrent from the UCP, or by executing
app-rtorrent stop - Remove the lines that you previously added to the configuration file
~/.rtorrent.rc - Restart rTorrent from the UCP, or by executing
app-rtorrent restart
Transmission
If your Transmission instance fails to start or crashes shortly after startup, a corrupted torrent file or resume file may be the cause. Transmission stores its torrent session state in ~/.config/transmission-daemon, in two directories:
torrents- Contains one.torrentfile per torrent.resume- Contains one.resumefile per torrent, which stores the progress and settings of that torrent.
Each torrent has a .torrent file and a .resume file with the same file name. In Transmission v4, the file name is the torrent hash. In Transmission v3, the file name is the torrent name followed by part of the torrent hash.
- Connect to your Ultra.cc service via SSH.
- Stop Transmission from the Apps tab on the UCP, or by executing
app-transmission stop. - Back up your Transmission config directory before making changes, so you can restore it if needed. Execute the following command:
cp -r ~/.config/transmission-daemon ~/.config/transmission-daemon.bak- Next, execute the following command to find corrupted files. The command checks every torrent and resume file in the session state and lists the files that are empty or are not valid:
for f in ~/.config/transmission-daemon/torrents/*.torrent ~/.config/transmission-daemon/resume/*.resume; do [ "$(head -c 1 "$f")" = "d" ] || echo "$f"; done- The command lists the corrupted files by their full path. Take note of the file names, without the
.torrentor.resumeextension. - If the command returns no output, no corrupted files were found.
- To delete a corrupted torrent, execute the following command for each file name you noted. This removes both the torrent file and the resume file of the torrent:
- Replace
FILENAMEwith the file names you noted previously. - Keep the quotation marks, as Transmission v3 file names can contain spaces.
rm "$HOME/.config/transmission-daemon/torrents/FILENAME.torrent" "$HOME/.config/transmission-daemon/resume/FILENAME.resume"- Restart Transmission from the Apps tab on the UCP, or by executing
app-transmission restart. - If Transmission starts without issues, open the Transmission Web UI and confirm that your remaining torrents are listed.
- If Transmission still crashes, you can restore your backup by following the Restore Backup section in our Transmission guide, and contact our support team for further assistance.
If you require further assistance, you can open a support ticket here.