Activation problem: shell script

Dave Lee mailtolky at
Sat Apr 21 02:55:09 PDT 2012

hello. I am trying to set up dbus activation for a service (running on system bus). The service file looks like this:

[D-BUS Service]

The Exec= line specifies a shell script, which basically read options from a config file, and then
launch a daemon with these options as arguments.

I found that if my script's hashbang is #!/bin/sh, dbus won't do activation. When I launch a client,
it will attempt to activate the service, but then will show an error:

ERROR: Failed to connect to XXXXX: org.freedesktop.DBus.Error.Spawn.ExecFailed: Cannot launch daemon, file not found or permissions invalid
ERROR: Failed to connect to daemon (bus: 'system')!

However if the hashbang is #!/usr/bin/env sh, activation works.

Why does the hashbang make a difference? Thanks.

More information about the dbus mailing list