]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man7/boot.7
signal.7: Some reworking of Michal Sekletar's text
[thirdparty/man-pages.git] / man7 / boot.7
CommitLineData
fea681da 1.\" Written by Oron Peled <oron@actcom.co.il>.
2297bf0e 2.\"
b55e2bb3 3.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
fea681da 4.\" May be distributed subject to the GPL.
b55e2bb3 5.\" %%%LICENSE_END
fea681da
MK
6.\"
7.\" I tried to be as much generic in the description as possible:
8.\" - General boot sequence is applicable to almost any
9.\" OS/Machine (DOS/PC, Linux/PC, Solaris/SPARC, CMS/S390)
e8906093 10.\" - kernel and init(1) is applicable to almost any UNIX/Linux
008f1ecc 11.\" - boot scripts are applicable to SYSV-R4 based UNIX/Linux
6891999e 12.\"
e17d909d 13.\" Modified 2004-11-03 patch from Martin Schulze <joey@infodrom.org>
6891999e 14.\"
a879ea43 15.TH BOOT 7 2015-03-11 "Linux" "Linux Programmer's Manual"
d4438ce6 16.SH NAME
a879ea43 17boot \- System bootup process based on UNIX System V Release 4
d4438ce6 18.SH DESCRIPTION
dd3568a1 19.PP
a879ea43
MW
20The \fBbootup process\fR (or "\fBboot sequence\fR") varies in details
21among systems, but can be roughly divided into phases controlled by
22the following components:
23.IP 1. 4
24hardware
25.IP 2. 4
26operating system (OS) loader
27.IP 3. 4
28kernel
29.IP 4. 4
30root user-space process (\fIinit\fR and \fIinittab\fR)
31.IP 5. 4
32boot scripts
33.PP
34Each of these is described below in more detail.
35.SS Hardware
c382a365 36After power-on or hard reset, control is given
a879ea43
MW
37to a program stored in read-only memory (normally
38PROM); for historical reasons involving the personal
39computer, this program is often called "the \fBBIOS\fR".
a721e8b2 40.PP
a879ea43 41This program normally performs a basic self-test of the
24b74457 42machine and accesses nonvolatile memory to read
c13182ef
MK
43further parameters.
44This memory in the PC is
c382a365 45battery-backed CMOS memory, so most people
a879ea43
MW
46refer to it as "the \fBCMOS\fR"; outside
47of the PC world, it is usually called "the \fBNVRAM\fR"
48(nonvolatile RAM).
a721e8b2 49.PP
a879ea43
MW
50The parameters stored in the NVRAM vary among
51systems, but as a minimum, they should specify
52which device can supply an OS loader, or at least which
53devices may be probed for one; such a device is known as "the
54\fBboot device\fR".
55The hardware boot stage loads the OS loader from a fixed position on
56the boot device, and then transfers control to it.
c13182ef 57.TP
fea681da 58Note:
a879ea43
MW
59The device from which the OS loader is read may be attached via a network, in which
60case the details of booting are further specified by protocols such as
61DHCP, TFTP, PXE, Etherboot, etc.
73d8cece 62.SS OS loader
a879ea43
MW
63The main job of the OS loader is to locate the kernel
64on some device, load it, and run it.
65Most OS loaders allow
66interactive use, in order to enable specification of an alternative
67kernel (maybe a backup in case the one last compiled
68isn't functioning) and to pass optional parameters
69to the kernel.
a721e8b2 70.PP
a879ea43
MW
71In a traditional PC, the OS loader is located in the initial 512-byte block
72of the boot device; this block is known as "the \fBMBR\fR"
fea681da 73(Master Boot Record).
a721e8b2 74.PP
a879ea43 75In most systems, the OS loader is very
c13182ef 76limited due to various constraints.
a879ea43
MW
77Even on non-PC systems,
78there are some limitations on the size and complexity
fea681da 79of this loader, but the size limitation of the PC MBR
a879ea43
MW
80(512 bytes, including the partition table) makes it
81almost impossible to squeeze much functionality into it.
a721e8b2 82.PP
a879ea43
MW
83Therefore, most systems split the role of loading the OS between
84a primary OS loader and a secondary OS loader; this secondary
85OS loader may be located within a larger portion of persistent
86storage, such as a disk partition.
a721e8b2 87.PP
a879ea43 88In Linux, the OS loader is often either
fea681da
MK
89.BR lilo (8)
90or
91.BR grub (8).
a879ea43
MW
92.SS Kernel
93When the kernel is loaded, it initializes various components of
94the computer and operating system; each portion of software
95responsible for such a task is usually consider "a \fBdriver\fR" for
cc2cc29d
MK
96the applicable component.
97The kernel starts the virtual memory
a879ea43
MW
98swapper (it is a kernel process, called "kswapd" in a modern Linux
99kernel), and mounts some filesystem at the root path,
100.IR / .
a721e8b2 101.PP
fea681da 102Some of the parameters that may be passed to the kernel
a879ea43 103relate to these activities (for example, the default root filesystem
9284f6e7 104can be overridden); for further information
a879ea43 105on Linux kernel parameters, read
fea681da 106.BR bootparam (7).
a721e8b2 107.PP
a879ea43
MW
108Only then does the kernel create the initial userland
109process, which is given the number 1 as its
110.B PID
111(process ID).
112Traditionally, this process executes the
fea681da
MK
113program
114.IR /sbin/init ,
a879ea43
MW
115to which are passed the parameters that haven't already been
116handled by the kernel.
117.SS Root user-space process
fbf0b164
MW
118.TP
119Note:
120The following description applies to an OS based on UNIX System V Release 4.
a2250622
MK
121However, a number of widely used systems have adopted a related but
122fundamentally different approach known as
fbf0b164
MW
123.BR systemd (1),
124for which the bootup process is detailed in its associated
125.BR bootup (7).
dd3568a1 126.PP
a879ea43
MW
127When
128.I /sbin/init
129starts, it reads
fea681da
MK
130.I /etc/inittab
131for further instructions.
a879ea43
MW
132This file defines what should be run when the
133.I /sbin/init
134program is instructed to enter a particular \fIrun-level\fR, giving
135the administrator an easy way to establish an environment
136for some usage; each run-level is associated with a set of services
137(for example, run-level \fBS\fR is \fIsingle-user\fR mode,
138and run-level \fB2\fR entails running most network services).
a721e8b2 139.PP
c13182ef 140The administrator may change the current
fea681da 141run-level via
a879ea43 142.BR init (1),
fea681da
MK
143and query the current run-level via
144.BR runlevel (8).
a721e8b2 145.PP
fea681da 146However, since it is not convenient to manage individual services
a879ea43
MW
147by editing this file,
148.I /etc/inittab
149only bootstraps a set of scripts
fea681da 150that actually start/stop the individual services.
73d8cece 151.SS Boot scripts
c13182ef 152.TP
fea681da 153Note:
fbf0b164 154The following description applies to an OS based on UNIX System V Release 4.
a2250622 155However, a number of widely used systems (Slackware Linux, FreeBSD, OpenBSD)
a879ea43 156have a somewhat different scheme for boot scripts.
dd3568a1 157.PP
a879ea43 158For each managed service (mail, nfs server, cron, etc.), there is
fea681da
MK
159a single startup script located in a specific directory
160.RI ( /etc/init.d
161in most versions of Linux).
162Each of these scripts accepts as a single argument
a879ea43
MW
163the word "start" (causing it to start the service) or the word
164\&"stop" (causing it to stop the service).
c13182ef 165The script may optionally
52d30ddb 166accept other "convenience" parameters (e.g., "restart" to stop and then
a879ea43 167start, "status" to display the service status, etc.).
c13182ef 168Running the script
fea681da 169without parameters displays the possible arguments.
73d8cece 170.SS Sequencing directories
a879ea43
MW
171To make specific scripts start/stop at specific run-levels and in a
172specific order, there are \fIsequencing directories\fR, normally
173of the form \fI/etc/rc[0\-6S].d\fR.
174In each of these directories,
db55c5c5 175there are links (usually symbolic) to the scripts in the \fI/etc/init.d\fR
fea681da 176directory.
a721e8b2 177.PP
c13182ef 178A primary script (usually \fI/etc/rc\fR) is called from
a879ea43
MW
179.BR inittab (5);
180this primary script calls each service's script via a link in the
181relevant sequencing directory.
182Each link whose name begins with \(aqS\(aq is called with
84c517a4 183the argument "start" (thereby starting the service).
a879ea43
MW
184Each link whose name begins with \(aqK\(aq is called with
185the argument "stop" (thereby stopping the service).
a721e8b2 186.PP
fea681da 187To define the starting or stopping order within the same run-level,
a879ea43
MW
188the name of a link contains an \fBorder-number\fR.
189Also, for clarity, the name of a link usually
190ends with the name of the service to which it refers.
191For example,
fea681da 192the link \fI/etc/rc2.d/S80sendmail\fR starts the sendmail service on
c13182ef
MK
193runlevel 2.
194This happens after \fI/etc/rc2.d/S12syslog\fR is run
fea681da 195but before \fI/etc/rc2.d/S90xfs\fR is run.
a721e8b2 196.PP
a879ea43
MW
197To manage these links is to manage the boot order and run-levels;
198under many systems, there are tools to help with this task
199(e.g.,
fea681da 200.BR chkconfig (8)).
73d8cece 201.SS Boot configuration
a879ea43
MW
202A program that provides a service is often called a "\fBdaemon\fR".
203Usually, a daemon may receive various command-line options
c13182ef 204and parameters.
a879ea43
MW
205To allow a system administrator to change these
206inputs without editing an entire boot script,
207some separate configuration file is used, and is located in a specific
208directory where an associated boot script may find it
fbf0b164 209(\fI/etc/sysconfig\fR on older Red Hat systems).
a721e8b2 210.PP
a879ea43
MW
211In older UNIX systems, such a file contained the actual command line
212options for a daemon, but in modern Linux systems (and also
213in HP-UX), it just contains shell variables.
214A boot script in \fI/etc/init.d\fR reads and includes its configuration
215file (that is, it "\fBsources\fR" its configuration file) and then uses
216the variable values.
d4438ce6 217.SH FILES
dd3568a1 218.PP
fea681da 219.IR /etc/init.d/ ,
7174626f 220.IR /etc/rc[S0\-6].d/ ,
fea681da 221.I /etc/sysconfig/
d4438ce6 222.SH SEE ALSO
712550ff
MK
223.BR init (1),
224.BR systemd (1),
fea681da
MK
225.BR inittab (5),
226.BR bootparam (7),
712550ff 227.BR bootup (7),
fea681da
MK
228.BR runlevel (8),
229.BR shutdown (8)