[launchd-dev] Cause of "Service cannot load in requested session"?

James Bucanek subscriber at gloaming.com
Mon Nov 16 14:38:48 PST 2015


> Damien Sorresso <mailto:dsorresso at apple.com>
> November 16, 2015 at 9:25 AM
> On 13 Nov, 2015, at 18:32, James Bucanek <subscriber at gloaming.com 
> <mailto:subscriber at gloaming.com>> wrote:
>> So now you're telling me that per-user Background agents aren't 
>> supported either? :head desk:
>
> I'm not sure what you mean by "either".
What I mean by "either" is this:

(1) Admin installed per-user background agents (/Library/LaunchAgents) 
don't work because the new launchctl can't seem to address them (see 
previous thread in July).

(2) Home-folder installed per-user background agents 
(~/Library/LaunchAgents) don't work, because they just don't work. 
launchd never starts them.

So if I want to use per-user agents that run in the Background session, 
I'm essentially out of luck.

> launchd cannot reliably support loading background agents from a 
> user's home directory because the home directory might not be 
> available until a GUI login has happened.

I understand that, but the discussion of loading background agents from 
the user's home directory has always been qualified by the edge cases 
("the home directory *might* not be available until a GUI login" so 
blah, blah, blah).

I'm saying it's broken because these jobs never load under any 
circumstances. I can install a virgin copy of OS X on an iMac with a 
single volume, no encryption, no legacy FileVault, no NFS mounts, 
nothing special. The home folder is constantly available from the moment 
the power button come on until the system shuts down again, and a 
background user agent installed in the home folder won't start---ever.

Now if by "launchd cannot reliably support loading background agents 
from a user's home directory" you mean "because loading background 
agents from the user's home folder is unreliable, launchd doesn't even 
try", then we're in 100% agreement. :)

Which, inevitably, brings me back to looking for a solution to running a 
per-user agent in the background session so that (a) it will, with a 
little help, be started before the user logs in (ignoring edge cases 
where the user's home folder might not be available), (b) can be 
dependably controlled via launchctl so that all instances of the agent 
can be started, stopped, installed, and uninstalled to support installs, 
upgrades, and uninstalls, and (c) will continue to run after the user 
logs out.

James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/launchd-dev/attachments/20151116/7f1d70bf/attachment.html>


More information about the launchd-dev mailing list