Transmission .torrent Permission Issue

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Hello, sorry if this is a stupid question but I am having an issue with a very specific permission issue. I've been using Transmission for a long time now with no issues, I'm on Truenas 12.0 U8.1, and thinking about upgrading to 13. In the past I've had upgrades that wiped my Transmission jail and I lost all the torrents I was seeding (and it is not a small enough number to easily re-add them). I've tracked down where the .torrent files are located, /mnt/{mypool}/iocage/jails/transmission/root/usr/local/etc/transmission/home/torrents/. I am able to go all the way down the tree but I cannot copy any of the .torrent files (on windows 10), it says permission denied.
Up until this point, /mnt/{mypool}/iocage/jails/transmission/root/usr/local/etc, I actually am able to copy files over, it is just the /transmission/home/torrents directories where my permission all of a sudden gets blocked. I don't know if anyone has run into this issue, but I'm not exactly sure how to give myself permission for these last 3 directories and am a bit befuddled why I don't have them there when I do the rest of the way anyways. Any help is greatly appreciated!
 

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Just a little bump to see if anyone has any ideas, I'm still coming up blank
 
Joined
Oct 22, 2019
Messages
3,641
Why would upgrades "wipe" your jail? Are you using the "Plugin" or your own managed jail?

That shouldn't be happening.

If you want a straightforward method of backing up the contents of a folder within a jail, you can use this command in the terminal. (Preferably while SSH'd into your TrueNAS server.)

This will backup the folder into a tarball file named something like transmission-torrents-backup_20230621.tar.zst

Code:
tar c -vaf /mnt/{mypool}/{somedataet}/{somebackupfolder}/transmission-torrents-backup_$(date +%Y%m%d).tar.zst -C /mnt/{mypool}/iocage/jails/transmission/root/usr/local/etc/ transmission

Prepend the command with sudo if you're not logged in as the user "root".

(Note that there is a "space" near the very end of the command, before "transmission".)
 
Last edited:

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
I'm using the Plugin, and when I went from freenas to truenas it wiped everything so now I just get nervous everytime I do an upgrade that something will happen again and with over 1000 torrents I don't particularly want to have to go manually re-add them.

I think transmission-torrents-backup_$(date +%Y%m%d).tar.zst, something about that is giving me illegal characters when I try and use it. When I remove it and turn it into just transmission.tar.zst, it says it cannot open the file. I've trying doing some research to see exactly how the tar command works but didn't have much luck, so I'm not exactly sure what needs to be changed but it almost sounds like that is trying to open instead of create something. I really appreciate your help!
 
Joined
Oct 22, 2019
Messages
3,641
What is the command you used?

You can paste / write it in here, enclosing it between [code][/code] tags.

A breakdown of what it does:
  • tar: the command itself
  • c: "create" mode
  • -v: be "verbose" (which lets you see it's "doing something")
  • -a: autodetect the compression to use based on the file extension given (in this case ZSTD compression)
  • -f <path>/<filename>: the location and filename given to the newly created tarball archive
  • /mnt/{mypool}/{somedataet}/{somebackupfolder}/: some location/folder you want to save these tarball archives
  • $(date +%Y%m%d): insert the year, month, and day ("datestamp") into the filename
  • .tar.zst: compress with ZSTD (the .zst extension invokes "-a" to autodetect the compression method as ZSTD)
  • -C /mnt/{mypool}/iocage/jails/transmission/root/usr/local/etc/: change into this directory before creating the archive
  • transmission: the folder to add to the archive
 
Last edited:

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Sorry it has taken me so long to get back, I've been swamped at work unfortunately. I just sat down to try again and here are the commands I tried and the result:

In PuTTY:
Code:
tar c -vaf /mnt/Life/Movies/torrents/transmission-torrents-backup_$(date +%Y%m%d).tar.zst -C /mnt/Life/iocage/jails/transmission/root/usr/local/etc/ transmission
(illegal variable name)

Code:
tar c -vaf /mnt/Life/Movies/torrents/transmission-torrents-backup.tar.zst -C /mnt/Life/iocage/jails/transmission/root/usr/local/etc/ transmission
(tar: could not chdir to '/mnt/Life/iocage/jails/transmission/root/usr/local/etc/'

root@freenas:~ # zstd: /*stdout*\: Broken pipe)
 
Joined
Oct 22, 2019
Messages
3,641
Why are you using PuTTy? Windows PowerShell has a built in SSH client.

Code:
ssh user@ip.ad.dr.ess


I would also prepend "sudo" before the tar command, if you're not logged in as root.
 

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
I'm not the most technical and very rarely (basically never) connect to truenas using anything other than windows explorer, and back when I first setup my truenas many moons ago the guide talked about PuTTY. I just used powershell and got the same result though, tar: could not chdir. I am logged in as root but tried using sudo as well with the same results
 
Joined
Oct 22, 2019
Messages
3,641
Okay, this is why I hate the world of the command-line and terminal... :rolleyes:

A while back I set my non-root user with the ZSH shell. (FreeBSD defaults to the CSH shell.)

So you need to enclose the variable (command within another command) within single "backquotes" `:
Code:
tar c -vaf /mnt/Life/Movies/torrents/transmission-torrents-backup_`date +%Y%m%d`.tar.zst -C /mnt/Life/iocage/jails/transmission/root/usr/local/etc/ transmission

Everything is the same, but note the single backquotes on this section: `date +%Y%m%d`

I still recommend prepending with "sudo" just in case Transmission sets the ownership and permission of that directory which prevents other users from reading the files.


EDIT: But it doesn't account for why tar can't chdir.
(tar: could not chdir to '/mnt/Life/iocage/jails/transmission/root/usr/local/etc/'

Does that directory even exist?

What are its permissions?
Code:
ls -la /mnt/Life/iocage/jails/transmission/root/usr/local/etc
 
Last edited:

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Unless I am misunderstanding something basic, which is quite possible, I just went into Windows Explorer to make sure I'm not crazy, and it is definitely IP/Life/iocage/jails/transmission/root/usr/local/etc/. I am under the assumption that it should be mnt instead of my IP, as I have had to use the /mnt prepend when doing things in transmission in the UI.

Your updated code with the date doesn't give me an error anymore, but I do still get the could not chdir and their is definitely a folder there. I really appreciate all the help you are giving me!
 
Joined
Oct 22, 2019
Messages
3,641
could not chdir and their is definitely a folder there.

What are its permissions?
Code:
ls -la /mnt/Life/iocage/jails/transmission/root/usr/local/etc
 

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
It is saying no file or directory, which is boggling my mind. The only thing I can think of is I should be using something other than /mnt/ at the start.

truenas.jpg


Here is a picture to prove I'm not crazy and it definitely does exist
 
Joined
Oct 22, 2019
Messages
3,641
That's why it's important to post the output from an SSH terminal. (Like in my previous post.)
 
Joined
Oct 22, 2019
Messages
3,641
"No such file or directory"

That's why.
 

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Yes I get that it says that, but per my last post I also show that the directory exists, so there is another problem here. I don't know why it says it can't even see the directory with the commands you gave me
 
Joined
Oct 22, 2019
Messages
3,641
Now I see it...

I've tracked down where the .torrent files are located, /mnt/{mypool}/iocage/jails/transmission/root/usr/local/etc/transmission/home/torrents/.

I was just going by your original post, and you wrote "transmission" in lowercase letters.

I think you know what to change to make it work. :wink:
 

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Well hot diggity dog, after posting that I looked and saw there was a difference in the cases, but I didn't think it mattered. Now I know. It worked like a charm and with peazip (7zip didn't work for some reason) I was able to extract and see everything! I really appreciate all your help!
 
Joined
Oct 22, 2019
Messages
3,641
On Windows I use PeaZip (since 7zip lacks features in comparison.) On Linux, I use the included default archive managers, which handle anything you throw at them.

However, in your case, you can use the tar command directly while in the SSH command-line on TrueNAS Core ("FreeBSD").


To "test" the archive:
Code:
tar t -f transmission-torrents-backup_20230621.tar.zst


To "extract" the archive into a particular directory:
Code:
tar x -vf  transmission-torrents-backup_20230621.tar.zst -C /mnt/Life/iocage/jails/Transmission/root/usr/local/etc/


I would run such commands as "root" or with "sudo", due to the write permissions needed in those directories. (The permissions and ownerships should be preserved in the compressed tarball archive.)

EDIT: Don't extract it into here while the jail is running.

First, stop the jail with:
Code:
iocage stop Transmission


Then delete the unwanted/old directory with
Code:
rm -rv /mnt/Life/iocage/jails/Transmission/root/usr/local/etc/transmission


Now you can extract the backed-up archive, like the example above.

DOUBLE CHECK YOUR COMMANDS. You should also create a recursive snapshot of the dataset Life/iocage/jails/Transmission to be safe, just in case you delete the wrong items. (Or even just create a recursive snapshot for the root dataset of your entire pool.)
 
Last edited:

Kenfolk

Explorer
Joined
Sep 4, 2016
Messages
51
Ah yea that is what, PeaZIP for Windows 10. I actually zipped the tar folder into a section I can definitely access then pulled it onto Windows 10 (basically another machine) for safe keeping in case something went wrong with the transmission jail then I could just re-add all the .torrent files back into transmission.

I really appreciate all your help, and even showing me these last few commands. I have found as I got older learning new things has definitely become harder lol
 
Top