DEV Community

Valentin Boettcher
Valentin Boettcher

Posted on

2

How to use the Systemd userspace DBus API on Traivis-CI

I am currently working on a project which involves talking to the systemd userspace session via the session dbus instance.

After some fiddling around and enabling debug mode on travis via the excellent user support, I came up with the following.

Travis uses VMs that run ubuntu which comes with systemd.
To enable the userspace dbus session, one has to install the dbus-user-session package. After the installation, it has to be activated through systemctl --user start dbus. Furthermore one has to set the DBUS_SESSION_BUS_ADDRESS environment variable through export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus.

TL;DR

script:
  - sudo apt update
  - sudo apt install dbus-user-session
  - systemctl --user start dbus
  - export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus

Top comments (0)

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay