Friday, December 08, 2006

Apple kb: unable to delete file - system immutable flag

Wow. This is ugly. There's a defect in OS X where the "system immutable bit" is applied incorrectly, the result is an immortal file or folder. The fix is non-trivial:
Unable to move, unlock, modify, or copy an item in Mac OS X

... If you have attempted to unlock a file in the Finder but it is still locked, follow these steps to remove the system immutable bit from affected files, which can cause this issue.

Mac OS X 10.4 or later

1. Start in single-user mode; for instructions see Mac OS X: How to Start up in Single-User or Verbose Mode.
2. Type this, followed by Return: mount -uw /
3. Type this, followed by Return:
cd /Library/Preferences/SystemConfiguration

4. Type this, on a single line, followed by Return:
defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

5. Type this, followed by Return: sh /etc/rc

6. Wait for the on screen text to stop scrolling and then press Return
7. Type this, followed by Return:
find / -flags schg -exec chflags noschg {} \;

8. Once this is finished, type this followed by Return:
rm /Library/Preferences/SystemConfiguration/autodiskmount.plist

9. Type this followed by Return: reboot
Geez, why not ask users to fire up a hex editor? I had a delete problem once (only), but the OS X 'secure delete' (it's on the Finder menu) took care of it. Next I'd try using Disk Utility and/or fsck. This would be my very last option. One hopes Apple will deal with this in a future version of Disk Utility -- or figure out how this bug gets triggered.

No comments: