Rsync: mkstemp failed Operation not permitted

xvk4

Dabbler
Joined
Jul 6, 2013
Messages
11
Hello, I have two freenas servers both running freenas 9.10 stable. I am trying to sync a directory between the two machines.
I have used the Webgui and created a task on one machine and a module on the other as per the documentation in the manual. Rsync runs , creates all the folders but fails to copy any files with the following error message:
rsync: mkstemp "/mnt/Waller2/WallerNAS2/Media/.Nord.pdf.muk" failed: Operation not permitted (1)
I egt a similar error message for each file it tries.

I have also tried using rsync directly from a bash shell, logged in as root, using the simple command: rsync -av 192.168.2.200:/mnt/Media Media
and I get the same errors. I have also tried a similar command on the other server and I get the same errors.
In all cases the correct directory structure was created (so the two servers are communicating), but they failed to create the files with a similar error each time.
Any advice please
 
D

dlavigne

Guest
Sounds like the user account being used doesn't have permissions to write to that directory.
 

xvk4

Dabbler
Joined
Jul 6, 2013
Messages
11
Thanks for the advice. I have done a bit more investigation to check out I was using rsync correctly as follows:
  • If I create two directories at /root, and put a file in one; then I can correctly rsync the two directories and everything works
  • I can do the same with other directories such as /usr, /bin and so forth
  • When I get to a mounted zfs volume from say /mnt/Media, I can still create the directories and files (so I am assuming there are no permission issues) but rsync fails as described above.

I will wait a few days and try the next update. Thanks again for the advice.
 

desertrider

Dabbler
Joined
Apr 19, 2015
Messages
12
My Solution: I was looking at Bug #1217, for this rsync error, and the programmer mentioned this was by design and you have to use "-A --no-perms" included in your command and when I used it everything worked.

Include "-A --no-perms" in your rsync command and it should now work (hope this helps someone as I was pulling my hair out over this –no-perms )

I know this is an old thread but I had this same issue with ZFS datasets, share type=Windows, and using SMB shares. In SSH (I use Putty), using rsync to copy files from one dataset to another would copy directories but NOT the files and you would get an error regarding the mkstemp failed - also it continues but if you have a lot of files it will stop

I had --progress with --stats and it just quit in my Putty SSH window - I was able to hit Ctrl-C to cancel and then I could see it trying to write all the mkstemp files into the directories but got mkstemp failed operation not permitted.

Here is my total WORKING command, used in Putty SSH, I use to copy files from one directory to another along with getting progress & stats:
rsync --partial --stats --progress –A –a –r –v --no-perms /mnt/BEAST22T/Videos/ /mnt/MINI7T/Backups_PERMANENT/Videos-New-Location

** You can add the “-n” for test run - it will run and let you know the results without actually copying the files ***

Here is what each of the commands I use is performing - I include for those who may want to use this and customize it:

--no-perms (**Must use –A with this) (MUST HAVE THIS FOR SMB, Windows ACL Shares or you will get directories but not files copied) – this tells it to not preserve permissions.
--perms = -p = preserve permissions (This is the original perms command that we are adding --no-perms

--partial
By default, rsync will delete any partially transferred file if the transfer
is interrupted. In some circumstances it is more desirable to keep partially
transferred files. Using the --partial option tells rsync to keep the partial
file which should make a subsequent transfer of the rest of the file much faster.

--stats
This tells rsync to print a verbose set of statistics on the file transfer,
allowing you to tell how effective the rsync algorithm is for your data.

--progress
This option tells rsync to print information showing the progress of the transfer.
This gives a bored user something to watch.
This option is normally combined with -v. Using this option without the -v option
will produce weird results on your display.

-r, --recursive
This tells rsync to copy directories recursively.
If you don't specify this then rsync won't copy directories at all.

-A --acls
Preserve ACLs (implies –p = --perms which is permissions when using –A you do not need -p)

-a, --archive
This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and
want to preserve almost everything.

-v, --verbose
This option increases the amount of information you are given during the transfer.
By default, rsync works silently.
A single -v will give you information about what files are being transferred
and a brief summary at the end.
Two -v flags will give you information on what files are being skipped and
slightly more information at the end.
More than two -v flags should only be used if you are debugging rsync.

--delete
This tells rsync to delete any files on the receiving side that aren't on - You can add this if you want to us this to keep exact copies on the target as the files change on the source.
 
Last edited:

Chris Moore

Hall of Famer
Joined
May 2, 2015
Messages
10,080

AlcSi

Dabbler
Joined
Sep 20, 2019
Messages
41
Just wanted to add I had the same error, only for one of my Tasks, which is run by 'root', like all my tasks... using --no-perms worked.
I'm using the Rsync tasks GUI on FreeNAS 11.2 and added these options as "Extra options" in the task (along with --log-file).
 

jlaudiofan

Cadet
Joined
Dec 16, 2019
Messages
2
Thanks, the -A --no-perms was exactly what I needed. I was backing up everything to convert an old pool from z1 to z2 and had troubles putting everything back on the new z2 pool. Much appreciated!
 

-fun-

Contributor
Joined
Oct 27, 2015
Messages
171
rsync on my Mac doesn't have an option -A. It worked however with just adding --no-perms and replacing -a with -rltgo ... meaning go recursive, follow links, preserve times and group and owner.
 
Top