[launchd-dev] launchctl unload not working

Dave Zarzycki zarzycki at apple.com
Thu Nov 29 08:58:21 PST 2007


James,

You're clearly seen where the OS is headed. For better and for worse,  
you have also are discovering the edge cases of where our vision isn't  
completely implemented. Let's have a conference call. I'll contact you  
offline. For the rest of the people on this email list, please note, I  
cannot offer this level of service to any developer/customer, but at  
the moment, I think I have the time.

davez


On Nov 29, 2007, at 7:51 AM, James Bucanek wrote:

> Kevin Van Vechten <mailto:kvv at apple.com> wrote (Wednesday, November  
> 28, 2007 12:08 AM -0800):
>
>> I recommend reading the "Daemonomicon" <http://developer.apple.com/technotes/tn2005/tn2083.html#SECDAEMONOMICON 
>> >.
>
> Been there, read that. (This is the one technote I keep on my  
> desktop.)
>
>> Short summary pertinent to your symptoms:
>>
>> - Root (uid 0) launchd loads jobs from LaunchDameons directories.   
>> Use `sudo launchctl` to communicate with it.
>
> Exactly. Since this is a daemon installed in /Library/LaunchDaemons  
> I was forking launchctl when running as root. But that's when all  
> the trouble started. :(
>
>> - Per-user (uid 501) launchd loads jobs from LaunchAgents  
>> directories.  Use `launchctl` to communicate with it.
>
> This isn't an agent.
>
>> - Per-user launchd ignores the UserName key because it does not  
>> have the privilege to execute as any other user than the current  
>> user.
>> - Per-user mach bootstrap is a sub-bootstrap of the root mach  
>> bootstrap: agents can lookup daemons, but daemons cannot lookup  
>> agents.
>
> I'll try to clean out my system (each instance of launchd seems to  
> have its own, persistent, history of what's been loaded and  
> unloaded) and run my tests again verifying that each execution of  
> launchctl occurs when running as root. From your notes, and reading  
> technote 2083, it appears that I was doing (or I *thought* I was  
> doing) exactly what I I should have been doing: Copy the .plist file  
> to /Library/LaunchDaemons, then invoke 'launchctl load ...' as root  
> to install the daemon and 'launchctl unload ...' to uninstall the  
> daemon.
>
> James
> -- 
> James Bucanek
>
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/launchd-dev



More information about the launchd-dev mailing list