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