moonD4rk/HackBrowserData · error
dbus session: %w
Error message
dbus session: %w
What it means
DBusRetriever (Linux V11 tier) needs a D-Bus session bus to talk to GNOME Keyring / KDE Wallet via the Secret Service API. dbus.SessionBus() failed — typically DBUS_SESSION_BUS_ADDRESS is unset or points at a dead socket — so no keyring query can be attempted.
Source
Thrown at masterkey/retriever_linux.go:28
keyring "github.com/ppacher/go-dbus-keyring"
)
// https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc
var linuxParams = pbkdf2Params{
salt: []byte("saltysalt"),
iterations: 1,
keySize: 16,
hashFunc: sha1.New,
}
// DBusRetriever queries GNOME Keyring / KDE Wallet via D-Bus Secret Service.
type DBusRetriever struct{}
func (r *DBusRetriever) RetrieveKey(hints Hints) ([]byte, error) {
storage := hints.KeychainLabel
conn, err := dbus.SessionBus()
if err != nil {
return nil, fmt.Errorf("dbus session: %w", err)
}
svc, err := keyring.GetSecretService(conn)
if err != nil {
return nil, fmt.Errorf("secret service: %w", err)
}
session, err := svc.OpenSession()
if err != nil {
return nil, fmt.Errorf("open session: %w", err)
}
defer session.Close()
collections, err := svc.GetAllCollections()
if err != nil {
return nil, fmt.Errorf("get collections: %w", err)
}
View on GitHub (pinned to 0503d04d7a)
Solutions
- Run inside the desktop session, or export the bus address first: export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
- Verify the socket exists: ls /run/user/$(id -u)/bus (start systemd user session if missing)
- Use `sudo -u <user> env DBUS_SESSION_BUS_ADDRESS=... ` when querying another user's keyring
- If no keyring exists at all, accept the V10 fallback — PosixRetriever derives the key from PBKDF2("peanuts") without D-Bus
Example fix
# before cron: 0 * * * * hack-browser-data # after cron: 0 * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus hack-browser-data
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("DBUS_SESSION_BUS_ADDRESS") == "" {
os.Setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path=/run/user/"+strconv.Itoa(os.Getuid())+"/bus")
} Try / catch
key, err := dbusRetriever.RetrieveKey(hints)
if err != nil {
if strings.HasPrefix(err.Error(), "dbus session:") {
key, err = posixRetriever.RetrieveKey(hints) // v10 fallback, no keyring needed
}
} Prevention
- Export DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR when running over SSH/cron/systemd
- Run the tool inside the desktop user session (or with machinectl/sudo -E) rather than a bare service context
- Detect headless environments up front and use the v10 PosixRetriever directly
- Check the bus socket exists (/run/user/<uid>/bus) before attempting keyring retrieval
When it happens
Trigger: Calling RetrieveKey on Linux when there is no user session bus: SSH without DBUS_SESSION_BUS_ADDRESS exported, systemd user session not running, cron/systemd service, Docker container, or a stale XDG_RUNTIME_DIR.
Common situations: Running the tool from an SSH session, CI job, cron job, or container that inherited no desktop session environment; switching users with su without importing the session env.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of moonD4rk/HackBrowserData@0503d04d7a (2026-09-06).
Data as JSON: /api/errors/a3bd251a22b7185b.
Report an issue: GitHub.