The init process exists as an ancestor of all of processes on a linux system. Does this process have any kind of IPC entry point ? Do other processes ever do IPC with init for any reason ?
Asked
Active
Viewed 557 times
1 Answers
10
Don't conflate processes and programs. There's one process #1, but it can be running one of a number of different programs.
- If it is running the
systemd
program from the systemd package:- There is an internal systemd API accessible via D-Bus, that is not guaranteed stable and not intended to be used by things outwith the systemd package.
- It responds to a large set of signals, ranging from
SIGWINCH
andSIGPWR
toSIGRTMIN + 4
.
- If it is running the
system-manager
program from the nosh package:- It responds to a fairly large subset of the signals recognized by
systemd
, with the same meanings where applicable.
- It responds to a fairly large subset of the signals recognized by
- If it is running the
init
program from upstart:- There is an internal upstart API, accessible via D-Bus.
- It reads command messages from the
initctl
FIFO. - It responds to small set of signals.
- If it is running Joachim Nilsson's
finit
:- It reads command messages from the
initctl
FIFO. - It responds to a small set of signals.
- It reads command messages from the
- If it is running the System 5
init
then:- It reads command messages from the
initctl
FIFO. - It responds to a very small set of signals.
- It reads command messages from the
Some notes:
- The signal API is mandated by the things that send the signals to process #1. These include the operating system kernel, which sends things like
SIGWINCH
,SIGINT
, andSIGPWR
, and various widespread system utility programs.- Both
systemd
and the noshsystem-manager
extend this with signals that command system state changes (such as shutting down and powering off the system). - Not all programs document supporting the full set of system-mandated signals. upstart makes no mention of responding to
SIGPWR
, for example. finit
recognizes a different set of non-system-mandated extended signals, includingSIGSTOP
andSIGCONT
.
- Both
- Although the systemd package doesn't implement the
initctl
FIFO API in the program that runs as process #1, it does provide a compatibility shim in another process, running another program, that translates that mechanism onto native systemd mechanisms. (The nosh toolset has its owninitctl-read
compatibility shim that similarly translated into the native mechanisms of the nosh toolset's system management.)initctl
really isn't native to anything but System Vinit
, as the others (if they do so at all) only implement the notion of run levels as a limited backwards-compatibility mechanism.- As the upstart man page for its
init
program says, theinitctl
mechanism isn't well documented. Even the System Vinit
people go around telling people that only things in the System Vinit
package should use it. It doesn't help, moreover, that the Debian System V maintainers relocated it from/dev
to/run
.
So yes, programs do IPC with process #1. Their reasons for doing so vary.
- The
systemd
program is a combination system manager, service manager, and control groups manager and so there are a lot of purposes for which programs employ IPC to process #1. The same for upstart'sinit
. - For nosh's
system-manager
, conversely, service management is done by another program (service-manager
) in another process with its own (daemontools-compatible) APIs. So the only reason to do IPC with process #1 is for system state management, such as (say) rebooting the machine.
For many (not all) purposes, one is better off sticking to other APIs, using conventional system utilities to do things like shutdown and reboot the system, rather than sending the signals understood by the system-manager
and systemd
programs when they are running as process #1.
Further reading

JdeBP
- 68,745
initctl
to tellinit
(I'm not doing anything with that there new-fangledsystemd
thingy - at least not until it gets to be a lot more stable in extreme cases) when the Main power has dropped and come back - and when to shut down because the battery is running critically low. The intricacies are not that complex but I am using it because that is exactly what that API is intended for. – SlySven Feb 29 '16 at 07:32Finit also supports UNIX domain socket IPC.
– troglobit Mar 23 '19 at 13:05