Fix error restoring from TimeMachine

When your Mac does not restore from TimeMachine... "An error occurred while restoring from the backup"


We could not restore our Mac from a TimeMachine backup after upgrading an SSD.
The restoration process proceeded to about 45% and then resulted in an error.
We decided to investigate as we had a lot of software and settings in the Mac, and re-installing all would span multiple days.

First, the error message was: "An error occurred while restoring from the backup".
Not very helpful.

What is less known, in the screen where you restore the backup, you can view the logs and what the final error was (Search for a submenu item 'log' in the top bar). So apparently. there is some file permissions error with an App Store license file from 'agile bits'. The only software from agilebits we have installed was '1password'. This led us to these discussions:

https://discussions.agilebits....

So, let's delete the whole agile bits folder from the backup: /Volumes/Macintosh HD/Users/jen/Library/Group Containers/2BUA8C4S2C.com.agilebits

This is not as easy as it seems. Difficulties are in:

- we need to access the TimeMachine drive from a console
- and delete the folder using a special command

Access the TimeMachine drive from a console

This is a little tricky, since we only have the recovery os running. First, we'd need to make sure the Time Machine drive is mounted. For this, go to through the process of recovery up to the point where you can select a restore point. This makes sure the drive is mounted, and passwords entered.

Then, click back until you are at the start screen. Somewhere from the top menu bar, you are now able to start a terminal, and when in the terminal, the drive is mounted under /Volumes

Remove the offending folder/file from the Time Machine backup

Then you need to locate the offending files or folder on the Timemachine volume. Take a note of the path.
You cannot delete the files or folder using 'rm' from the terminal, even not with sudo.

You have to use a special, undocumented helper utility, the bypass utility.
It is located in a location like:

/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass

(actual location may vary).

You can then delete a file from the volume with a command like:

sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass /Volumes/[disk]/Backups.backupdb/[path]

This worked and the Mac booted.
Note we had to wait a long time for the first time logging in with a user (the machine appeared to 'hang'), but just get a coffee and wait.