LinuxCommandLibrary

insserv

Manage System V init script dependencies

SYNOPSIS

insserv [OPTION]... SERVICE...

PARAMETERS

-h, --help
    Display help and exit.

-n, --no-runlevel
    Do not activate/deactivate service in any runlevel.

-r, --remove
    Remove service from all runlevels.

-f, --force
    Force installation despite detected problems.

-v, --verbose
    Increase verbosity.

-s, --sloppy
    Ignore missing or malformed LSB tags.

-c
    Check arguments only, print actions without executing.

-p, --pretend
    Print actions but do nothing.

-d, --default
    Install in default runlevels (2,3,4,5).

-u, --upstart
    Convert SysV script to Upstart job (legacy).

-C dir
    Use alternative conf directory.

--version
    Display version information.

DESCRIPTION

insserv is a tool for installing, updating, or removing SysV init scripts from the system runlevel configuration. It processes scripts in /etc/init.d/ and creates symbolic links in the /etc/rc?.d/ directories according to LSB (Linux Standard Base) headers, enabling dependency-based boot ordering.

It scans init scripts for keywords like Provides:, Required-Start:, Required-Stop:, and Default-Start: to determine runlevels and dependencies. This automates service management, ensuring services start in the correct order during boot or shutdown.

Primarily used in Debian-based distributions with SysV init, insserv replaces manual link creation. When invoked, it activates services in specified or default runlevels (typically 2-5). It supports adding, removing, or querying services without rebooting, though changes take effect on next boot.

Modern systems using systemd have deprecated insserv in favor of native tools like systemctl, but it remains for legacy compatibility.

CAVEATS

Deprecated on systemd systems; use systemctl instead. Requires proper LSB headers in scripts or fails. Misuse can disrupt boot order. Not for user services.

LSB HEADERS EXAMPLE

Scripts need headers like:
# Provides: foo
# Required-Start: $remote_fs bar
# Default-Start: 2 3 4 5
# Short-Description: Foo service

TYPICAL USAGE

insserv /etc/init.d/myservice to add.
insserv -r /etc/init.d/myservice to remove.

HISTORY

Developed for LSB 1.3 compliance around 2004 by Werner Fink for SuSE/Debian. Enhanced dependency handling over manual rc?.d management. Phased out post-2010 with systemd adoption.

SEE ALSO

update-rc.d(8), chkconfig(8), invoke-rc.d(8), init(8), lsb(5)

Copied to clipboard