macOS System Preferences crash/close

On MBP 2015 I'm experiencing System Preferences crash/close. When I go to top/left corner, click apple and choose System Preferences menu option it opens and about 2s later closes. I can't get inside System Preferences. It also seems I'm not logged in iCloud anymore.

I noticed a problem two days ago when I decided to restart the MBP (a thing I rarely do). After restarting I noticed macOS Monterey was available to download as well as updates to Big Sur I was running. I tried to install Big Sur updates but it failed many times then I decided to install Monterey and it did installed. But now it seems I have a bigger problem since I can't even get in System Preferences.

Had anybody else ever saw this? How should I proceed?

On /Library/Logs/DiagnosticReports I see:

CloudServicesTopic_2021-11-11-075542_Users-MacBook-Pro.diag
ContextService_2021-11-07-161415-1_Users-MacBook-Pro.crash
ContextService_2021-11-07-161415_Users-MacBook-Pro.crash
ContextService_2021-11-07-172230_Users-MacBook-Pro.crash
Dock-2021-11-11-080101.ips
Dock-2021-11-11-080448.ips
Dock-2021-11-11-081019.ips
Dock-2021-11-11-081047.ips
Dock-2021-11-11-081344.ips
Dock-2021-11-11-081709.ips
Dock-2021-11-11-082149.ips
Dock-2021-11-11-082203.ips
Dock-2021-11-11-083608.ips
Dock-2021-11-11-083901.ips
Dock-2021-11-11-084819.ips
Dock-2021-11-11-085155.ips
Dock-2021-11-11-085252.ips
Dock-2021-11-11-085333.ips
Dock-2021-11-11-090214.ips
Dock-2021-11-11-090215.ips
Dock-2021-11-11-090306.ips
Dock-2021-11-11-090808.ips
Dock-2021-11-11-090844.ips
Dock-2021-11-11-090926.ips
Dock_2021-11-11-080237_Users-MacBook-Pro.crash
Dock_2021-11-11-081411_Users-MacBook-Pro.crash
Dock_2021-11-11-090417_Users-MacBook-Pro.crash
Dock_2021-11-11-103451_Users-MacBook-Pro.crash
Dock_2021-11-11-105045_Users-MacBook-Pro.crash
Dock_2021-11-11-105905_Users-MacBook-Pro.crash
Dock_2021-11-11-132157_Users-MacBook-Pro.crash
Dock_2021-11-11-134543_Users-MacBook-Pro.crash
Dock_2021-11-11-143056_Users-MacBook-Pro.crash
Dock_2021-11-11-143916_Users-MacBook-Pro.crash
Dock_2021-11-11-145442_Users-MacBook-Pro.crash
Dock_2021-11-11-172550_Users-MacBook-Pro.crash
Dock_2021-11-11-174144_Users-MacBook-Pro.crash
Dock_2021-11-11-174804_Users-MacBook-Pro.crash
Dock_2021-11-11-180832_Users-MacBook-Pro.crash
Dock_2021-11-11-190752_Users-MacBook-Pro.crash
Dock_2021-11-11-191834_Users-MacBook-Pro.crash
Dock_2021-11-11-201054_Users-MacBook-Pro.crash
Dock_2021-11-11-201914_Users-MacBook-Pro.crash
Dock_2021-11-11-202428_Users-MacBook-Pro.crash
FSMenuApp-2021-11-12-105905.ips
Home_2021-11-11-074335_Users-MacBook-Pro.crash
Home_2021-11-11-074606_Users-MacBook-Pro.crash
Home_2021-11-11-074830_Users-MacBook-Pro.crash
Home_2021-11-11-075107_Users-MacBook-Pro.crash
Home_2021-11-11-075120_Users-MacBook-Pro.crash
Home_2021-11-11-075121_Users-MacBook-Pro.crash
Home_2021-11-11-075122_Users-MacBook-Pro.crash
Home_2021-11-11-075135_Users-MacBook-Pro.crash
Home_2021-11-11-075140_Users-MacBook-Pro.crash
Home_2021-11-11-075156_Users-MacBook-Pro.crash
Home_2021-11-11-075252_Users-MacBook-Pro.crash
Home_2021-11-11-075259_Users-MacBook-Pro.crash
Home_2021-11-11-075309_Users-MacBook-Pro.crash
Home_2021-11-11-083728_Users-MacBook-Pro.crash
KeySyncTopic_2021-11-11-075545_Users-MacBook-Pro.diag
Microsoft Update Assistant_2021-11-11-074606_Users-MacBook-Pro.crash
Microsoft Update Assistant_2021-11-11-075109_Users-MacBook-Pro.crash
Microsoft Update Assistant_2021-11-11-203725_Users-MacBook-Pro.crash
NetworkingTopic_2021-11-11-075541_Users-MacBook-Pro.diag
NetworkingTopic_2021-11-13-153126_Users-MacBook-Pro.diag
Retired
System Preferences-2021-11-11-210135.ips
System Preferences-2021-11-11-210410.ips
System Preferences-2021-11-11-210452.ips
System Preferences-2021-11-11-210457.ips
System Preferences-2021-11-11-210508.ips
System Preferences-2021-11-11-210515.ips
System Preferences-2021-11-11-210542.ips
System Preferences-2021-11-11-210549.ips
System Preferences-2021-11-11-2121242.ips
System Preferences-2021-11-11-212135.ips
System Preferences-2021-11-11-212143.ips
System Preferences-2021-11-11-212400.ips
System Preferences-2021-11-11-212408.ips
System Preferences-2021-11-11-213731.ips
System Preferences-2021-11-11-213740.ips
System Preferences-2021-11-11-213746.ips
System Preferences-2021-11-11-213752.ips
System Preferences-2021-11-11-215359.ips
System Preferences-2021-11-11-215406.ips
System Preferences-2021-11-11-215412.ips
System Preferences-2021-11-11-215419.ips
System Preferences-2021-11-11-215426.ips
System Preferences-2021-11-11-215439.ips
System Preferences-2021-11-11-215513.ips
System Preferences-2021-11-11-215520.ips
_ls.txt
avatarsd-2021-11-11-081841.ips
avatarsd-2021-11-11-083453.ips
avatarsd-2021-11-11-094034.ips
avatarsd-2021-11-11-100347.ips
avatarsd-2021-11-11-113228.ips
avatarsd-2021-11-11-114859.ips
avatarsd-2021-11-11-120521.ips
avatarsd-2021-11-11-120531.ips
avatarsd-2021-11-11-122244.ips
avatarsd-2021-11-11-123605.ips
avatarsd-2021-11-11-125217.ips
avatarsd-2021-11-11-131209.ips
avatarsd-2021-11-11-131700.ips
avatarsd-2021-11-11-132331.ips
avatarsd-2021-11-11-134253.ips
avatarsd-2021-11-11-134624.ips
avatarsd-2021-11-11-142729.ips
avatarsd-2021-11-11-142749.ips
avatarsd-2021-11-11-144831.ips
avatarsd-2021-11-11-150844.ips
avatarsd_2021-11-11-083402_Users-MacBook-Pro.crash
avatarsd_2021-11-11-095636_Users-MacBook-Pro.crash
avatarsd_2021-11-11-103811_Users-MacBook-Pro.crash
avatarsd_2021-11-11-105202_Users-MacBook-Pro.crash
avatarsd_2021-11-11-110444_Users-MacBook-Pro.crash
avatarsd_2021-11-11-110954_Users-MacBook-Pro.crash
avatarsd_2021-11-11-111525_Users-MacBook-Pro.crash
avatarsd_2021-11-11-112817_Users-MacBook-Pro.crash
avatarsd_2021-11-11-121142_Users-MacBook-Pro.crash
avatarsd_2021-11-11-121512_Users-MacBook-Pro.crash
avatarsd_2021-11-11-132310_Users-MacBook-Pro.crash
avatarsd_2021-11-11-134043_Users-MacBook-Pro.crash
avatarsd_2021-11-11-134413_Users-MacBook-Pro.crash
avatarsd_2021-11-11-145802_Users-MacBook-Pro.crash
avatarsd_2021-11-11-150413_Users-MacBook-Pro.crash
avatarsd_2021-11-11-150903_Users-MacBook-Pro.crash
avatarsd_2021-11-11-165305_Users-MacBook-Pro.crash
avatarsd_2021-11-11-172910_Users-MacBook-Pro.crash
avatarsd_2021-11-11-182626_Users-MacBook-Pro.crash
avatarsd_2021-11-11-183317_Users-MacBook-Pro.crash
com.apple.BKAgentService-2021-11-13-134207.ips
com.apple.BKAgentService-2021-11-13-134212.ips
com.apple.BKAgentService-2021-11-13-134217.ips
com.apple.BKAgentService-2021-11-13-140337.ips
com.apple.preferences.AppleIDPrefPane.remoteservice-2021-11-13-142538.ips
com.apple.preferences.AppleIDPrefPane.remoteservice-2021-11-13-142543.ips
com.apple.preferences.AppleIDPrefPane.remoteservice-2021-11-13-151651.ips
corespotlightd_2021-11-11-080124_Users-MacBook-Pro.crash
corespotlightd_2021-11-11-080131_Users-MacBook-Pro.crash
corespotlightd_2021-11-11-080136_Users-MacBook-Pro.crash
corespotlightd_2021-11-11-095148_Users-MacBook-Pro.crash
corespotlightd_2021-11-11-095150_Users-MacBook-Pro.crash
corespotlightd_2021-11-11-095152_Users-MacBook-Pro.crash
mdworker-2021-11-11-210352.000.ips
mdworker-2021-11-11-210352.0002.ips
mdworker-2021-11-11-210352.0003.ips
mdworker-2021-11-11-210352.ips
mdworker-2021-11-11-212221.000.ips
mdworker-2021-11-11-212221.ips
mdworker-2021-11-11-212222.000.ips
mdworker-2021-11-11-212222.ips
mdworker-2021-11-11-215735.000.ips
mdworker-2021-11-11-215735.0002.ips
mdworker-2021-11-11-215735.0003.ips
mdworker-2021-11-11-215735.ips
mdworker-2021-11-11-220000.000.ips
mdworker-2021-11-11-220000.ips
mdworker-2021-11-11-220001.000.ips
mdworker-2021-11-11-220001.ips
mdworker-2021-11-11-232104.ips
mdworker-2021-11-11-232105.ips
mdworker-2021-11-11-232108.000.ips
mdworker-2021-11-11-232108.ips
suggestd_2021-11-06-210456_Users-MacBook-Pro.crash

Following instructions from comments I then tried "boot into Recovery and scan your volumes" and got:

enter image description here

enter image description here

And from fsck it seems there are problems on disk3s1 and disk3s5, while disk3s2|disk3s3|disk3s4 all seem good:

enter image description here


Here's a recap of the steps we've taken:

  1. You presented with an initial symptom of System Preferences crashing and iCloud being inaccessible.

  2. I asked to see your crash logs in /Library/Logs/DiagnosticReports, of which there were many and spread across many processes.

  3. We took a look at one of the System Preferences crash logs. Here is an excerpt with the crashing thread's backtrace:

     Thread 3 Crashed:: Dispatch queue: com.apple.root.default-qos
     0   (null) 0x0000000000012604 ERROR_ImageIO_SourceBufferRangeIsNotBigEnough(unsigned char*, unsigned long) + 20
     1   (null) 0x0000000000037925 IIOImageRead::getCFDataBytesAtOffset(void*, unsigned long, unsigned long) + 253
     2   (null) 0x0000000000012521 IIOImageRead::getBytesAtOffset(void*, unsigned long, unsigned long) + 321
     3   (null) 0x000000000003781d IIOImageReadSession::getBytes(void*, unsigned long) + 25
     4   (null) 0x000000000002fa5c read_fn(png_struct_def*, unsigned char*, unsigned long) + 38
     5   (null) 0x0000000000010a8a png_crc_read + 32
     6   (null) 0x0000000000014b34 png_read_IDAT_data + 287
     7   (null) 0x000000000000adf9 _cg_png_read_row + 215
     8   (null) 0x000000000002f879 PNGReadPlugin::DecodeFrameStandard(IIOImageReadSession*, ReadPluginData const&, PNGPluginData const&, IIODecodeFrameParams&) + 1455
     9   (null) 0x00000000000776cf PNGReadPlugin::DecodeUncomposedFrames(IIOImageRead*, GlobalPNGInfo*, ReadPluginData const&, PNGPluginData const&, std::__1::vector<IIODecodeFrameParams, std::__1::allocator<IIODecodeFrameParams> >&) + 87
     10  (null) 0x0000000000043d3d PNGReadPlugin::copyImageBlockSetStandard(InfoRec*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 1755
     11  (null) 0x000000000002e19c PNGReadPlugin::copyImageBlockSet(InfoRec*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 50
     12  (null) 0x000000000001cdcf IIO_Reader::CopyImageBlockSetProc(void*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 161
     13  (null) 0x000000000003aa8b IIOImageProviderInfo::copyImageBlockSetWithOptions(CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 663
     14  (null) 0x000000000001ccca IIOImageProviderInfo::CopyImageBlockSetWithOptions(void*, CGImageProvider*, CGRect, CGSize, __CFDictionary const*) + 876
     15  (null) 0x000000000004146f IIOImagePixelDataProvider::getBytesImageProvider(void*, unsigned long) + 1981
     16  (null) 0x000000000004052c TIFFWritePlugin::writeOne(tiff*, void*, IIOImagePixelDataProvider*, IIODictionary*) + 5136
     17  (null) 0x00000000000055df TIFFWritePlugin::writeAll() + 239
     18  (null) 0x00000000000054b9 IIO_Writer_TIFF::write(void*, void*) + 27
     19  (null) 0x00000000000d62e0 IIOImageDestination::finalizeDestination() + 830
     20  (null) 0x000000000000536e CGImageDestinationFinalize + 104
     21  (null) 0x00000000002bb5c5 +[NSBitmapImageRep(NSBitmapImageFileTypeExtensions) representationOfImageRepsInArray:usingType:properties:] + 2102
     22  (null) 0x0000000000494c31 -[NSBitmapImageRep TIFFRepresentation] + 70
     23  (null) 0x0000000000493f34 -[NSBitmapImageRep encodeWithCoder:] + 30
     24  (null) 0x000000000004bc2d _encodeObject + 1206
     25  (null) 0x000000000004c988 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 371
     26  (null) 0x000000000004bc2d _encodeObject + 1206
     27  (null) 0x000000000004c988 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 371
     28  (null) 0x000000000004bc2d _encodeObject + 1206
     29  (null) 0x000000000061320b __27-[NSImage encodeWithCoder:]_block_invoke.529 + 1063
     30  (null) 0x0000000000612886 -[NSImage encodeWithCoder:] + 1458
     31  (null) 0x000000000004bc2d _encodeObject + 1206
     32  (null) 0x0000000000012d69 -[NSPrefPaneBundle encodeWithCoder:] + 497
     33  (null) 0x000000000004bc2d _encodeObject + 1206
     34  (null) 0x000000000004c988 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 371
     35  (null) 0x000000000004bc2d _encodeObject + 1206
     36  (null) 0x000000000004c988 -[NSKeyedArchiver _encodeArrayOfObjects:forKey:] + 371
     37  (null) 0x000000000004cdfb -[NSDictionary(NSDictionary) encodeWithCoder:] + 731
     38  (null) 0x000000000004bc2d _encodeObject + 1206
     39  (null) 0x000000000004b1f5 +[NSKeyedArchiver archivedDataWithRootObject:requiringSecureCoding:error:] + 96
     40  (null) 0x0000000000013ae4 __59-[NSPrefPanesCenter _writeCache:isSystemCache:synchronous:]_block_invoke + 1503
     41  (null) 0x0000000000002cc9 _dispatch_client_callout + 8
     42  (null) 0x0000000000005746 _dispatch_continuation_pop + 460
     43  (null) 0x0000000000016a5a _dispatch_source_invoke + 2150
     44  (null) 0x000000000000526d _dispatch_queue_override_invoke + 463
     45  (null) 0x00000000000123ba _dispatch_root_queue_drain + 343
     46  (null) 0x0000000000012b5a _dispatch_worker_thread2 + 160
     47  (null) 0x0000000000003049 _pthread_wqthread + 256
     48  (null) 0x000000000000201b start_wqthread + 15
    

    Basically, System Preferences crashed because it couldn't read an image file from your hard disk. This is not a typical crash and suggests one of three possibilities:

    1. You are completely out of disk space.
    2. You are out of RAM (and also out of disk space such that virtual memory would fail to help)
    3. The file is corrupted.
  4. I ruled out #1 and #2 by asking you to run df -h and vm_stat, respectively, and found that you have ample storage space and available RAM. This means that we have to consider #3, that the file is corrupted.

  5. Given what you said about just having performed a major OS upgrade, I suspected that something worse might have happened: Your entire filesystem might have corruption. So we checked by booting into Recovery and running Disk First Aid.

  6. Unfortunately, my suspicions were correct: Your hard disk is corrupted.

Now that we know what the real issue is, you need to follow the usual process of dealing with filesystem damage:

Stop using your machine immediately. Turn it off as soon as it's practical. Do not attempt to repair the disk. Do not power the machine back on until you're ready to recover data. Any time the drive is powered on, you are risking further damage.

Then:

  1. If you have a known-good, up-to-date backup of all of your data, the easiest path is to do a full erase & install of macOS and restore your data.
  2. If you don't have a full backup, you will need to place your Mac into Target Disk Mode and use a second Mac to transfer your files – most critical ones first! – onto a rescue drive. Be aware that this process can introduce new damage on your corrupted drive, so be tactical about which files get rescued first. You should expect that certain rescued files may themselves contain corrupted data. You may also find that you get strange failures when you attempt to rescue the files; this is all due to the corruption.
  3. Once you've recovered all the files you need, do a full erase & install and restore, as above.

Finally, any time that a drive gets corrupted, there is always the possibility that it happened due to a further underlying root cause. Therefore, after your data is backed up & restored and you have macOS reinstalled:

  1. Use Apple Diagnostics to do a basic check of your hardware health.
  2. Boot into Recovery again to re-scan your drive to ensure it doesn't have new corruption.
  3. Maintain at least one consistent backup at all times (via Time Machine or otherwise) and be vigilant for new strange behavior.