LinuxCommandLibrary

systemctl-halt

Halt the system without powering off

TLDR

Halt the system

$ systemctl halt
copy

Halt the system immediately without asking services to stop gracefully
$ systemctl halt --force
copy

Halt the system immediately without sending notifications to logged-in users
$ systemctl halt --force --no-wall
copy

Halt the system immediately without terminating any processes or unmounting filesystems (dangerous, may cause data loss)
$ systemctl halt --force --force
copy

Schedule a halt at a specific time (e.g., 23:00)
$ systemctl halt --when 23:00
copy

Schedule a halt after a certain duration (e.g., 2 hours)
$ systemctl halt --when +2h
copy

Cancel a scheduled halt
$ systemctl halt --when cancel
copy

SYNOPSIS

systemctl [OPTIONS] halt

PARAMETERS

-f, --force
    Force the operation. This can be used to skip certain checks or to proceed with a shutdown even if some services fail to stop gracefully. Use with caution, as it can lead to data loss if not used properly.

--no-block
    Do not wait for the operation to finish. The command will return immediately after initiating the shutdown process, allowing scripts to continue execution.

--no-wall
    Do not send out a wall message to all logged-in users before halting the system. By default, a broadcast message is sent to inform users of the impending shutdown.

--system
    Operate on the system's manager instance. This is the default behavior when dealing with system-wide services and power management, making it implicitly used for 'halt'.

DESCRIPTION

The systemctl halt command is part of the systemd init system, commonly used on modern Linux distributions. It initiates a graceful shutdown procedure for the operating system. When invoked, systemctl halt signals systemd to bring down all running services, unmount filesystems cleanly, and stop the kernel. The primary goal is to ensure all data is safely written to disk and processes are terminated in an orderly fashion, preventing data corruption or loss.

Historically, the halt command would stop the kernel but leave the system powered on, requiring a manual power-off. In contemporary systemd environments, systemctl halt often behaves identically to systemctl poweroff, meaning it not only stops the system but also initiates a complete power down of the hardware. This behavior is typically configured to ensure a full shutdown unless specific ACPI or system settings dictate otherwise. It's the modern, recommended way to prepare a Linux system for a complete power-off.

CAVEATS

On most modern Linux distributions running systemd, systemctl halt behaves identically to systemctl poweroff, resulting in a complete power down of the hardware. The traditional distinction where halt would stop the system but keep power on is rarely observed unless specific hardware or ACPI configurations are in place.

Always ensure all critical applications have saved their data before initiating a halt or poweroff, as graceful shutdowns, while designed to prevent data loss, cannot guarantee the state of unsaved application data. Executing this command requires appropriate privileges, typically root access or membership in a group with sudo permissions.

TARGETS

In systemd, power management operations like halting, rebooting, and powering off are implemented as target units. systemctl halt activates the halt.target unit, which in turn orchestrates the shutdown process by stopping services and unmounting filesystems. Similarly, poweroff.target and reboot.target handle their respective actions, providing a structured approach to system state changes.

PERMISSIONS

To execute systemctl halt, a user typically requires root privileges. This is because shutting down the entire system is a critical operation that affects all users and services, potentially causing disruption or data loss. Users often employ sudo to elevate their privileges for this command, ensuring proper authorization and control over system-wide actions.

HISTORY

The concept of halting a system dates back to the early days of Unix-like operating systems, traditionally handled by the halt command. With the advent of systemd as the default init system for many Linux distributions (starting predominantly in the 2010s), power management functions, including halting, rebooting, and powering off, were centralized under the systemctl utility. This transition aimed to provide a unified and more robust mechanism for system control, replacing older SysVinit scripts and utilities. systemctl halt now serves as the modern interface to trigger the halt.target unit within systemd, abstracting the underlying shutdown procedures and ensuring a consistent and managed system termination.

SEE ALSO

systemctl poweroff(8), systemctl reboot(8), shutdown(8), halt(8), reboot(8), systemd(1), systemd.special(7)

Copied to clipboard