LinuxCommandLibrary

systemctl-poweroff

Power off the system

TLDR

Power off the system

$ systemctl poweroff
copy

Power off the system immediately without asking services to stop gracefully
$ systemctl poweroff --force
copy

Power off the system immediately without sending notifications to logged-in users
$ systemctl poweroff --force --no-wall
copy

SYNOPSIS

systemctl [OPTIONS...] poweroff

PARAMETERS

--force, -f
    Forces an immediate action. When used with poweroff, it skips some shutdown steps and might not wait for all services to stop cleanly, but still attempts to unmount filesystems. Use with caution.

--no-block
    Does not wait for the power-off operation to complete. The command will return immediately, allowing the calling script or session to continue while the system shuts down in the background.

--dry-run
    Shows what would be done without actually executing the power-off operation. Useful for testing and understanding the shutdown sequence without affecting the system state.

--force --force, -ff
    Performs an emergency power-off. This is extremely forceful and skips almost all graceful shutdown procedures, including syncing disk caches and unmounting filesystems. It can lead to data loss and filesystem corruption. Use with extreme caution and only as a last resort.

DESCRIPTION

systemctl poweroff is the modern, recommended command for shutting down and powering off a Linux system running systemd.

When executed, it signals the systemd init system (PID 1) to perform a graceful shutdown. This process involves several critical steps: first, it attempts to stop all active services and processes in an orderly manner. Next, it unmounts all mounted filesystems to ensure data integrity and prevent corruption. Finally, it syncs any pending disk writes to storage before instructing the underlying hardware to cut power.

This command ensures a clean system state before powering down, minimizing the risk of data loss or filesystem damage that can occur with abrupt power disconnections. It replaces older methods like direct invocation of the poweroff command (which often symlinks to systemctl or uses shutdown -h) or manually cutting power.

It requires appropriate user permissions, typically root, or via PolicyKit rules configured for non-root users.

CAVEATS

Requires root privileges or specific PolicyKit permissions.

Forcibly powering off (especially with -ff) can lead to data loss, filesystem corruption, or an unstable system state upon next boot. Always use with extreme caution.

Ensure all users are logged out and critical applications are closed to prevent loss of unsaved work.

GRACEFUL VS. FORCEFUL SHUTDOWN

By default, systemctl poweroff performs a graceful shutdown, stopping services, unmounting filesystems, and syncing data. Using --force or especially --force --force bypasses these steps, potentially leading to data loss but offering an immediate, albeit risky, power-off.

LEGACY EQUIVALENTS

On systemd systems, commands like poweroff (without arguments) and shutdown -h now typically act as wrappers or symbolic links to systemctl poweroff, providing backward compatibility while utilizing the modern systemd shutdown mechanism.

HISTORY

Before the advent of systemd, system shutdown was typically handled by commands like poweroff or shutdown -h, often part of SysVinit or Upstart systems.

With systemd becoming the default init system for many Linux distributions, systemctl was introduced as the primary interface for controlling the system and its services. The poweroff subcommand within systemctl now provides a unified and standardized way to initiate a system shutdown, leveraging systemd's robust service management and shutdown sequence capabilities. On modern systems, the standalone poweroff command is often a symbolic link or a wrapper script that simply executes systemctl poweroff.

SEE ALSO

systemctl(1), reboot(8), halt(8), shutdown(8), systemd(1), logind.conf(5)

Copied to clipboard