-vss not working with Catalina

Hi, I upgraded to Catalina yesterday and since then backups have been failing with this:

Running backup command from /Users/vito/.duplicacy-web/repositories/localhost/0 to back up /Users/vito
Options: [-log backup -storage local -threads 1 -vss -stats]
2019-10-09 02:00:01.843 INFO REPOSITORY_SET Repository set to /Users/vito
2019-10-09 02:00:01.843 INFO STORAGE_SET Storage set to /Volumes/Backup/duplicacy
2019-10-09 02:00:15.621 INFO BACKUP_START Last backup at revision 8774 found
2019-10-09 02:00:18.982 ERROR VSS_CREATE Error while mounting snapshot: %!(EXTRA *exec.ExitError=exit status 66)

How can I fix? Thanks!

I logged in on the website and it looks like I can’t submit tickets even though the license is still active?

Check the error in the code here duplicacy/duplicacy_shadowcopy_darwin.go at master · gilbertchen/duplicacy · GitHub it seems that there may be a problem with the names of the snapshots. Snapshots are created with a name having the ‘.local’ suffix from what I can see:

➜ tmutil listlocalsnapshots /
Snapshots for volume group containing disk /:
com.apple.TimeMachine.2019-10-09-175949.local
com.apple.TimeMachine.2019-10-09-180014.local

But the command duplicacy uses to mount the snapshot doesn’t include that suffix

"/sbin/mount", "-t", "apfs", "-o", "nobrowse,-r,-s=com.apple.TimeMachine."+snapshotDate, "/", snapshotPath)

Am I reading this right? In fact I tried mounting a snapshot manually the same way and I get the same code 66. Please help, I don’t want to be without backups.

Can you post a screenshot of your backup schedule? I’m curious if the -vss option gets added automatically or if you added it.

If you added it, then one workaround might be to simply remove it.

I added it and for now I am backing up without that option, although it seems a lot slower. It looks like it’s not just me VSS not working on macOS Catalina · Issue #576 · gilbertchen/duplicacy · GitHub

Yeah, it doesn’t seem user-specific. Removing -vss is just a workaround if you don’t want to be without backups until this is addressed.

I’m not sure why it would be slower. If anything, now duplicacy shouldn’t have to wait for files with exclusive locks (though might not be able to backup such files without -vss).

Reference: backup command details, -vss

It looks like adding the .local suffix should fix it, but I haven’t upgraded to Catalina so can’t really test the fix. Can anyone check if this fix works?

There is also the problem of how to detect the macOS version in order to decide whether or not to add the .local suffix.

The “right” approach would be to query the system profiler or ioregistry, but you can also run sw_vers and parse output, or read kern.osversion from sysctl — the 19 followed by letter and build number is Catalina.

However I’m wondering if there is better way to do the right thing without changing behavior based on version

However I’m wondering if there is better way to do the right thing without changing behavior based on version

I imagine one way of doing it would be to run

$ tmutil listlocalsnapshots /
Snapshots for volume group containing disk /:
com.apple.TimeMachine.2019-10-14-180021.local

and grep for the date we want (although I have no idea how portable that would be).

1 Like

@gchen I can definitely test, and implement a version check using one of the methods suggested by saspus or timnn.
Do you have a preference?

I created a PR that uses tmutil listlocalsnapshots: Bugfix: allow -vss usage on Mac OS Catalina by gboudreau · Pull Request #578 · gilbertchen/duplicacy · GitHub
Can easily be changed to another technique to detect the correct snapshot name to use.

I think there is a bigger issue here.

Right now Duplicacy is for some reason asking Time Machine to create snapshots for it. Format and naming of these snapshots are Time Machine implementation details. Duplicacy shall not rely on that. Instead, it shall create snapshots using filesystem API directly – see man fs_snapshot_create

2 Likes

If I remember correctly, the issue with using fs_snapshot_create directly is that it requires a special entitlement from Apple. This can be requested from Apple, but it also requires additional review.

Excellent point. @gchen should reach out to Apple. From what I understand from quick googling it seems the entitlement is being granted to backup applications that can demonstrate that they won’t clog up the drive with snapshots over time. Duplicacy creates a snapshot for a duration of a backup and should delete it afterwards – in this case it should be easy to get an approval; (Weren’t Carbon copy cloner and super duper granted one?)