dbus-cleanup-sockets
Remove stale D-Bus socket files
SYNOPSIS
dbus-cleanup-sockets
PARAMETERS
(None)
This script typically does not accept any command-line options or arguments. It performs its function without needing user input beyond its invocation.
DESCRIPTION
This utility script is an integral part of the D-Bus message bus system.
Its primary function is to locate and remove D-Bus session socket files that have become stale or orphaned. These files are typically found in transient directories like `/tmp` or `XDG_RUNTIME_DIR` (e.g., `/run/user/
A socket is considered stale if the D-Bus session daemon that created it is no longer running, leaving behind an unusable file.
Removing these defunct sockets is crucial to prevent potential issues with new D-Bus sessions, such as `dbus-daemon` failing to bind to an address, or applications attempting to connect to a non-existent bus. It helps maintain a clean and functional D-Bus environment.
It is commonly invoked by system services or desktop environment startup scripts as a routine maintenance task.
CAVEATS
Permissions: The script requires appropriate file system permissions to delete files in the directories where D-Bus session sockets are typically created (e.g., `/tmp`, `/run/user/
Scope: It primarily targets session bus sockets, which are created per user session. The system bus socket (e.g., `/var/run/dbus/system_bus_socket`) is managed differently and is not cleaned by this utility.
System Integration: While helpful for system hygiene, its direct invocation by end-users is rare. It's usually part of system-level cleanup or startup routines managed by the operating system or desktop environment.
<B>PURPOSE AND RATIONALE</B>
The script's main purpose is to prevent resource exhaustion (e.g., too many open files, address binding conflicts) that can arise from leftover D-Bus socket files. These files are crucial for inter-process communication within D-Bus, but if they persist after their associated `dbus-daemon` process has died, they become defunct and can hinder new session startups.
<B>TYPICAL INVOCATION</B>
This utility is rarely invoked manually by an end-user. Instead, it is commonly executed by system-wide cleanup scripts (e.g., `/etc/cron.daily/dbus-cleanup`), during desktop environment startup (e.g., GNOME, KDE), or as part of a system's initialization sequence to ensure a clean D-Bus state for new sessions.
HISTORY
dbus-cleanup-sockets is a supporting utility script that has been part of the D-Bus package since its early development. It was introduced to address the practical challenge of managing temporary socket files that could accumulate and cause issues, especially in environments where D-Bus sessions might not always terminate gracefully. Its evolution is tied to the D-Bus messaging system itself, serving a consistent role in maintaining system cleanliness and reliability rather than undergoing significant standalone development or feature additions.
SEE ALSO
dbus-daemon(1), dbus-launch(1), dbus-run-session(1)