chkconfig
Manage system services at boot time
TLDR
List services with runlevel
Show a service's runlevel
Enable service at boot
Enable service at boot for runlevels 2, 3, 4, and 5
Disable service at boot
Disable service at boot for runlevel 3
SYNOPSIS
chkconfig [--list [name]]
chkconfig [--add name]
chkconfig [--del name]
chkconfig [--level levels] name [on|off|reset]
chkconfig [--override name [on|off]]
chkconfig [--query name]
PARAMETERS
--list [name]
Lists the current runlevel configuration for services. If name is provided, lists configuration for that specific service.
--add name
Adds a new service for management by chkconfig. It reads default runlevel information from the service's init script.
--del name
Removes a service from chkconfig management, deleting its runlevel symlinks.
--level levels
Specifies the runlevels (0-6, S) on which the operation (on/off/reset) should apply. E.g., '35' for runlevels 3 and 5.
name
The name of the service (corresponding to its script name in /etc/init.d/).
on
Enables the service at the specified (or default) runlevels, creating 'S' links.
off
Disables the service at the specified (or default) runlevels, creating 'K' links.
reset
Resets the service configuration to its default runlevel settings as defined in the init script.
--override name [on|off]
Permanently overrides a service's default runlevel configuration, preventing it from being changed by subsequent 'on', 'off', or 'reset' actions unless explicitly specified. Useful for system upgrades that might reset configurations.
--query name
Queries the runlevel configuration for a single service without the full list output.
DESCRIPTION
The chkconfig command is a command-line utility used on Linux systems, primarily those utilizing the System V (SysV) init system, to manage the services that are started or stopped during system boot at various runlevels. It provides a convenient interface for querying, adding, deleting, and setting the runlevel configuration for services.
Historically, SysV init scripts located in /etc/init.d/ are linked into runlevel-specific directories like /etc/rc0.d/, /etc/rc1.d/, ..., /etc/rc6.d/. chkconfig automates the creation and removal of these symbolic links (e.g., SNNname for start, KNNname for kill) in the appropriate /etc/rcX.d/ directories, based on the service's default runlevel configuration found within the script itself.
While many modern Linux distributions have transitioned to systemd as their primary init system, where systemctl is the preferred command for managing services, chkconfig might still be present for compatibility or for managing legacy services that haven't been converted to systemd units. Its main purpose is to configure the boot-time behavior of services, not to start or stop them immediately; for that, commands like service or systemctl are used.
CAVEATS
The chkconfig command is primarily designed for systems using the traditional System V init process.
On modern Linux distributions that have adopted systemd (such as recent Fedora, CentOS/RHEL, Debian, Ubuntu versions), chkconfig's direct functionality is largely superseded by the systemctl command. While chkconfig might still be available for backward compatibility, its use for new configurations or systemd-native services is discouraged.
It requires root privileges to modify service configurations.
chkconfig configures boot-time behavior; it does not start or stop services immediately. To control a service's current running state, use commands like service or systemctl.
RUNLEVELS EXPLAINED
In System V init, a runlevel is a state of the operating system that defines which services are running. Common runlevels include:
0: Halt (system shutdown)
1: Single-user mode (maintenance)
2: Multi-user, without NFS (user-defined)
3: Full multi-user mode (text mode)
4: Unused (user-defined)
5: Full multi-user mode with graphical display (X11)
6: Reboot (system restart)
S (or s): Single-user mode
chkconfig allows you to specify which services start or stop when the system enters or exits these runlevels.
INTERACTION WITH INIT SCRIPTS
For chkconfig to manage a service, the service's init script (e.g., /etc/init.d/httpd) must contain specific LSB (Linux Standard Base) compliance headers. These headers define metadata such as the service's default start/kill priorities and the runlevels at which it should be started by default. chkconfig parses these headers to determine how to configure the service when using the --add or reset options.
HISTORY
chkconfig originated within the Red Hat Linux ecosystem, being an integral part of its System V init implementation. It was developed to simplify the management of runlevel configurations for services, providing a user-friendly interface compared to manual manipulation of symbolic links in /etc/rcX.d/ directories. For many years, it was a staple utility on Red Hat Enterprise Linux, Fedora, CentOS, and other derivatives. Its prominence began to wane with the widespread adoption of systemd, which introduced a new paradigm for service management and superseded many of the functions traditionally handled by chkconfig. Despite this, it remains a valuable tool for maintaining older systems or specific environments that still rely on SysV init.
SEE ALSO
service(8), systemctl(1), init(8), update-rc.d(8)