LinuxCommandLibrary

ctrlaltdel

Reboot the system (often indirectly)

TLDR

Get current setting

$ ctrlaltdel
copy

Set CTRL+ALT+DEL to reboot immediately, without any preparation
$ sudo ctrlaltdel hard
copy

Set CTRL+ALT+DEL to reboot "normally", giving processes a chance to exit first (send SIGINT to PID1)
$ sudo ctrlaltdel soft
copy

SYNOPSIS


The "ctrlaltdel" action is initiated by simultaneously pressing the Control, Alt, and Delete keys.

There is no direct command-line executable named "ctrlaltdel" that accepts options or arguments in the conventional sense. Its behavior is instead defined and configured by the system's initialization process and related services.

For configuring the action in systemd-based systems, relevant commands and configuration files include:
systemctl mask ctrl-alt-del.target
systemctl unmask ctrl-alt-del.target
And modifying /etc/systemd/logind.conf.

For configuration in SysVinit-based systems, the relevant configuration file is:
/etc/inittab (specifically the 'ca' action entry)

PARAMETERS

None directly for the key sequence itself.
    The Ctrl+Alt+Del key combination does not accept command-line parameters directly.

HandleCtrlAltDel (systemd logind.conf)
    In systemd, this option within the `/etc/systemd/logind.conf` file (or its overrides in `/etc/systemd/logind.conf.d/`) determines the action taken when Ctrl+Alt+Del is pressed. Possible values include `reboot` (default), `poweroff`, or `ignore`. Example: HandleCtrlAltDel=ignore.

Target overriding (systemd)
    The ctrl-alt-del.target is a systemd target unit. Its behavior can be altered by masking it (e.g., systemctl mask ctrl-alt-del.target) to prevent the default action, or by linking it to a different target (though less common for this specific target).

SysVinit 'ca' entry parameters
    In SysVinit, the 'ca' entry in `/etc/inittab` specifies a command to execute (e.g., /sbin/shutdown -t1 -a -r now). Parameters like `-r` (reboot), `-h` (halt), or `now` are arguments passed to the executed command (e.g., `shutdown`), not to 'ctrlaltdel' itself.

DESCRIPTION

The Ctrl+Alt+Del key combination is a special input sequence widely recognized in computing, used in Linux systems to initiate a system reboot or shutdown. Unlike typical shell commands, "ctrlaltdel" is not an executable program itself but rather a specific keyboard event interpreted by the operating system's initialization process.

In modern Linux distributions that utilize systemd, the Ctrl+Alt+Del sequence is intercepted and handled by the systemd-logind service. By default, it triggers a system reboot by activating the ctrl-alt-del.target which ultimately calls `systemctl reboot`. This behavior is configurable and can be modified to power off the system, ignore the key sequence entirely, or perform a custom action.

In older Linux systems using SysVinit, the `init` process would monitor for this key sequence and execute a predefined action specified in the `/etc/inittab` file, typically involving the `shutdown` command to perform a graceful system restart. It serves as a vital mechanism for administrators to perform a controlled system restart, especially in situations where the system may become unresponsive or for routine maintenance.

CAVEATS

Modifying the default behavior of Ctrl+Alt+Del typically requires root or sudo privileges. Disabling this key combination can potentially make it harder to gracefully reboot an unresponsive system, forcing a hard reset instead. In graphical desktop environments (like GNOME, KDE), the key combination might be intercepted by the desktop environment itself to display a logout/shutdown dialog before the kernel or systemd handles it.

DISABLING/ENABLING CTRL+ALT+DEL IN SYSTEMD

To disable the immediate reboot action (leaving it to the graphical environment or ignoring it):
sudo systemctl mask ctrl-alt-del.target
To re-enable the default reboot action:
sudo systemctl unmask ctrl-alt-del.target

Alternatively, you can edit /etc/systemd/logind.conf and set `HandleCtrlAltDel=ignore`, then restart the service: sudo systemctl restart systemd-logind.

DISABLING/ENABLING CTRL+ALT+DEL IN SYSVINIT

To disable the action in older SysVinit systems, comment out or remove the 'ca' line in /etc/inittab (e.g., #ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now). After modifying the file, inform `init` to reload its configuration: sudo init q or sudo telinit q.

HISTORY

The Ctrl+Alt+Del key combination originated with IBM PC systems, reportedly designed by David Bradley to provide a quick way to soft-reboot the original PC. It was widely adopted by MS-DOS and subsequently Windows as a 'warm boot' mechanism.

Linux adopted this concept early on. In systems using SysVinit, the `init` process was configured via `/etc/inittab` to listen for this key sequence and execute a defined command (usually `shutdown`). This allowed for a graceful shutdown or reboot, helping to prevent data loss.

With the advent of systemd, the handling of Ctrl+Alt+Del transitioned to the systemd-logind service. This provides a more integrated and flexible approach to power management events within the modern Linux ecosystem, while preserving the original intent of offering a failsafe or convenient way to restart the system.

SEE ALSO

init(8), systemd(1), systemctl(1), shutdown(8), reboot(8), logind.conf(5), inittab(5), systemd-logind(8)

Copied to clipboard