MacOS – Why does hdiutil fail on symlinks when creaing an image of a Time Machine backup

disk-utilitydmgmacostime-machine

I am trying to create a compressed disk image of a Time Machine backup (that is stored on an external HDD) on Yosemite.

hdiutil fails on the first symlink it comes across.
Before the failure, there is also an authentication error followed by a GUI password prompt. If I deny the authentication, the following happens:

hdiutil create -srcfolder `tmutil latestbackup` -ov -verbose -o backup.dmg
2015-01-11 15:32:19.751 diskimages-helper[36885:258775] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:32:19.751 diskimages-helper[36885:258775] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Initializing…
2015-01-11 15:32:19.754 diskimages-helper[36885:258775] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:32:19.768 copy-helper[36886:258780] estimating /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344
2015-01-11 15:32:19.770 copy-helper[36886:258780]   uid 501 does not have ownership of /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344 - setting needAuth to YES
Scanning…
Error 80 (Authentication error).
/Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344: Authentication error
Initializing…
2015-01-11 15:32:20.805 diskimages-helper[36885:258775] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Finishing…
2015-01-11 15:32:20.806 diskimages-helper[36885:258775] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:32:25.924 hdiutil[36883:258790] couldn't authenticate for helper
2015-01-11 15:32:25.925 hdiutil[36883:258790] helper died
2015-01-11 15:32:25.943 hdiutil[36883:258790] framework server setup failed (-60006 - Operation canceled).
DIHLDiskImageCreate() returned -60006
(null)
hdiutil: create: returning -60006
hdiutil: create failed - Operation canceled

If I type in the password, this happens:

hdiutil create -srcfolder `tmutil latestbackup` -ov -verbose -o backup.dmg
2015-01-11 15:16:58.330 diskimages-helper[36754:253622] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:16:58.331 diskimages-helper[36754:253622] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Initializing…
2015-01-11 15:16:58.334 diskimages-helper[36754:253622] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:16:58.366 copy-helper[36757:253626] estimating /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344
2015-01-11 15:16:58.368 copy-helper[36757:253626]   uid 501 does not have ownership of /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344 - setting needAuth to YES
Scanning…
Error 80 (Authentication error).
/Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344: Authentication error
Initializing…
2015-01-11 15:16:59.495 diskimages-helper[36754:253622] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Finishing…
2015-01-11 15:16:59.496 diskimages-helper[36754:253622] *useEffectiveIDs**** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:17:05.121 diskimages-helper[36762:253777] *useEffectiveIDs**** euid/egid changed to 0,20 (uid/gid is 501,20)
2015-01-11 15:17:05.121 diskimages-helper[36762:253777] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Initializing…
2015-01-11 15:17:05.122 diskimages-helper[36762:253777] *useEffectiveIDs**** euid/egid changed to 0,20 (uid/gid is 501,20)
2015-01-11 15:17:05.179 copy-helper[36763:253781] estimating /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344
2015-01-11 15:19:47.733 diskimages-helper[36762:253777] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
Creating…
DIDiskImageCreatorProbe: interface  1, score    -1000, CSparseBundleDiskImage
DIDiskImageCreatorProbe: interface  2, score    -1000, CSparseDiskImage
DIDiskImageCreatorProbe: interface  3, score    -1000, CRawDiskImage
DIDiskImageCreatorProbe: interface  7, score     1000, CWOUDIFDiskImage
DIDiskImageCreatorProbe: interface  9, score    -1000, CCFPlugInDiskImage
DIDiskImageCreateWithCFURL: CWOUDIFDiskImage
DIFileEncodingCreatorProbe: interface  2, score    -1000, CEncryptedEncoding
DIBackingStoreCreatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreCreatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreCreatorProbe: interface  2, score        0, CRAMBackingStore
DIBackingStoreCreatorProbe: interface  3, score      300, CCarbonBackingStore
DIBackingStoreCreatorProbe: interface  5, score     -100, CCURLBackingStore
DIBackingStoreCreateWithCFURL: CCarbonBackingStore
DIBackingStoreCreateWithCFURL: creator returned 0
CUDIFFileAccess::createWithCFURL: kUDIFFileWithFooter
warning: no checksum present
DIDiskImageCreateWithCFURL: creator returned 0
DI_kextWaitQuiet: about to call IOServiceWaitQuiet...
DI_kextWaitQuiet: IOServiceWaitQuiet took 0.000005 seconds
DI_kextWaitQuiet: about to call IOServiceWaitQuiet...
DI_kextWaitQuiet: IOServiceWaitQuiet took 0.000024 seconds
2015-01-11 15:19:56.094 diskimages-helper[36762:254942] DIHelperHDID serveImage: attaching drive
{
    autodiskmount = 1;
    "hdiagent-drive-identifier" = "9AA3AC77-0E29-47CB-BE38-92C128E33893";
    "skip-auto-fsck-for-system-images" = 1;
    "system-image" = 1;
    "unmount-timeout" = 0;
}
2015-01-11 15:19:56.096 diskimages-helper[36762:254942] DIHelperHDID serveImage: connecting to myDrive 0x540F
2015-01-11 15:19:56.096 diskimages-helper[36762:254942] DIHelperHDID serveImage: register _readBuffer 0x104109000
2015-01-11 15:19:56.096 diskimages-helper[36762:254942] DIHelperHDID serveImage: activating drive port 21011
2015-01-11 15:19:56.097 diskimages-helper[36762:254942] DIHelperHDID serveImage: set cache enabled=TRUE returned FAILURE.
2015-01-11 15:19:56.424 diskimages-helper[36762:254942] DIHelperHDID serveImage: set on IO thread=TRUE returned SUCCESS.
2015-01-11 15:19:56.424 diskimages-helper[36762:254942] -processKernelRequest: will sleep received
2015-01-11 15:19:57.062 diskimages-helper[36762:253777] _mountDevEntries: disk3s2 aborting mountpoint postflight because disk image has no band size specified.
2015-01-11 15:19:57.066 diskimages-helper[36762:253777] *useEffectiveIDs**** euid/egid changed to 0,20 (uid/gid is 501,20)
2015-01-11 15:19:57.084 diskimages-helper[36762:253777] *useRealIDs******** euid/egid changed to 501,20 (uid/gid is 501,20)
2015-01-11 15:19:58.922 diskimages-helper[36762:254942] -processKernelRequest: flush received
2015-01-11 15:19:59.124 diskimages-helper[36762:254942] -processKernelRequest: flush received
2015-01-11 15:19:59.125 diskimages-helper[36762:254942] -processKernelRequest: flush received
2015-01-11 15:19:59.125 diskimages-helper[36762:254942] -processKernelRequest: flush received
Copying…
2015-01-11 15:19:59.174 diskimages-helper[36762:253777] *useEffectiveIDs**** euid/egid changed to 0,20 (uid/gid is 501,20)
2015-01-11 15:19:59.346 copy-helper[36791:255052] copying /Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344 to /Volumes/2015-01-11-150344
2015-01-11 15:19:59.347 copy-helper[36791:255052] About to copy "/Volumes/Backup/Backups.backupdb/Name/2015-01-11-150344".
2015-01-11 15:19:59.597 copy-helper[36791:255052] copy error (canceling): /Volumes/2015-01-11-150344/Macintosh HD/Applications/Adium.app/Contents/CodeResources: Operation not supported
2015-01-11 15:19:59.597 copy-helper[36791:255052] Copy finished with error 45 (Operation not supported).
Error 45 (Operation not supported).
could not access /Volumes/2015-01-11-150344/Macintosh HD/Applications/Adium.app/Contents/CodeResources - Operation not supported
Finishing…
2015-01-11 15:20:01.105 diskimages-helper[36762:254942] -processKernelRequest: flush received
2015-01-11 15:20:01.169 diskimages-helper[36762:253777] *useEffectiveIDs**** euid/egid changed to 0,20 (uid/gid is 501,20)
DIHLDiskImageCreate() returned 45
hdiutil: create: returning 45
hdiutil: create failed - Operation not supported

CodeResources is the first symlink the process comes across.

ls -lre /Volumes/Backup/Backups.backupdb/Name/Latest/Macintosh\ HD/Applications/Adium.app/Contents/CodeResources 
lrwxr-xr-x+ 1 adam  staff  28 20 Nov  2010 /Volumes/Backup/Backups.backupdb/Name/Latest/Macintosh HD/Applications/Adium.app/Contents/CodeResources -> _CodeSignature/CodeResources
0: group:everyone deny write,delete,append,writeattr,writeextattr,chown

I found the same issue discussed here, but they never seem to get to the bottom of what the problem with the symbolic link is that is causing copy-helper to fail.

Why does hdiutil prompt for ownership permissions, and why does it fail on this symlink?

Best Answer

I ran into this same issue trying the same thing on Mojave. It appears that ACLs on symlinks just aren't supported when working within the confines of disk images. I did come up with this workaround though:

  1. Create a blank sparse image that's big enough to hold the backup.

  2. ditto the backup directory into the mounted sparse image. It will make the same complaint about operation not supported on those symlinks but it will still copy it and will treat that error as just a warning and continue.

  3. When complete, unmount the sparse image and use Disk Utility to convert it into a compressed one.