deb-systemd-invoke.
Run commands with systemd's execution environment
SYNOPSIS
deb-systemd-invoke [OPTIONS...] ACTION [UNIT...]
PARAMETERS
--quiet
Suppress all output
--root=PATH
Use alternative filesystem root
ACTION
Operation like start, stop, enable, disable, restart, status, reload, mask, unmask, preset
UNIT
Target systemd unit file name (e.g., foo.service)
DESCRIPTION
deb-systemd-invoke is a helper script in Debian systems, part of the systemd-shim or systemd-sysv packages. It enables package maintainer scripts to invoke systemd unit operations (like start, stop, enable, disable) without requiring systemd as PID 1.
The script checks if systemd is the init system (/proc/1/comm contains 'systemd'). If yes, it delegates to systemctl. Otherwise, it falls back to SysV tools like update-rc.d for boot-time enabling/disabling or invoke-rc.d for runtime control.
This ensures smooth package installation/upgrades across init systems (SysV, Upstart, OpenRC). It supports most common systemctl actions but is not a full replacement. Primarily for postinst, prerm scripts in debian/rules, avoiding direct systemctl calls that fail on non-systemd setups.
Usage prevents errors like 'Failed to connect to bus' on legacy systems, promoting init-agnostic packaging.
CAVEATS
Warning: For maintainer scripts only; unreliable for interactive/shell use. Outputs may vary by init system. Not all systemctl features supported.
SUPPORTED FALLBACKS
Runtime: invoke-rc.d; Boot enable/disable: update-rc.d; No-op for unsupported actions on non-systemd.
EXAMPLE USAGE
deb-systemd-invoke enable foo.service
deb-systemd-invoke --quiet start foo.service
HISTORY
Introduced in Debian wheezy (2013) via systemd-shim for gradual systemd adoption. Evolved in jessie (2015) with full init detection. Maintained in systemd-sysv post-jessie; usage declined as systemd became default.
SEE ALSO
systemctl(1), update-rc.d(8), invoke-rc.d(8)


