I'm currently writing some single user mode maintenance scripts. My current goal is to be able to perform permission repairs and disk formatting using the diskutil command in Single User Mode. Performing this task in previous versions of OS X was a simple matter of mounting the root partition and launching the following launch daemons:
com.apple.diskmanagementd
com.apple.diskarbitrationd
After that, I only needed to run the following command to successfully repair permissions:
diskutil repairpermissions /
In Mavericks, however, this command no longer works and I can't figure out why. Running the diskutil command (even with no parameters) returns a simple and unhelpful message:
Killed: 9
I can't figure out what's going on here. In addition to the disk arbitration daemons that diskutil requires, my maintenance script also loads the following daemons:
com.apple.notifyd
com.apple.syslogd
com.apple.configd
com.apple.kuncd
com.apple.kextd
com.apple.KernelEventAgent
com.apple.distnoted.xpc.daemon
com.apple.aslmanager
com.apple.opendirectoryd
com.apple.coreservicesd
com.apple.securityd
com.apple.fseventsd
com.apple.cfprefsd.xpc.daemon
I get the same response whether I load all of the above daemons or just the two that were previously required for diskutil to operate. If I choose to boot from single user mode (by loading the entire contents of /System/Library/LaunchDaemons) I can use diskutil after the computer has finished its boot process.
Can someone more knowledgeable about the inner workings of the Mac OS possibly determine what's missing?
Best Answer
I'm not sure what's causing the problem, but it doesn't seem to be a missing daemon -- I tried loading everything in
/System/Library/LaunchDaemons
exceptcom.apple.WindowServer.plist
, and it still failed the same way. It even fails just runningdiskutil
, which normally just prints a usage summary. Also, "Killed: 9" suggests it isn't crashing itself, but something else (launchd
?) is killing it.Anyway, there is a bit of good news:
diskutil repairpermissions
is really just a front end for therepair_packages
program, and that seems to run fine in single-user mode (even with no daemons at all loaded):Formatting disks will probably be more difficult. You may have to look at using
gpt
,newfs_hfs
, and the like.