Products › lamco-dbus-tools › Interfaces

UpdateActivationEnvironment: When a D-Bus service starts too early

UpdateActivationEnvironment sets the environment of D-Bus services started later, so lamco-dbus-tools flags a service that started before the session set it.

D-Bus method org.freedesktop.DBus.UpdateActivationEnvironment

org.freedesktop.DBus.UpdateActivationEnvironment is the method a login session uses to tell the bus which environment variables the services it starts should get. Login scripts and desktop startup call it to pass on what they set. The trouble comes when a service starts before the call: It runs without what was set, nothing fails, and nothing is logged. lamco-dbus-tools records the call when it crosses the bus and says when a service took its name before the environment was complete.

What it is

The method belongs to org.freedesktop.DBus and takes one argument, an array of string-to-string dictionary entries: The variables to add or update. The specification says that services the session bus starts normally inherit the bus daemon's environment, and that this method adds to or changes that environment for services started afterwards. Names and values must be valid UTF-8. It says too that some buses, such as the standard system bus, may refuse the method to some or all callers.

Three things follow, and each matters when debugging:

  • It changes nothing for a service that's already running. A program's environment is set when it starts.
  • It returns nothing, and the specification defines no signal for it. A service has no way of telling it started early.
  • Whatever starts the service decides what it inherits. dbus-daemon starts a service itself, or asks the service manager when the service file names a unit. dbus-broker's launcher always has the service manager start it, in a unit of the service file's or in one of its own making.

A sandbox's proxy refuses it: xdg-dbus-proxy denies UpdateActivationEnvironment from the application inside.

How lamco-dbus-tools reads it

dbussee record records the call when it crosses the bus, like any other. A recording keeps the variables' names and never their values. dbusdo has no command for it. dbustell activation follows each start from request to name taken, and says when the activation environment changed relative to it. dbustell findings raises ACT-005 when the bus took an UpdateActivationEnvironment after the service took its name, and names the variables. A service already running when the recording began can't be judged.

dbussee record --all --duration 12 --out started-early.json   # record the login, or the start, as it happens
dbustell activation started-early.json                       # each start, and when the environment changed
dbustell findings started-early.json                         # ACT-005, naming the variables set too late

In the use case below, a session service started before a login script set the variable it reads. dbustell activation said dbus-broker's launcher ran it in a unit of its own making, and ACT-005 named the variable.

Where it has been run

The README's run record lists each of ACT-001 to ACT-006 raised from a recording that holds it, and none from a clean start, on private buses with dbus-daemon 1.16.2 and dbus-broker 37 on 2026-11-29 and 2026-11-30. The use case "A service started too early" was run from its own recording, named on its page, among the use cases run between 2026-11-30 and 2026-12-02.

Findings

  • ACT-005: A service started before the activation environment was complete.
  • ACT-006: A service was started outside the unit meant for it.

Related