I'm getting a confusing error from rsync and the initial things I'm finding from web searches (as well as all the usual chmod'ing) are not solving it:
rsync: failed to set times on "/foo/bar": Operation not permitted (1)
rsync error: some files could not be transferred (code 23)
at /SourceCache/rsync/rsync-35.2/rsync/main.c(992) [sender=2.6.9]
It seems to be working despite that error, but it would be nice to get rid of that.
If /foo/bar
is on NFS (or possibly some FUSE filesystem), that might be the problem.
Either way, adding -O
/ --omit-dir-times
to your command line will avoid it trying to set modification times on directories.
The issue is probably due to /foo/bar not being owned by the writing process on a remote darwin (OS X) system. A solution to the issue is to set adequate owner on the remote site.
Since this answer has been voted, and therefore has been hopefully useful to someone, I'm extending it to make it clearer.
The reason why this happens is that rsync is probably trying to set an arbitrary modification time (mtime) when copying files.
In order to do this darwin's system utime()
function requires that the writing process effective uid is either the same as the file uid or super user's one, see opengroup utime's page. Check this discussion on rsync mailing list as reference.
/remote/path/to/foo/bar
on the remote server with this command: rsync -avzP --exclude '.DS_Store' /local/path/to/foo/bar/ user1@1.2.3.4:/remote/path/to/foo/bar
and got the same error messages which went away when I made user1
the owner of /remoe/path/to/foo/bar
like this: $ chown -R user1 /remote/path/to/foo/bar
As @racl101 has commented on an answer, this problem might be related to the folder owner. The rsync command should be done by the same user as the folder owner's one. If it's not the same, you can change it.
chown -R userCorrect /remote/path/to/foo/bar
The problem in my case was that the "receiver mountpoint" was incorrectly mounted. It was in read-only mode (for some extrange reason). It looked like rsync was copying the files, but it was not. I checked my fstab file and changed mount options to default, re-mount file system and execute rsync again. All fine then.
I had the same problem. For me the solution is to delete the remote file and let rsync
create again.
I've seen that problem when I'm writing to a filesystem which doesn't (properly) handle times -- I think SMB shares or FAT or something.
What is your target filesystem?
sudo port install rsync
) and it will break less. To check it: rsync --version
: rsync version 3.0.5 protocol version 30 ... append, ACLs, xattrs, iconv, symtimes, file-flags ... (ACLs and xattrs are the important ones)
This happened to me on a partition of type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
, where the directories where owned by another user in a group we were both members of. The group membership was already established before login, and the whole directory structure was group-writeable. I had manually run sudo chown -R otheruser.group directory
and sudo chmod -R g+rw directory
to confirm this.
I still have no idea why it didn't work originally, but taking ownership with sudo chown -R myuser.group directory
fixed it. Perhaps SELinux-related?
utime()
to work. You can also run as root and do it. But if the UID of the file is different they don't let you change the time to anything else than "now".
utime()
.
This error might also pop-up if you run the rsync process for files that are not recently modified in the source or destination...because it cant set the time for the recently modified files.
I came across this problem as well and the issue I was having was a permissions issue with the root folder that contained the files I was trying to send over. I don't care about that root folder being included with rsync
I just care what's in it. The error was coming from my command where I need to specify an additional /
at the end. If you do not have that trailing slash rsync
will attempt to set times the folder.
Example:
This will attempt to set times on html
rsync /var/www/html/ ubuntu@xxx.xxx.xxx.xxx:html
This will not
rsync /var/www/html/ ubuntu@xxx.xxx.xxx.xxx:html/
It could be that you don't have privileges to some of the files. From an administrator account, try "sudo rsync -av " Alternately, enable the root account and sign in as root. That should allow you to completely hose your system and brute force your rsync! ;-) I'm not sure if the above mentioned --extended-attributes will help, but I threw it in too, just for good measure.
Success story sharing
-O
doesn't help, obviously. This didn't used to happen when my backup partition was ext3 instead of ext4.--no-t
to remove the implied option.