The real issue is more general: user jobs aren't loaded into Upstart until the user creates an Upstart session. If a job isn't loaded into Upstart, it's basically invisible and hence its start on stanzas won't be honored.
Loading user jobs into Upstart is simple. It happens automatically when a user creates an Upstart session by connecting via D-Bus using initctl or one of the shortcuts (e.g. start or status). Until user jobs are loaded into Upstart, they're completely disabled.
So the problem at boot time is that user's don't have the opportunity to create an Upstart session prior to the rc-sysinit job emitting runlevel, this makes it impossible for user jobs with start on runlevel [2345] to be honored.
Perhaps this is by design – I'm not sure – but I wrote the following job to get around the issue by blocking rc-sysinit and creating an Upstart session for each user with an .init/ directory in their home:
The following job should be installed into /etc/init/load-user-jobs.conf:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
author 'Bradley Ayers' | |
description 'Enables user job "start on" stanzas to be honored at boot' | |
task | |
start on starting rc-sysinit | |
script | |
cat /etc/passwd | while read line | |
do | |
user=`echo $line | cut -d: -f1` | |
home=`echo $line | cut -d: -f6` | |
if [ -d "$home/.init" ] | |
then | |
sudo -u $user initctl status rc-sysinit | |
fi | |
done | |
end script |