forked from svarshavchik/vera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvera.xml
3681 lines (3345 loc) · 111 KB
/
vera.xml
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<article id="index.html">
<sect1 id="INSTALL">
<title>INSTALL</title>
<para>
The requirements to build <command>vera</command> are:
</para>
<itemizedlist>
<listitem>
<para>
gcc 11 or higher
</para>
</listitem>
<listitem>
<para>
<application>libyaml</application>
</para>
</listitem>
</itemizedlist>
<para>
To compile and install <command>vera</command> from source execute the
<command>configure</command> script with these recommended options:
</para>
<blockquote>
<informalexample>
<programlisting>./configure --prefix=/usr --sysconfdir=/etc --sbindir=/sbin \ --libdir=/lib --localstatedir=/run \ --with-switchlogdir=/var/log/vera\ --localedir=/usr/share/locale</programlisting>
</informalexample>
</blockquote>
<para>
This installs <command>vera</command> and <command>vlad</command> commands
into <filename>/sbin</filename>, the unit configuration file directory
gets created in <filename>/lib/vera</filename>; the local
unit configuration overrides and other configuration files in
<filename>/etc/vera</filename>, and the runtime sockets in
<filename>/run</filename>.
</para>
<para>
If <filename>/usr/local</filename> is not a separate, mounted partition,
if it's on a root partition, running <command>./configure</command>
without any options installs everything into
<filename>/usr/local</filename>.
</para>
<para>
Next, execute:
</para>
<blockquote>
<informalexample>
<programlisting>make [-j #]</programlisting>
</informalexample>
</blockquote>
<para>
to build <command>vera</command>.
</para>
<para>
Execute:
</para>
<blockquote>
<informalexample>
<programlisting>make install DESTDIR=/tmp/tmp-inst</programlisting>
</informalexample>
</blockquote>
<para>
this creates
an installation image in <filename>/tmp/tmp-inst</filename>, this shows
where everything gets installed.
</para>
<para>
<quote><command>make install</command></quote> runs a script that
reads <filename>/etc/inittab</filename> and
<filename>/etc/rc.d/rc?.d</filename> and converts them
to <command>vera</command>'s unit specifications. The script fails
if it doesn't understand them.
The user id that runs <command>make install</command> must have access
to <filename>/etc/inittab</filename> and
<filename>/etc/rc.d/rc?.d</filename>.
</para>
<para>
After verifying the correct installation paths, execute
</para>
<blockquote>
<informalexample>
<programlisting>sudo make install</programlisting>
</informalexample>
</blockquote>
<para>
This installs <command>vera</command> but does not replace
<command>init</command>. To do that execute (as root):
</para>
<blockquote>
<informalexample>
<programlisting>vlad hookonce</programlisting>
</informalexample>
</blockquote>
<para>
and reboot. This
triggers only the next reboot into <command>vera</command> so that
if there's any issue then forcing another reboot will reboot with
<command>init</command>.
</para>
<para>
After
rebooting run
</para>
<blockquote>
<informalexample>
<programlisting>vlad status</programlisting>
</informalexample>
</blockquote>
<para>
to see all containers
that were started for converted <filename>/etc/inittab</filename>
entries. Run
</para>
<blockquote>
<informalexample>
<programlisting>vlad hook</programlisting>
</informalexample>
</blockquote>
<para>
to have all future reboots use
<command>vera</command>.
</para>
<note>
<para>
Do not update <command>sysvinit</command> or
<command>logrotate</command> after installing
<command>vera</command>. If you would like to go back to
<command>init</command>, or to update:
</para>
<itemizedlist>
<listitem>
<para>Run <quote><command>vlad unhook</command></quote>.</para>
</listitem>
<listitem>
<para>
Reboot, this will boot with <command>init</command>.
IMPORTANT: run
<quote><command>vlad unhook</command></quote> a second time.
</para>
</listitem>
</itemizedlist>
</note>
<para>
See the <citerefentry>
<refentrytitle>vera</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry> manual page for more information.
</para>
<note>
<para>
<command>vera</command> does not replace
the <quote><command>shutdown</command></quote> and
<quote><command>reboot</command></quote> commands from sysvinit.
They're still used with <command>vera</command>.
</para>
</note>
<sect2 id="slackpkg">
<title>Slackware64 package</title>
<para>
The Slackware package installs vera with the default configuration
options. The package's installation script automatically
runs the <quote>inittab</quote> command that reads
<filename>/etc/inittab</filename> and
<filename>/etc/rc.d/rc?.d</filename> and converts them
to <command>vera</command>'s unit specifications. The script fails
if it doesn't understand them.
Install the Slackware 15 package with
<quote><command>installpkg</command></quote>
and follow the instructions above starting with the
<quote><command>vlad hookonce</command></quote>
command.
</para>
<note>
<para>
Before using <command>removepkg</command> to uninstall
<command>vera</command>, or before updating
<command>sysvinit</command> or <command>logrotate</command>
packages, the following command must be executed:
</para>
<blockquote>
<informalexample>
<programlisting>vlad unhook</programlisting>
</informalexample>
</blockquote>
<para>
followed by a reboot and ANOTHER <quote>vlad unhook</quote>
command.
</para>
</note>
<para>
See the <citerefentry>
<refentrytitle>vera</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry> manual page for more information.
</para>
</sect2>
<sect2 id="issues">
<title>Known issues on Slackware 15</title>
<para>
Shutdowns take a few more seconds to complete.
<quote><filename>/etc/rc.d/rc.M</filename></quote> runs
<quote><literal>/etc/rc.d/rc.script start</literal></quote> commands,
but
<quote><filename>/etc/rc.d/rc.K</filename></quote> runs only
a handful of
<quote><literal>/etc/rc.d/rc.script stop</literal></quote>s, and
skips most of them.
<quote><filename>/etc/rc.d/rc.K</filename></quote> takes the easy
way out that simply
<command>kilall</command>s all processes.
</para>
<para>
<quote><command>vera inittab</command></quote> converts each
<quote><command>rc.script</command></quote> to a unit,
and the unit formally runs
<quote><command>rc.script start</command></quote> and
<quote><command>rc.script stop</command></quote>.
Stopping each unit takes additional
time.
This also exposes a
<quote><command>rc.networkmanager</command></quote> issue
with its default DHCP configuration that uses
<command>dhcpcd</command>: there's a ten second delay in the
middle of every shutdown, with <command>vera</command> waiting for
one <command>dhcpcd</command> process to stop. This appears to be
a <command>dhcpcd</command> glitch.
This gets covered up normally by <command>rc.K</command> terminating
all processes at once, but gets exposed when NetworkManager runs in
a container.
</para>
<para>
This does not happen with
<quote><literal>dhcp=dhclient</literal></quote> in
<filename>/etc/NetworkManager/conf.d/00-dhcp-client.conf</filename>.
</para>
</sect2>
</sect1>
<sect1 id="manpages">
<title>Manual pages</title>
<refentry id="vera.8">
<refmeta>
<refentrytitle>vera</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>Double Precision, Inc.</refmiscinfo>
</refmeta>
<refnamediv>
<refname>vera</refname>
<refname>vlad</refname>
<refname>init</refname>
<refpurpose>Linux process supervisor</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>vlad</command>
<group choice='req'>
<arg choice='plain'>reexec</arg>
<arg choice='plain'>vera-up</arg>
<arg choice='plain'>hook</arg>
<arg choice='plain'>hookonce</arg>
<arg choice='plain'>unhook</arg>
<arg choice='plain'>inittab</arg>
<arg choice='plain'>rehook</arg>
</group>
</cmdsynopsis>
<cmdsynopsis>
<command>vlad</command>
<arg rep='repeat'>parameter</arg>
</cmdsynopsis>
<blockquote>
<para>
Internal commands:
</para>
</blockquote>
<cmdsynopsis>
<command>vlad</command>
<arg choice='plain'>sysdown</arg>
<arg choice='req'>runlevel</arg>
<arg choice='req'>script</arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vera-init</command>
<arg choice='opt' rep='repeat'>parameter</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para>
The <command>vera</command> system process runs as PID 1 and is
responsible for starting and stopping major system processes, including
system startup and shutdown. <command>vera</command> also listens on
an internal socket for commands that adjust the system running state.
The <command>vlad</command> command connects to that internal
socket and passes along the commands (that <command>vlad</command>
doesn't handle by itself).
</para>
<para>
Installing <command>vera</command> does not automatically replace
the default <command>init</command>
supervisor. This manual page describes the process
for converting an existing system from <command>init</command> to
<command>vera</command>, and restoring a converted system back to
<command>init</command>. This manual page also describes some common
and less common management commands.
</para>
<para>
See
<link linkend="vera.runlevels.8">
<citerefentry>
<refentrytitle>vera.runlevels</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link> for a description of how <command>vera</command> manages
runlevels, starts, and stops individual units or processes.
</para>
<para>
See
<link linkend="vera.units.8">
<citerefentry>
<refentrytitle>vera.units</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link> for more information on adding custom units and
processes to <command>vera</command>.
</para>
<para>
See
<link linkend="vera.logs.8">
<citerefentry>
<refentrytitle>vera.logs</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>
for more information on obtaining basic statistics on processes
started by <command>vera</command>.
</para>
<para>
See
<link linkend="vera.extras.8">
<citerefentry>
<refentrytitle>vera.extras</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>
for more information on additional features that
<command>vera</command> adds to a base Slackware system.
</para>
</refsect1>
<refsect1 id="management">
<title>MANAGING <command>vera</command></title>
<para>
<quote>reexec</quote> signals the <command>vera</command> system
process to restart itself. This is needed after installing a new
version of <command>vera</command> or one of the system libraries
it uses (the system was already converted to run
<command>vera</command> instead of <command>init</command> and
a new version of <command>vera</command> was installed).
It's possible that <command>vera</command> will not
restart immediately. If any units are in the middle of being
stopped, started, restarted, or respawned a
<quote>reexec</quote> gets delayed until
all pending activity finishes.
</para>
<note>
<para>
The Slackware package takes care of running <quote>reexec</quote>
when installing a package update.
</para>
</note>
<note>
<para>
This can be a lengthy delay when there's a respawned unit that
reached its maximum number of attempts and it's waiting until
it's respawnable.
Additionally, <quote>reexec</quote> resets all respawned units'
counters and limits.
</para>
<para>
This is not considered critical, a <quote>reexec</quote> is
not something that normally happens.
</para>
</note>
<para>
<command>vlad vera-up</command> tries to connect to
<command>vera</command>'s public socket. A successful connection
indicates that <command>vera</command> is installed and
running. This is indicated by a 0 exit code.
A connection failure is reported by terminating with a non-0
exit code (no error message is shown).
</para>
<para>
Installing <command>vera</command> (from a package or by
<command>make install</command>) does not touch or replace the
default system <command>init</command> daemon. Additional commands
must be executed, and a coordinated reboot is required in order to
roll the dice, and start <command>vera</command>.
</para>
<para>
The <command>hook</command> and <command>hookonce</command> commands
begin the process of converting from <command>init</command> to
<command>vera</command>. They make the following changes:
</para>
<itemizedlist>
<listitem>
<para>
The original <filename>/sbin/init</filename> gets moved to
<filename>/sbin/init.init</filename>.
</para>
</listitem>
<listitem>
<para>
The original
<filename>/etc/rc.d/rc.sysvinit</filename>,
<filename>/etc/rc.d/rc.local</filename> and
<filename>/etc/rc.d/rc.local_shutdown</filename>,
scripts get moved to
<filename>/etc/rc.d/rc.sysvinit.init</filename>,
<filename>/etc/rc.d/rc.local.init</filename> and
<filename>/etc/rc.d/rc.local_shutdown.init</filename>,
if they exist.
The original <filename>/usr/sbin/logrotate</filename> binary
gets moved to <filename>/usr/sbin/logrotate.init</filename>.
</para>
</listitem>
<listitem>
<para>
The moved scripts and binaries get replaced
with links to <command>vera</command>'s replacements.
</para>
</listitem>
<listitem>
<para>
<filename>@CONFIGDIR@/hook</filename> gets created.
</para>
</listitem>
</itemizedlist>
<para>
The installed rc script replacements check if
<command>vera-up</command>,
if so they do nothing because the <command>inittab</command>
command installs units that
run these scripts and commands.
Otherwise, if not <command>vera-up</command> and
<command>init</command>
is still running (prior/after a reboot) the
replacements execute the replaced program or script, with no
change in behavior.
</para>
<para>
The replacement <command>/usr/sbin/logrotate</command> script
checks if <command>vera-up</command>, if so then the original
<command>/usr/sbin/logrotate.init</command> runs with a different
configuration, <filename>/etc/logrotate.conf.vera</filename>.
Otherwise, if not <command>vera-up</command> and
<command>init</command>
is still running (prior/after a reboot) then
<command>/usr/sbin/logrotate.init</command> runs with the default
<filename>/etc/logrotate.conf</filename> configuration.
</para>
<para>
An installed container, <filename>system/update-logrotate</filename>
runs a script when the system boot. This script reads
<filename>/etc/logrotate.conf</filename> and
<filename>/etc/logrotate.d</filename>, and creates
<filename>/etc/logrotate.conf.vera</filename> and
<filename>/etc/logrotate.d.vera</filename>. Every reference in
logrotate's scripts that runs
<filename>/etc/rc.d/<replaceable>name</replaceable> restart</filename>
or
<filename>/etc/rc.d/<replaceable>name</replaceable> reload</filename>
gets replaced with the equivalent <command>vlad</command> command.
</para>
<para>
The replacement <command>/sbin/init</command>, called
<command>vera-init</command>, checks that
<filename>@CONFIGDIR@/hook</filename> exists on the next reboot, and
starts <command>vera</command> instead of the replaced
<command>init</command>.
</para>
<para>
<command>hookonce</command> results in the removal of
<filename>@CONFIGDIR@/hook</filename> on the next reboot as early
as possible. Its absence on a subsequent reboot results in the
original <command>init</command> (now
<filename>/sbin/init.init</filename>) starting normally as PID 1.
</para>
<para>
The <command>unhook</command> command manually removes
<filename>@CONFIGDIR@/hook</filename> and if the system was booted
with <command>vera</command> no further action is taken.
A reboot is required to start the system with the original
<command>init</command> then the <command>unhook</command> command
gets executed a second time. This
completes the process of reverting back to
<command>init</command>.
</para>
<para>
When <command>unhook</command> determines that
<command>vera-up</command> is not the case, <command>unhook</command>
restores the scripts and binaries
that <command>hook</command> originally moved.
</para>
<note>
<para>
Do not run <command>make uninstall</command> to completely
uninstall <command>vera</command> unless it's fully unhooked.
</para>
<para>
Do not update <command>sysvinit</command> and
<command>logrotate</command>
unless
<command>vera</command> is fully unhooked.
</para>
</note>
<para>
The <command>inittab</command> command
rereads <filename>/etc/inittab</filename>,
<filename>/etc/rc.d/rc.M</filename>,
and <filename>/etc/rc.d/rc?.d</filename> directories,
the translates them to unit specification files in
<filename>@INSTALLCONFIGDIR@</filename>. A brief overview
of the translation process for entries in the
<filename>/etc/inittab</filename> file:
</para>
<itemizedlist>
<listitem>
<para>
All <quote><replaceable>keyword</replaceable>wait</quote>
entries get created as <quote>forking</quote> start types;
<quote>respawn</quote> as <quote>respawn</quote>; and
all others as <quote>oneshot</quote>.
</para>
</listitem>
<listitem>
<para>
<quote>power<replaceable>state</replaceable></quote>,
<quote>ctrlaltdel</quote>, and
<quote>boot</quote> are added to the corresponding
target.
</para>
</listitem>
<listitem>
<para>
<quote>boot</quote> and
<quote>bootwait</quote>
entries get added as dependencies of
<filename>system/boot</filename> which is a dependency of
all runlevels, in this manner these entries get executed
before all runlevels' entries.
</para>
</listitem>
<listitem>
<para>
Each entry's one-character runlevels get converted to the
corresponding <command>vera</command> runlevel targets,
and the entry becomes a dependency of the runlevel target.
</para>
</listitem>
<listitem>
<para>
Entries that match the names of selected
<filename>/etc/rc.d/rc.<replaceable>X</replaceable></filename>
scripts get singled out for special processing.
</para>
</listitem>
<listitem>
<para>
<quote>Before</quote> and <quote>After</quote>
get specified for each converted inittab, that starts them
(and stops them in reverse order) in order of appearance
in <filename>/etc/inittab</filename>.
</para>
</listitem>
<listitem>
<para>
The
<filename>@INSTALLCONFIGDIR@/system/inittab</filename>
directory gets created or updated with units that run each
<filename>/etc/inittab</filename> entry.
</para>
</listitem>
</itemizedlist>
<note>
<para>
Changes to the <quote>initdefault</quote> entry are ignored.
Use the
<command>default</command> command to change the default
runlevel (see
<link linkend="vera.runlevels.8">
<citerefentry>
<refentrytitle>vera.runlevels</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>).
</para>
</note>
<para>
The <filename>/etc/rc.d/rc.M</filename> script's contents are
searched for every instance of
<quote>-x /etc/rc.d/<replaceable>rc.script</replaceable></quote>
followed by
<quote>/etc/rc.d/<replaceable>rc.script</replaceable>
start</quote>.
This creates a corresponding
<filename>@INSTALLCONFIGDIR@/system/rc.M/<replaceable>rc.script</replaceable></filename>
unit that runs
<quote>/etc/rc.d/<replaceable>rc.script</replaceable> start</quote>
and
<quote>/etc/rc.d/<replaceable>rc.script</replaceable> stop</quote>.
The entry for <filename>/etc/rc.d/rc.M</filename> executes it via
a wrapper that converts it, on the fly,
to start each corresponding unit, instead of running each script
directly.
</para>
<para>
Finally, entries in <filename>/etc/rc.d/rc?.d</filename>
get translated to unit files as follows:
</para>
<itemizedlist>
<listitem>
<para>
All files with names that don't start with
<quote>S</quote> and <quote>K</quote> get ignored.
Files containing whitespace, a <quote>~</quote>, or a
<quote>#</quote> get ignored;
Otherwise:
</para>
</listitem>
<listitem>
<para>
Every file's (device and) inode gets looked up. All
<quote>S</quote> files named the same, but in different
<filename>/etc/rc.d/rc?.d</filename> directories must have the
same (device and) inode.
</para>
<para>
This verifies that the same <quote>S</quote> file in every
<filename>/etc/rc.d/rc?.d</filename> directory is the same
script.
</para>
</listitem>
<listitem>
<para>
The
<filename>@INSTALLCONFIGDIR@/system/rc</filename>
directory gets created or updated with units that run each
script from the <filename>/etc/rc.d/rc?.d</filename>, and
the converted units are dependencies of the corresponding
<command>vera</command> runlevel target.
</para>
</listitem>
<listitem>
<para>
Each unit's starting command runs the <filename>S</filename>
script with the <quote>start</quote> parameter.
</para>
</listitem>
<listitem>
<para>
The existence of a <quote>K</quote> file with the same
(device and) inode results in the unit's stopping command
getting set, which runs the script with the
<quote>stop</quote> parameter. Otherwise there is no explicit
stopping command.
</para>
</listitem>
<listitem>
<para>
If the <filename>S</filename> or <filename>K</filename> scripts
are symbolic links the commands are updated to reflect the
symlink target name, as syntactic sugar.
</para>
</listitem>
</itemizedlist>
<para>
The <command>rehook</command> command checks that
<filename>/sbin/init</filename> is hard-linked to the current
<filename>vera-init</filename> executable.
Updating (via <command>make install</command> or a built package)
installs a new <command>vera-init</command> binary,
and this recreates the hard link.
<command>rehook</command> then checks all the other files that get
hooked via symbolic links. If the symbolic link is gone this is
presumed to be the result of erroneously updating the hooked
program, and it is re-hooked again using the same process that
<command>hook</command> or <command>hookonce</command> uses.
</para>
<para>
The <command>inittab</command> and
<command>rehook</command> commands run automatically when
<command>vera</command> gets updated.
</para>
</refsect1>
<refsect1 id="internal">
<title>Internal commands</title>
<para>
These commands are for internal use only, and are only documented
here for completeness.
</para>
<para>
<quote>sysdown</quote> directs <command>vera</command> on PID 1
to set the <envar>RUNLEVEL</envar>
environment variable and execute a specified script, replacing
PID 1.
This is used as a final action for executing a shutdown or a reboot
(the <filename>rc.0</filename> and <filename>rc.6</filename>
scripts).
</para>
<para>
The <command>vera-init</command> executable gets linked as
<filename>/sbin/init</filename> and it performs a delicate juggling
act of switching between <command>vera</command> and the legacy
<command>init</command> command, which gets renamed as
<filename>/sbin/init.init</filename> by the <quote>hook</quote>
command.
</para>
<para>
When it's not started as PID 1 <command>vera-init</command>
determines whether the system was booted by <command>vera</command>
or <command>init</command> by connecting to
<command>vera</command>'s internal communication socket. A connection
failure indicates that <command>vera</command> is hooked as
<command>/sbin/init</command> but the system has not been rebooted
yet, so <command>vera-init</command> executes
<command>/sbin/init.init</command> and forwards all parameters to it.
A successful connection indicates that <command>vera</command> is
running. <command>vera-init</command> executes
the <command>vlad</command> command and forwards its arguments to it.
</para>
<para>
When started as PID 1 <command>vera-init</command> determines whether
the system should be booted by the legacy <command>init</command>
or vera.
</para>
<itemizedlist>
<listitem>
<para>
Absence of <command>/sbin/init.init</command> indicates
that <command>vera</command> is installed and the legacy
<command>init</command> is removed.
<command>vera</command> is the only game in town.
</para>
</listitem>
<listitem>
<para>
<filename>@CONFIGDIR@/hook</filename> is checked, this file
is updated by <command>hook</command>,
<command>hookonce</command> and <command>unhook</command>
commands.
</para>
</listitem>
<listitem>
<para>
If <filename>@CONFIGDIR@/hook</filename> exists but its timestamp
is identical to <filename>/proc/1</filename>'s timestamp then
this is treated as if it does not exist.
<command>hook</command>/<command>hookonce</command> intentionally
sets the hook file's timestamp like this. <command>init</command>
executes itself before a reboot, and this is used to detect this
edge case. Even though this is PID 1 the system is not started
by <command>vera</command>.
</para>
</listitem>
<listitem>
<para>
The absence of <filename>@CONFIGDIR@/hook</filename> results
in executing <filename>/sbin/init.init</filename>, the legacy
init.
</para>
</listitem>
<listitem>
<para>
A <command>hookonce</command> removes
<filename>@CONFIGDIR@/hook</filename>, for the next boot.
</para>
</listitem>
<listitem>
<para>
At this point a final determination is made that the system
is getting booted by <command>vera</command>. Before this happens
<command>vera-init</command> reads
<filename>/etc/inittab</filename> and directly runs all
<command>sysinit</command> commands, then executes
<command>vera</command> to start the rest of the system.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1 id="bugs">
<title>BUGS</title>
<para>
The <command>vera</command> and
<command>vlad</command> commands are not named after any
well-known public figures.
</para>
<para>
<command>vera</command> does not implement
<filename>/var/run/runlevel</filename>.
</para>
<para>
<command>vera</command> does not implement
<filename>/dev/initctl</filename>.
</para>
<para>
Updating <command>sysvinit</command> after hooking into and starting
<command>vera</command> results in a mostly bricked system that
will not shutdown properly, but will probably reboot into the
original <command>init</command> if all filesystems are fully
synced before forcing the reboot. Do not update
<command>sysvinit</command> before fully
unhooking <command>vera</command> (twice) and rebooting back into
<command>init</command>
(see <xref linkend="management" /> for more information).
</para>
<para>
Using <command>killall</command> to send a
<errorcode>SIGKILL</errorcode> ends up terminating
<command>vera</command>'s
secondary process that handles commands like
<command>status</command>. Use
<quote><command>kill -usr1 1</command></quote>
to restart it.
</para>
<para>
<filename>system/rc.M</filename> units always claim they're
manually started, even though they get started automatically.
This is an artifact of how <command>vera</command>'s
<command>inittab</command> command works.
</para>
</refsect1>
<refsect1 id="seealso">
<title>SEE ALSO</title>
<para>
<link linkend="vera.extras.8">
<citerefentry>
<refentrytitle>vera.extras</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>,
<link linkend="vera.logs.8">
<citerefentry>
<refentrytitle>vera.logs</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>,
<link linkend="vera.runlevels.8">
<citerefentry>
<refentrytitle>vera.runlevels</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>,
<link linkend="vera.units.8">
<citerefentry>
<refentrytitle>vera.units</refentrytitle>
<manvolnum>8</manvolnum>
</citerefentry>
</link>.
</para>
</refsect1>
</refentry>
<refentry id="vera.runlevels.8">
<refmeta>
<refentrytitle>vera runlevels</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo>Double Precision, Inc.</refmiscinfo>
</refmeta>
<refnamediv>
<refname>vera.runlevels</refname>
<refpurpose>Vera runlevels</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>vlad</command>
<arg choice='opt'>--wait</arg>
<arg choice='plain'>switch</arg>
<arg choice='plain'><replaceable>runlevel</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vlad</command>
<arg choice='req'><replaceable>LETTER/DIGIT</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vlad</command>
<arg choice='opt'>--override</arg>
<arg choice='plain'>default</arg>
<arg choice='plain'><replaceable>runlevel</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>vlad</command>
<group choice='req'>
<arg choice='plain'>current</arg>
<arg choice='plain'>default</arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="runlevels_description">
<title>DESCRIPTION</title>
<para>
This manual page is an overview of how