init.d
links according to LSB headers
It produces a shell script consisting of mv
,
ln
, and rm
commands,
which can then be executed to abide by LSB headers while
keeping the current ordering as much as possible.
Last update: Wed 03 Mar 2021. Fix multiple requirements of $all.
fix-init - rebuild init.d links according to LSB headers
fix-init [-n|--dry-run [file]] [-r|--renum [step]] [--root root] [-v|--verbose [2|3|4]] fix-init -h|--help [1|2]
Especially after running update-rc.d in dependency based boot sequencing mode, priorities can be so tight as to not allow further insertions. In that case this script fails, asking for --renum. In either case, an attempt is made to leave gaps between subsequent priority orders.
Circular dependencies are broken respecting the high-priority well established scripts. That is, starting new scripts later. If verbose is enabled, loops are displayed with messages like, for example:
That means it is Kill at runlevel 0, and the loop is being broken giving the highest priority to the first script. That is, scripts will be stopped in the reverse order than displayed, i.e. rsyslog first. If it were an S, high priorities would imply low numbers, providing for scripts to be started in the order displayed. The initial order determines where to break any circular dependency loop. On building such initial order, non-linked scripts --whose priority orders are not defined--- go last. So, if you want the loop to break at foo rather than at umountnfs.sh, you can remove rc0.d/K??umountnfs.sh and/or create rc0.d/K22foo, then run fix-init again. Alternatively, use --dry-run and edit the resulting script before running it.
Although existing priorities are respected (unless --renum), existing runlevels are not. Except for scripts with no associated LSB info, fix-init always adds and removes files so as to honor the specified runlevels.
fix-init does not require that services bearing the same name don't coexist, as that's a package management job. It copes with missing LSBs and unsatisfied dependencies (but complains). It uses both directories of LSB overriding as defined by insserv; on top of that, it has a configuration file.
Each line specifies how to modify the list of runlevels for a given script. The syntax is like so:
The "=", "+", and "-" operators mean replace, increase by appending to, and decrease by removing from the list of runlevels, respectively. Start runlevels list before the "/", Kill after.
Comments ("#"), and empty lines work as usual. Spaces (or commas) around levels are optional. For example:
# This too can solve the loop above, if the box mounts no NFS umountnfs.sh /= # replace LSB's Default-Stop with an empty list gdm3 -2 # avoid starting X at runlevel 2 gdm3 +34 # but make sure 3 and 4 are set
NOTE: Configuration for a script with no LSB starts with emtpy runlevels, not the actual runlevels that would be considered otherwise. On the other hand, setting levels for nonexistent scripts is a no-op.
Hard links are not detected.
Plain files that ought to be deleted are renamed to DeleteMe.whatever instead.
No attempt is made to intelligently discriminate between Should- and Required- Start / Stop directives in LSB blocks.
/etc/fix-init.conf /etc/init.d/.legacy-bootordering /etc/insserv/overrides/ /usr/share/insserv/overrides/ /etc/insserv.conf /etc/insserv.conf.d/
--renum 0
option to prevent automatic renumbering and
try to respect current links even if newer than timestamp,
--verbose 2
fix-init -n -
to get a quick view of the
matter.
Copyright (C) 2013-2021 Alessandro Vesely, all rights reserved except as noted. — JavaScript license information