Time Machine shows no backup after backing up
After having set up my new Macbook Pro 2021 (macOS Monterey 12.1) with migrating data over from my old Macbook Pro, I started a new Time Machine backup on NAS. The backup took several hours and obviously backed up everything to NAS. Subsequent backups reported that they backed up only a few hundred MB, so it looked like everything was working.
However, checking the backup status in the Time Machine prefs, the status reports
Waiting to complete first backup
Checking the size of the sparsebundle on the NAS, it's said to be approx. 400 GB, so definitely holding an amount of data which meets my expectations for a successful backup.
I downloaded TheTimeMachineMechanics to find out about any errors, and there I see a message
Backup failed (104: BACKUP_DELAYED_UNFINISHED_PROTECTED_FILES)
It looks like the backup has been made, but for some reason it's not fully completed. How to fix that?
Things I tried (possible solutions found in the net):
- boot up in safe mode and backup from there
- use Disk Utility and run a repair
but to no avail.
This can happen when Time Machine tries to backup files that it does not have access to for some reason.
To verify that this is the cause, check the log file after Time Machine has finished a backup attempt:
log show --style syslog --last 30m --predicate 'senderImagePath contains[cd] "TimeMachine"' --info --debug
In the log, search for entries like these (search for 'access'):
localhost backupd[256]: (TimeMachine) [com.apple.TimeMachine:EventCollection] Adding event for inaccessible protected file Users/xxxx/Library/Containers/com.apple.findmy.FindMyWidgetIntentsItems/Data/Documents | EventDatabase.swift:569
Adding event for inaccessible protected file means that Time Machine wants to back these files (or files in these folders), but cannot access them because they are protected. It therefore delays the backup until they become accessible. However, that never happens.
It looks like this happens with a couple of folders that are connect to the Find My Mac functionality. I assume they are system protected so they cannot be tampered with, but the fact that Time Machine attempts to back them up, and the system won't let it, seems like a bug in macOS Monterey.
How to fix it
As a solution to work around this probable bug, all the problem folders must be excluded from the backup. This needs to be done in the terminal, because if you try to select the folders from System Preferences > Time Machine > Options, you will notice that the problem folders are not visible from the file selection dialog, which is probably due to their additional protection.
Fortunately, we can exclude files and folders from the terminal using tmutil addexclusion
. In my case, the problem folders were:
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy.FindMyNotificationsServiceExtension
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy.FindMyWidgetItems
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy.FindMyWidgetPeople
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy.FindMyWidgetIntentsItems
sudo tmutil addexclusion -p /Users/xxx/Library/Containers/com.apple.findmy.FindMyWidgetIntentsPeople
(copy, paste and execute line by line, and of course replace xxxx
)
Option -p
causes the given path to be excluded, even if it does not yet exist, but when it is created in the future. If you have multiple users, remember to do this for each user.
I recommend that you check the log if there are any additional problems. In my case, only the above folders related to Find My Mac had to be excluded.
Check the excluded folders in System Preferences > Time Machine > Options - they should all show a data size on the right – otherwise check for typos.
After that, start a new backup and cross your fingers.
Credits to this post in the Apple Community by George Harker.
Important addition
I've noticed that data in ~/Library/Containers
can be affected, too, and this may happen anytime again even after Time Machine had already been successfully completing backups. In my case, the Amazon Prime Video app created data here which Time Machine claimed to be inaccessible. As a preliminary work-around, I decided to exclude the whole directory /Users/xxx/Library/Containers
from Time Machine.
Looking forward to Apple fixing this!