macprefs icon indicating copy to clipboard operation
macprefs copied to clipboard

Rsync error

Open sanimkhan opened this issue 5 years ago • 3 comments

Error detail-

Error Info:
error code = 23
cmd ['rsync', '-a', '/Library/LaunchDaemons/', '/Users/sanimkhan/Dropbox/MacPrefsBackup/StartupItems/LaunchDaemons/AllUsers/']
error message:rsync: send_files failed to open "/Library/LaunchDaemons/com.microsoft.teams.TeamsUpdaterDaemon.plist": Permission denied (13)
rsync error: some files could not be transferred (code 23) at /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54.120.1/rsync/main.c(996) [sender=2.6.9]

Traceback-

  File "/usr/local/bin/macprefs", line 73, in <module>
    main()
  File "/usr/local/bin/macprefs", line 69, in main
    invoke_func(args)
  File "/usr/local/bin/macprefs", line 39, in invoke_func
    args.func()
  File "/usr/local/bin/macprefs", line 17, in backup
    startup_items.backup()
  File "/usr/local/Cellar/macprefs/1.0.26/bin/startup_items.py", line 10, in backup
    backup_system_daemons_agents()
  File "/usr/local/Cellar/macprefs/1.0.26/bin/startup_items.py", line 35, in backup_system_daemons_agents
    copy_dir(source, dest)
  File "/usr/local/Cellar/macprefs/1.0.26/bin/utils.py", line 31, in copy_dir
    execute_shell(command)
  File "/usr/local/Cellar/macprefs/1.0.26/bin/utils.py", line 12, in execute_shell
    cwd=cwd, stderr=STDOUT).strip().decode("utf-8")
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['rsync', '-a', '/Library/LaunchDaemons/', '/Users/sanimkhan/Dropbox/MacPrefsBackup/StartupItems/LaunchDaemons/AllUsers/']' returned non-zero exit status 23

System detail- macOS Catalina version 10.15.7

sanimkhan avatar Dec 06 '20 06:12 sanimkhan

Hello @sanimkhan :)

I just encountered the same error and stumbled upon your issue while searching for a solution, which I found later:

  • https://developer.apple.com/forums/thread/126497

Following that I just ticked "Terminal" in "Full Disk Access" under "System Preferences > Security & Privacy > Privacy"

Running macprefs backup afterwards performed successfully 🎉

trubesv avatar Jan 27 '21 03:01 trubesv

Hi @trubesv Thanks a lot for your help. IT WORKED.

Just to extend, in addition to your solution I had to run sudo macprefs backup

sanimkhan avatar Jan 27 '21 05:01 sanimkhan

@trubesv I could not use custom backup directory, I did set the environment variable but did not work. I am not sure if I should open a ticket on this or not. I think it works for you?

sanimkhan avatar Jan 27 '21 05:01 sanimkhan

@sanimkhan Glad it helped :)

I think your issue is that you ran it as sudo so only the root user can edit that folder.

You can change this folder ownership with the chowncommand & change its permissions with chmod.

Then you can run macprefs again and it should work :rocket:

trubesv avatar Jan 27 '21 07:01 trubesv

You can change this folder ownership with the chowncommand & change its permissions with chmod.

This is probably a bad idea, TBH. At the very least, revert the permissions change after making a backup.

christhekeele avatar May 25 '21 22:05 christhekeele