aboutsummaryrefslogtreecommitdiff
path: root/riemann.fmi.uni-sofia.bg/ninit/index.html
blob: 708382e0e42dd1beb7ee127f4ac0c59f5c4ff206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<html>
<link rel="stylesheet" type="text/css" href="style.css">
<title>ninit - small Linux/UNIX init</title>
<body>

<div class="top">
<ul class="nav">
  <li><a href="all.html">All files</a>
</ul>

<h1>ninit - a small replacement of init</h1>
<div class="endtop"></div>
</div>

Release: &nbsp;
<!--
<a href=ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> (stable) &nbsp;
-->
<a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a>
<br> Author's private <i>/etc/ninit/</i> &nbsp;
<a href=ninit-data.tar.gz>ninit-data.tar.gz</a> ::
<a href=http://gitorious.org/arch-ninit/ninit-scripts>archlinux</a>
<br>
<p>

<table align=top>
<td>
<ul>
<li><a name='toc0' href='#HowItWorks'>How it works</a></li>
<li><a name='toc1' href='#Install'>Install</a></li>
<li><a name='toc2' href='#PostInstall'>Post install</a></li>
<li><a name='toc4' href=man/>Manpages</a></li>
</ul>
</td>

<td>
<ul>
<li><a name='toc5' href=all.html>Download</a></li>
<li><a name='toc3' href='#Updating'>Updating <tt>ninit</tt></a></li>
<li><a name='toc6' href=FAQ.html>FAQ</a></li>
<li><a name='toc10' href=ninit-html.tar.bz2>HTML</a></li>
</ul>
</td>

<td>
<ul><li><a name='toc11' href='#HaltReboot'>Halt &amp; Reboot</a></li>
<li><a name='toc8' href=subdirs.html>Subdirs</a> -
<font color=magenta>read me!</font></li>
<li><a name='toc888' href=files.html>Files</a> -
<font color=magenta>read me!</font></li>

<li><a name='toc9' href="subdirs.html#Services">Creating</a> services</li>
</ul>
</td>
<!--
11
-->
</table>

<p>
<a href=/ninit/guarantee.html>The ninit security guarantee</a>
<!--
<br>
<a href=LK/>Linux-Kongress 2009 submission</a>
-->

<h2><a name="New">What's new</a></h2>
<ul>
<li> 20100116 - version 
  <a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a> uploaded.
</li>
<li> 20090110 - version 
  <a href=old/ninit-0.13.tar.bz2>ninit-0.13.tar.bz2</a> uploaded.
</li>
<!--
<li> 20080103 - version 
  <a href=old/ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> uploaded.
</li>
<li> 20071102 - version 
  <a href=old/>ninit-0.12.tar.bz2</a> uploaded.
</li>
<li> 20071025 - version 
  <a href=old/>ninit-0.11.2.tar.bz2</a> uploaded.
   Ninit have buildin cron and uses only 8K RAM (two pages).
</li>
-->
<li> 20071010 - mailing lists for ninit.</li>
</ul>

<h2><a name="About">About</a></h2>
<b>ninit</b> is a fork from Felix von Leitner's 
<a href=http://www.fefe.de/minit/>minit</a>.
Some other related <a href=links.html>links</a>.
<br>
<!--
Like any other piece of software (and information generally),<br>
ninit comes with NO WARRANTY.
<p>
-->
<a name=List>
There is a
&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
for ninit.  To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
to <br>
<font size=+1>
<a href=
&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
>
&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
</a>
</font>
</a>
<br>
Some delay is possible due to
&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;&#46;

<p>
<b>ninit</b> uses minimal resources (arch: i386; kernel: 2.4.37):
<pre>
  USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
  root   1  0.0  0.0   8   8 ?      S Oct08 0:03 /sbin/ninit

   text    data     bss     dec     hex filename
   3642      20      56    3718     e86 /sbin/ninit
</pre>

<h2><a name="Install">Install</a></h2>
You have to build and install ninit first.  I prefer to do this
with Fefe's <a href=http://www.fefe.de/dietlibc/>dietlibc</a>.
<br>
Download the latest stabe
  <a href=http://riemann.fmi.uni-sofia.bg/ninit/ninit-0.14.tar.bz2>
  ninit-0.14.tar.bz2</a> release.  Then:

<pre>
  bzip2 -dc ninit-0.14.tar.bz2 | tar -xvf - 
  cd ninit-0.14

Case-A:  If you have dietlibc already working do:
  $ make withdiet;   make tests
  # make install

Case-B:  If you do not have dietlibc do:
  $ make dietbuild;  make tests
  # make install
</pre>
To compile <tt>ninit</tt> with glibc do:
<pre>
  $ make nodiet;     make tests
  # make install
</pre>
Only <tt>make install</tt> must be started as root!
Other install instructions are <a href=install.html>here</a>.
You can type also <tt>make strip</tt> before <tt>make install</tt>.
The distributions 
<b><font color=magenta>should read</font></b>
this <a href=install.html#Warning>warning</a>.

<h2><a name="PostInstall">Post install</a></h2>

You have to prepare service directory <tt>/etc/ninit</tt>
and to setup 
<br>
boot loader (grub or lilo) to start
<tt>/sbin/ninit</tt> instead of <tt>/sbin/init</tt>
<p>

<h4>Preparing directory <tt>/etc/ninit</tt></h4>

<b>Case A.</b>

If you already have <tt>ninit</tt> running, then you
already have this directory and can skip to 
<a href='#Updating'>updating</a> ninit.
<p>
<b>Case B.</b>  If you already have 
<tt><a href="http://www.fefe.de/minit/">minit</a></tt> running do
simply:
<a name="SamePipes">
<pre>
  cd /etc  &&  cp -p -R minit/* ninit
</pre>
</a>

<b>Case C.</b> If your default init is <tt>/sbin/init</tt> it's also
easy.
<br>
I wrote a simple converter 
<tt><a href=man/inittab.man>ninit-inittab</tt></a>.  
Try it with:
<pre>
  /sbin/ninit-inittab /etc/inittab /etc/ninit /tmp/ninit.sh
  /tmp/ninit.sh
</pre>
Last two commands are equivalent to:
<pre>
  make ser_vi_ces
</pre>
<hr>

<h4>Setup lilo/grub to boot <tt>/sbin/ninit</tt></h4>

To use <tt>ninit</tt> as system init  add the  parameter
<tt>init=/sbin/ninit</tt>
<br>
to your kernel command line.
See some short instructions <a href=boot.html>here</a>.
<br>
After that you have to reboot the system.

<h2><a name="Updating">Updating <tt>ninit</tt></a></h2>
If <tt>ninit</tt> is already running your boot loader is
already prepared to start <tt>/sbin/ninit</tt>.  After
installation all is done automatically.  Simply do nothing more!
<p>
You can test the new executable (before <tt>make install</tt>)
also with:
<pre>
	/sbin/ninit-reload -v -u /path/to/new/ninit
	cp /path/to/new/ninit /sbin
	cp /path/to/new/ninit-reload /sbin
	/sbin/ninit-reload -v -u /sbin/ninit
</pre>

<h2><a name="HowItWorks">How it works</a></h2>

For ninit, everything is a service, which should either be started
once or respawned.  Ninit expects its configuration in the 
<tt>/etc/ninit</tt> directory.  
You have to create
all services in this directory
manually or using the program
<tt><a href=man/inittab.man>ninit-inittab</tt></a>.
My private <a href=ninit-data.tar.gz>ninit-data.tar.gz</a>
and <a href=ls-R.txt>ls-R</a> are also public.

<p>
Ninit searches for a file called 
<tt><a href="files.html#Depends">depends</a></tt> in the subdirectory
<tt><a href="subdirs.html#Default">default</a></tt>. 
This file tells ninit which services should be
started by default (in fact it tells ninit that the service 
<tt>default</tt>
depends on other services, but <tt>default</tt> is the directory ninit
starts to search in).  Instead of the file <tt>default/depends</tt> it is
possible to start services with 
<a href=man/scan.man>ninit-scan</a>.

<!--
Special subdirectories and files are described
<a href="#Special">here</a>.
-->

<p>
Ninit doesn't start services alone.  It uses the helper program
<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt>
to start a service.  On this way ninit doesn't parse 
the service instructions in the corresponding directory.
This keeps ninit small and it's easy to change
<tt>/etc/ninit/sys/run</tt>. 

<p>
There is a companion utility 
<tt>/bin/<a href=man/nsvc.man>nsvc</a></tt>
that can be used much in the same
way as the 
<tt><a href=http://cr.yp.to/daemontools/svc.html>svc</a></tt> 
from daemontools. 
Communication works over two fifos,
<tt>/etc/ninit/{in|out}</tt>. 
Those have to exist before ninit is
started and they should be owned by root and have mode 600.
<!--
<br>
If on box also exist 
<a href=http://www.fefe.de/minit/>minit</a> then ninit must
use minit's 
<a href="#SamePipes">fifos</a>.
-->

<p>
While <tt>sys/run</a></tt> is the main 
<tt><a href=man/ninit.man>ninit</a></tt> helper, 
there are 
also four auxiliary helpers
<tt><a href=man/pidfile.man>ninit-pidfile</a></tt>,
<tt><a href=man/pututmpid.man>pututmpid</a></tt>,
<tt><a href=man/runlevel.man>ninit-runlevel</a></tt> and
<tt><a href=man/sysvinit.man>ninit-sysvinit</a></tt>
used to start services.
<pr>The last three helpers
emulate <tt>/sbin/init</tt> behavior.

<!--
<h2><a name="Programs">Programs</a></h2>
<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt> - ninit helpler 
-->


<h2><a name="HaltReboot">Shutdown and reboot</a></h2>
On a box running
<b>ninit</b> as process no 1 it is better to avoid using the SysVinit
programs shutdown, reboot, and halt.  First, check the directory
<tt>/etc/ninit</tt>.  Assuming you have the services 
<tt>{_l0|halt}</tt> and
<tt>{_l6|reboot}</tt>, you can try
<pre>
	nsvc -o halt
	nsvc -o reboot
</pre>
If you have service <a href="subdirs.html#Ctrlaltdel">ctrlaltdel</a> then 
<tt>CTRL-ALT-DELETE</tt> halts the hox.  
<p>


The converter
<tt><a href=man/inittab.man>ninit-inittab</a></tt> 
can
usually create these services for you. If they are still missing, the
last choice is to use the program 
<tt><a href=man/shutdown.man>ninit-shutdown</a></tt>,
or alternatively
the SysVinit programs <i>shutdown, reboot, halt</i>. 
Other problems with halt are described 
<a href="FAQ.html#q11">here</a>..

<h2>Future</h2>

<ul>
<li>explain why I decide to fork from Felix's <tt>minit</tt>
<li>write this page better (see also <a href=man/README>here<a>)
<li>tutorial for 
<a href="subdirs.html#Services">creating</a> services (partially done)
<!--
<li>explain the entries <tt>update_links</tt>, 
<tt>ser_vi_ces</tt> and <tt>distro</tt> in Makefile
<li>explain why I decide to make one daemon as two separate programs:
<br>
<tt>/sbin/<a href=man/ninit.man>ninit<a></tt> 
and <tt>/etc/ninit/<a href=man/run.html>run</a></tt>.  Last program
only start a service and exit.</li>
-->
<li>explain better some new features of <tt>ninit</tt> which
are missing in <tt>minit</tt> (see also 
<a href=FAQ.html#q12>here</a>).
<li>explain all compile options included in the file
<tt>ninitfeatures.h</tt>
</ul>

<!--
<h2>Translation table</h2>
between minit and ninit programs:
<pre>
	/bin/msvc           ->   /bin/nsvc
	/sbin/minit         ->   /sbin/ninit
	/sbin/minit-update  ->   /sbin/ninit-reload
	/sbin/hard-reboot   ->   /sbin/ninit-reboot
	/sbin/mshutdown     ->   /sbin/ninit-shutdown
</pre>
It's possible to make a  link
<pre>
	cd /bin && ln -s nsvc msvc
</pre>
and continue to use <tt>msvc</tt> in shell scripts.
How to use <tt>pidfilehack</tt> see also
<a href="FAQ.html#q3">here</a>.
-->

<h2>See also</h2>
Here are the package <a href=README>README</a>
and <a href=CHANGES>CHANGES</a>.
Almost all for <b>minit</b> is true for <b>ninit</b> also.
<br>
Other related <a href=links.html>links</a>.


<h2>Author:  Nikola Vladov</h2>
If you like <b>ninit</b>, try also my 
<a href=/ngetty/>
ngetty</a> - single daemon for all virtual consoles.
<br>
Send comments and suggestions using ninit 
<a href=#List>&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#45;&#108;&#105;&#115;&#116;</a> or
<a href=&#47;&#101;&#109;&#97;&#105;&#108;&#46;&#104;&#116;&#109;&#108;>
qform</a>.
<br>
<b><font color=red>WARNING</font></b>:
ninit is tested only on i386 and x86_64 arch.

<p>
Last modified:  Feb 11 2010
<br><br><br><br><br><br><br><br>
</body>
</html>