Thursday, April 26, 2012

Enabling Upstart user jobs to start at boot.

I've come across an issue with Upstart – user jobs' start on stanzas aren't honored at boot time.

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:

Tuesday, April 10, 2012

Can't exec "dpkg-architecture" … on Ubuntu 11.10

Ran into a puzzling problem today setting up PostgreSQL 9.1. After creating a user and logging in, I was greeted with:

$ psql postgres brad
Can't exec "dpkg-architecture": No such file or directory at /usr/bin/psql line 103.
Use of uninitialized value $multiarch in scalar chomp at /usr/bin/psql line 104.
psql (9.1.3)
Type "help" for help.


It seems the package dpkg-dev wasn't installed for some reason…

Easy fix:

sudo apt-get install dpkg-dev

Monday, April 9, 2012

Compiling Python on OSX 10.8

Python 2.6 – OSX Lion

make install