Jeff Johnson (My apps, PayPal.Me, Mastodon)

Feedback Assistant Boycott

macOS Sonoma bug: Can't create disk image containing locked file

May 27 2024

Two days ago I updated my main development Mac from Ventura to Sonoma. Besides the bugs already mentioned yesterday, I've found another new bug. This bug did not exist in Ventura and earlier. You can reproduce the bug via the GUI or Terminal.

  1. Create a new folder in Finder
  2. Create a new file, for example a text file, and save it in the new folder
  3. Select the new file in Finder and open the Get Info window (⌘I keyboard shortcut)
  4. In the Get Info window, lock the file with the Locked checkbox
  5. Open the Disk Utility app
  6. From the main menu, select File, New Image, Image from Folder…
  7. Choose the new folder
  8. Save the disk image

On Sonoma, I get "Operation failed with status 1: Operation not permitted", but it succeeds on Ventura and earlier.

And reproducing with Terminal:

% cd /Users/Shared
% mkdir test
% touch test/test
% chflags uchg test/test
% hdiutil create -format UDZO -srcfolder test -verbose test.dmg

This also fails on Sonoma but not on Ventura and earlier. (I used /User/Shared instead of, say, ~/Desktop to avoid any issues with TCC permissions.)

copying /Users/Shared/test to /Volumes/test
About to copy "/Users/Shared/test".
copy error (canceling): /Volumes/test/test: Operation not permitted
Copy finished with error 1 (Operation not permitted).

But creating the disk image succeeds on Sonoma if the uchg (user immutable) flag is removed. (See man chflags for details.)

% chflags nouchg test/test
% hdiutil create -format UDZO -srcfolder test -verbose test.dmg

Unfortunately, sudo hdiutil has the same problem with locked files and doesn't work either. Also ineffective are the -anyowners and -skipunreadable options. This is a really bad bug! I'm not aware of any workaround, other than unlocking the locked files.

I encountered this Sonoma bug while trying to make an encrypted backup of my home directory, which I do every day. It wasn't an issue on Ventura, but it's an issue now that I've updated to Sonoma. I'm terrified that this bug is also going to break my full disk backup method, which I've described before. That would cause a lot of problems for me, and I may come to rue the day that I installed Sonoma.

By the way, I've discovered a reference to the bug from back in December in the Apple Discussion Forums.

It's very frustrating that Apple keeps breaking things that used to work. This reminds me of the macOS Ventura 13.3.1 bug where hdiutil chpass silently failed with encrypted sparse bundles. That bug also caused me problems, and it wasn't ever fixed in Ventura, though it's now fixed in Sonoma. It doesn't help when a macOS update fixes one bug only to introduce another bug.

Feedback Assistant Boycott

Jeff Johnson (My apps, PayPal.Me, Mastodon)