Update: This issue has been fixed in the full installers for macOS Big Sur 11.6.2 and macOS Monterey 12.1.
When upgrading to macOS Big Sur and Monterey, the upgrade may stall on the black Apple boot screen showing a stuck progress bar.
This failure is sometimes caused by the number of metadata Spotlight files stored on the device exceeding a count of 20,000.
The files can be found by searching through the following directories:
/private/var/folders/*/*/C/com.apple.metadata.mdworker
/private/var/folders/*/*/C/com.apple.mdworker.bundle
Addigy has published several Community Facts to report on the status of these files and a script to remove these files.
To check the number of files on your devices, you may add the following Community Device Facts to your Policies that have devices you wish to upgrade to Big Sur or Monterey.
1. Navigate to Community -> Device Facts
Add Spotlight Files Health and Spotlight Files Count to your organization.
Spotlight Files Count - String Device Fact - Prints count of files in the two named directories.
Spotlight Files Health - Boolean Device Fact - Prints True (Green Check in UI) if under 20000 files counted or False (Red X in UI) if >= 20000 files.
2. Navigate to Community -> Scripts
Add Remove Spotlight Files to your environment.
Remove Spotlight Files - Script - Two commands set to remove all files in the named directories if the condition check for >= 20000 files is met. When copying this script you have the ability to edit the minimum files required to execute the delete or just use the remove commands if wanted.
Additional Reading: https://mrmacintosh.com/macos-upgrade-to-big-sur-failed-stuck-progress-bar-fix-prevention/