INSSERV(8) | System Manager's Manual | INSSERV(8) |
insserv - boot sequence organizer using LSB init.d script dependency information
insserv [-v] [-c <config>] [-p <path>] [-d] [-f] [[/]path/to/init.d/]script ...
insserv [-v] [-c <config>] [-p <path>] [[/]path/to/init.d/]script[,start=<lvl1,lvl2,...>,stop=<lvl1,lvl2,...>]
insserv [-v] [-c <config>] [-p <path>] -r [-d] [-f] [[/]path/to/init.d/]script ...
insserv -h
insserv is a low level tool used by update-rc.d which enables an installed system init script (`boot script') by reading the comment header of the script, e.g.:
### BEGIN INIT INFO # Provides: boot_facility_1 [ boot_facility_2 ...] # Required-Start: boot_facility_1 [ boot_facility_2 ...] # Required-Stop: boot_facility_1 [ boot_facility_2 ...] # Should-Start: boot_facility_1 [ boot_facility_2 ...] # Should-Stop: boot_facility_1 [ boot_facility_2 ...] # X-Start-Before: boot_facility_1 [ boot_facility_2 ...] # X-Stop-After: boot_facility_1 [ boot_facility_2 ...] # Default-Start: run_level_1 [ run_level_2 ...] # Default-Stop: run_level_1 [ run_level_2 ...] # X-Interactive: true # Short-Description: single_line_description # Description: multiline_description ### END INIT INFO
and calculating the dependencies between all scripts. It is not recommended to execute insserv directly unless you know exactly what you're doing, doing so may render your boot system inoperable. update-rc.d is the recommended interface for managing init scripts.
The Default-Start keyword declares on which runlevels the script must be started. An empty value means the script will never be started. The same applies for its counterpart Default-Stop with the only difference that the script will be stopped.
Please be aware that the line
# Required-Stop: boot_facility_1 [ boot_facility_2 ...]
declares facilities which must be available during shutdown of the service declared in the Provides tag. Same holds true for
# Should-Stop: boot_facility_1 [ boot_facility_2 ...]
which declares facilities which should be available during shutdown of the service declared in the Provides tag. In both cases the script system should avoid stopping services which are declared by these two Stop tags until the script including these tags is stopped.
The optional X-Interactive keyword implies that the script using this keyword should be started alone in a concurrent boot configuration because it interact with the user at the console. Only the value `true' is recognised. All others are ignored.
The optional X-Start-Before keyword implies that the script using this keyword should be started before the specified service names. Whereas the optional X-Stop-After keyword implies that the script using this keyword should be stopped after the specified service names. Both implies that those services now depend on the specifying script. With known dependencies and runlevel(s) insserv sets and reorders the corresponding symbolic links of the concerned runlevels directories.
insserv scans for System Facilities in the configuration file /etc/insserv.conf and each file in the directory /etc/insserv.conf.d/. Each line which begins with $ and a following name defines a system facility accordingly to the Linux Standard Base Specification (LSB). All names followed by such a system facility will declare the required dependencies of the facility. Here is an example for /etc/insserv.conf:
# All local filesystems are mounted # (done during boot phase) $local_fs boot # Low level networking $network network route # Named is operational $named named # All remote filesystems are mounted # (in some cases /usr may be remote). $remote_fs $local_fs nfs # System logger is operational $syslog syslog # All network daemons are running (This was removed in LSB 1.2) $netdaemons portmap inetd # Services which need to be interactive <interactive> boot.crypto
Names starting with a `+' sign are marked as optional. If the service with the name after the plus sign is available it will be used, if not available it is ignored silently. Words beginning with < and ending with > are keywords. Currently <interactive> is the only know keyword for marking a service as an interactive one, e.g., a service which requires a passphrase or password input during boot or runlevel change. The special facility $null is used to enforce an empty dependency in case of Should-Stop and Required-Stop.
In addition to the defined System Facilities in the configuration file /etc/insserv.conf, insserv also knows the special facility $all. This facility indicates that a service should be inserted at the end of all services at starting and at the very beginning at stopping. Clearly all services using this facility will be grouped into one starting or stopping order.
Currently the following options are recognized by insserv:
But you may use the argument syntax described in the following section.
Beside using the extensions ,start=<lvl1,lvl2,...> and ,stop=<lvl1,lvl2,...> it is possible to use override files replace a LSB comment header or simply provide a missing LSB comment header. This can be done by placing a file with the new LSB comment header using the same name as the boot or init script in the directory /etc/insserv/overrides/. For third party boot scripts without LSB header it is possible to add a file with the same name in the directory /usr/share/insserv/overrides/ to make them completely LSB compliant.
To allow upstart jobs to work as init.d scripts, insserv will recognize a symlink from path/to/init.d/script to /lib/init/upstart-job as upstart jobs, and instead of reading the header from the file will run the script with the argument lsb-header to get the script header.
The exit codes have the following conditions:
Please be aware that the following patterns of boot script file names will be not accepted by insserv:
*.dpkg* *.ucf* *.rpm* *.ba* *.old *.new *.org *.orig *.save *.swp *.core *~
with the wildcard character *. Beside this all boot script file names beginning with one of the following characters
$.#%_+-\*[]^:()~
will be ignored. Administrators can further filter files by extension in the /etc/init.d/ directory by creating a text file called /etc/insserv/file-filters. The file-filters configuration file lists (one per line) extensions which should be ignored by insserv as it parses the /etc/init.d/ directory. An example of /etc/insserv/file-filters might look like this:
git svn html
Boot scripts sometimes lack a LSB comment header. Contact a package maintainer or developer of the software which provides the script to have a LSB comment header added to it.
/etc/init.d/.depend.boot,
/etc/init.d/.depend.start,
/etc/init.d/.depend.stop
The make(1) like dependency files produced by insserv for
booting, starting, and stopping with the help of
startpar(1).
init(8), startpar(1).
2000–2009 Werner Fink,
2009 SuSE Linux Products GmbH Nuernberg, Germany.
2000–2003 SuSE GmbH Nuernberg, Germany,
2007–2009 SuSE Linux Products GmbH Nuernberg, Germany.
2019– Jesse Smith
Werner Fink <feedback@suse.de>
Petter Reinholdtsen
Kel Modderman
July 29, 2008 | 3rd Berkeley Distribution |