Damien,

Thanks for the feedback. Replies inline...

Damien Sorresso <mailto:dsorre...@apple.com>
November 5, 2015 at 9:32 AM
James,

Answers inline...

On 4 Nov, 2015, at 21:44, James Bucanek<subscri...@gloaming.com>  wrote:
Greetings,

I have a user agent installed in the "Background" session that isn't starting 
up on one system.

The Background session is typically only useful for agents which you want to run "as 
the user" independently of whether that user is logged in. In the strictest terms, 
you can't even rely on the home directory for that user being available. So you should be 
sure that this is the session you really want.
I understand. This is exactly the session I want. My product has an option ("Start and run actions when logged out") that allows you install the scheduler agent the "Background" session so that backups and other maintenance can be performed even when logged out (or because you've logged out).

My customer is running OS X 10.11.1. I have this software running on hundreds 
of El Capitan systems, but for some reason this user agent won't start when the 
user logs in.

I've found two things that are suspicious. First, a message like this appears 
in the console log:

system.log: Oct 31 17:45:05 UsersMac otherbsd[488]: Failed to bootstrap agent: 
path = /Users/theuser/Library/LaunchAgents/com.qrecall.scheduler.plist, error = 
134: Service cannot load in requested session

I was really hoping that someone could tell me what error 134 means.

The string representation of the error is printed right after it. Also, you can decode 
launchd's error codes with the `launchctl error` subcommand; in this case it'll print 
"Service cannot load in requested session".

What this means is that one of launchd's helpers, otherbsd, tried loading the 
com.qrecall.scheduler service into the user's Aqua session. The plist almost 
certainly specifies a LimitLoadToSessionType entry which says it can only load 
in the Background session. So launchd refuses to load the service.
So that begs two questions:(1) Why is the service being loaded in the Aqua session? (That might be an artifact of something that's loading it into a session it's excluded from. I get that, and I suppose that could be ignored.)

(2) More importantly, why isn't it being loaded into the Background session when that session is created?

I'm surprised that you say that the home folder might not be available when the Background session is created. How is that possible? The user agent configuration file (~/Library/LaunchAgents/com.qrecall.scheduler.plist) is _inside_ the home folder. How would launchd load an agent service *before* the configuration file that defines that service is readable?

Anyway, I really hope that's never true, because my service has always depended on resources in the home folder (preferences, cache, documents, and such). And in this case, the service executable is also stored in ~/Library/Application Support/, so the home folder has to be available if it's going to start (and it always starts on other systems).

But I'll also ask the user if they're doing anything "clever" with their home folder.

Thanks for any insight,

James
_______________________________________________
launchd-dev mailing list
launchd-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/launchd-dev

Reply via email to