| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 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) |
| 8 |
.\" - kernel and init(1) is applicable to almost any UNIX/Linux |
| 9 |
.\" - boot scripts are applicable to SYSV-R4 based UNIX/Linux |
| 10 |
.\" |
| 11 |
.TH boot 7 2025-09-21 "Linux man-pages 6.18" |
| 12 |
.SH NAME |
| 13 |
boot \- System bootup process based on UNIX System V Release 4 |
| 14 |
.SH DESCRIPTION |
| 15 |
The |
| 16 |
.B bootup process |
| 17 |
(or |
| 18 |
.RB \[dq] boot\~sequence \[dq]) |
| 19 |
varies in details |
| 20 |
among systems, but can be roughly divided into phases controlled by |
| 21 |
the following components: |
| 22 |
.IP (1) 5 |
| 23 |
hardware |
| 24 |
.IP (2) |
| 25 |
operating system (OS) loader |
| 26 |
.IP (3) |
| 27 |
kernel |
| 28 |
.IP (4) |
| 29 |
root user-space process |
| 30 |
.RB ( init (8) |
| 31 |
and |
| 32 |
.BR inittab (5)) |
| 33 |
.IP (5) |
| 34 |
boot scripts |
| 35 |
.P |
| 36 |
Each of these is described below in more detail. |
| 37 |
.SS Hardware |
| 38 |
After power-on or hard reset, |
| 39 |
control is given to a program stored in read-only memory |
| 40 |
(normally PROM); |
| 41 |
for historical reasons involving the personal computer, |
| 42 |
this program is often called |
| 43 |
"the |
| 44 |
.BR BIOS \[dq]. |
| 45 |
.P |
| 46 |
This program normally performs a basic self-test of the machine |
| 47 |
and accesses nonvolatile memory to read further parameters. |
| 48 |
This memory in the PC is battery-backed CMOS memory, |
| 49 |
so most people refer to it as "the |
| 50 |
.BR CMOS \[dq]; |
| 51 |
outside of the PC world, |
| 52 |
it is usually called |
| 53 |
"the |
| 54 |
.BR NVRAM \[dq] |
| 55 |
(nonvolatile RAM). |
| 56 |
.P |
| 57 |
The parameters stored in the NVRAM vary among systems, |
| 58 |
but as a minimum, |
| 59 |
they should specify which device can supply an OS loader, |
| 60 |
or at least which devices may be probed for one; |
| 61 |
such a device is known as |
| 62 |
"the |
| 63 |
.BR boot\~device \[dq]. |
| 64 |
The hardware boot stage loads the OS loader |
| 65 |
from a fixed position on the boot device, |
| 66 |
and then transfers control to it. |
| 67 |
.TP |
| 68 |
Note: |
| 69 |
The device from which the OS loader is read may be attached via a network, |
| 70 |
in which case, |
| 71 |
the details of booting are further specified by protocols such as |
| 72 |
DHCP, TFTP, PXE, Etherboot, etc. |
| 73 |
.SS OS loader |
| 74 |
The main job of the OS loader is |
| 75 |
to locate the kernel on some device, |
| 76 |
load it, |
| 77 |
and run it. |
| 78 |
Most OS loaders allow interactive use, |
| 79 |
in order to enable specification of an alternative kernel |
| 80 |
(maybe a backup in case the one last compiled isn't functioning) |
| 81 |
and to pass optional parameters to the kernel. |
| 82 |
.P |
| 83 |
In a traditional PC, |
| 84 |
the OS loader is located in the initial 512-byte block of the boot device; |
| 85 |
this block is known as |
| 86 |
"the |
| 87 |
.BR MBR \[dq] |
| 88 |
(Master Boot Record). |
| 89 |
.P |
| 90 |
In most systems, |
| 91 |
the OS loader is very limited due to various constraints. |
| 92 |
Even on non-PC systems, |
| 93 |
there are some limitations on the size and complexity of this loader, |
| 94 |
but the size limitation of the PC MBR |
| 95 |
(512 bytes, including the partition table) |
| 96 |
makes it almost impossible to squeeze much functionality into it. |
| 97 |
.P |
| 98 |
Therefore, |
| 99 |
most systems split the role of loading the OS between |
| 100 |
a primary OS loader and a secondary OS loader; |
| 101 |
this secondary OS loader |
| 102 |
may be located within a larger portion of persistent storage, |
| 103 |
such as a disk partition. |
| 104 |
.P |
| 105 |
In Linux, |
| 106 |
the OS loader is often |
| 107 |
.BR grub (8) |
| 108 |
(an alternative is |
| 109 |
.BR lilo (8)). |
| 110 |
.SS Kernel |
| 111 |
When the kernel is loaded, |
| 112 |
it initializes various components of the computer and operating system; |
| 113 |
each portion of software responsible for such a task is usually considered |
| 114 |
"a |
| 115 |
.BR driver \[dq] |
| 116 |
for the applicable component. |
| 117 |
The kernel starts the virtual memory swapper |
| 118 |
(it is a kernel process, called "kswapd" in a modern Linux kernel), |
| 119 |
and mounts some filesystem at the root path, |
| 120 |
.IR / . |
| 121 |
.P |
| 122 |
Some of the parameters that may be passed to the kernel |
| 123 |
relate to these activities |
| 124 |
(for example, |
| 125 |
the default root filesystem can be overridden); |
| 126 |
for further information on Linux kernel parameters, |
| 127 |
read |
| 128 |
.BR bootparam (7). |
| 129 |
.P |
| 130 |
Only then does the kernel create the initial user-space process, |
| 131 |
which is given the number 1 as its |
| 132 |
.B PID |
| 133 |
(process ID). |
| 134 |
Traditionally, |
| 135 |
this process executes the program |
| 136 |
.IR /sbin/init , |
| 137 |
to which are passed |
| 138 |
the parameters that haven't already been handled by the kernel. |
| 139 |
.SS Root user-space process |
| 140 |
.TP |
| 141 |
Note: |
| 142 |
The following description applies to an OS based on UNIX System V Release 4. |
| 143 |
However, |
| 144 |
a number of widely used systems have adopted a related |
| 145 |
but fundamentally different approach known as |
| 146 |
.BR systemd (1), |
| 147 |
for which the bootup process is detailed in its associated |
| 148 |
.BR bootup (7). |
| 149 |
.P |
| 150 |
When |
| 151 |
.I /sbin/init |
| 152 |
starts, |
| 153 |
it reads |
| 154 |
.I /etc/inittab |
| 155 |
for further instructions. |
| 156 |
This file defines what should be run when the |
| 157 |
.I /sbin/init |
| 158 |
program is instructed to enter a particular run level, |
| 159 |
giving the administrator an easy way to |
| 160 |
establish an environment for some usage; |
| 161 |
each run level is associated with a set of services |
| 162 |
(for example, |
| 163 |
run level |
| 164 |
.B S |
| 165 |
is single-user mode, |
| 166 |
and run level |
| 167 |
.B 2 |
| 168 |
entails running most network services). |
| 169 |
.P |
| 170 |
The administrator may change the current run level via |
| 171 |
.BR init (1), |
| 172 |
and query the current run level via |
| 173 |
.BR runlevel (8). |
| 174 |
.P |
| 175 |
However, |
| 176 |
since it is not convenient to manage individual services by editing this file, |
| 177 |
.I /etc/inittab |
| 178 |
only bootstraps a set of scripts |
| 179 |
that actually start/stop the individual services. |
| 180 |
.SS Boot scripts |
| 181 |
.TP |
| 182 |
Note: |
| 183 |
The following description applies to an OS based on UNIX System V Release 4. |
| 184 |
However, |
| 185 |
a number of widely used systems (Slackware Linux, FreeBSD, OpenBSD) |
| 186 |
have a somewhat different scheme for boot scripts. |
| 187 |
.P |
| 188 |
For each managed service (mail, nfs server, cron, etc.), |
| 189 |
there is a single startup script located in a specific directory |
| 190 |
.RI ( /etc/init.d |
| 191 |
in most versions of Linux). |
| 192 |
Each of these scripts |
| 193 |
accepts as a single argument the word "start" |
| 194 |
(causing it to start the service) |
| 195 |
or the word "stop" |
| 196 |
(causing it to stop the service). |
| 197 |
The script may optionally accept other convenience parameters |
| 198 |
(e.g., |
| 199 |
"restart" to stop and then start, |
| 200 |
"status" to display the service status, |
| 201 |
etc.). |
| 202 |
Running the script without parameters |
| 203 |
displays the possible arguments. |
| 204 |
.SS Sequencing directories |
| 205 |
To make specific scripts start/stop |
| 206 |
at specific run levels |
| 207 |
and in a specific order, |
| 208 |
there are |
| 209 |
.IR sequencing\~directories , |
| 210 |
normally of the form |
| 211 |
.IR /etc/rc[0\-6S].d . |
| 212 |
In each of these directories, |
| 213 |
there are links |
| 214 |
(usually symbolic) |
| 215 |
to the scripts in the |
| 216 |
.I /etc/init.d |
| 217 |
directory. |
| 218 |
.P |
| 219 |
A primary script |
| 220 |
(usually |
| 221 |
.IR /etc/rc ) |
| 222 |
is called from |
| 223 |
.BR inittab (5); |
| 224 |
this primary script calls each service's script |
| 225 |
via a link in the relevant sequencing directory. |
| 226 |
Each link whose name begins with \[aq]S\[aq] is called |
| 227 |
with the argument "start" |
| 228 |
(thereby starting the service). |
| 229 |
Each link whose name begins with \[aq]K\[aq] is called |
| 230 |
with the argument "stop" |
| 231 |
(thereby stopping the service). |
| 232 |
.P |
| 233 |
To define the starting or stopping order within the same run level, |
| 234 |
the name of a link contains an |
| 235 |
.BR order-number . |
| 236 |
Also, for clarity, |
| 237 |
the name of a link |
| 238 |
usually ends with the name of the service to which it refers. |
| 239 |
For example, |
| 240 |
the link |
| 241 |
.I /etc/rc2.d/S80sendmail |
| 242 |
starts the |
| 243 |
.BR sendmail (8) |
| 244 |
service on |
| 245 |
run level 2. |
| 246 |
This happens after |
| 247 |
.I /etc/rc2.d/S12syslog |
| 248 |
is run |
| 249 |
but before |
| 250 |
.I /etc/rc2.d/S90xfs |
| 251 |
is run. |
| 252 |
.P |
| 253 |
To manage these links is to manage the boot order and run levels; |
| 254 |
under many systems, |
| 255 |
there are tools to help with this task |
| 256 |
(e.g., |
| 257 |
.BR chkconfig (8)). |
| 258 |
.SS Boot configuration |
| 259 |
A program that provides a service is often called a |
| 260 |
.RB \[dq] daemon \[dq]. |
| 261 |
Usually, |
| 262 |
a daemon may receive various command-line options and parameters. |
| 263 |
To allow a system administrator to |
| 264 |
change these inputs without editing an entire boot script, |
| 265 |
some separate configuration file is used, |
| 266 |
and is located in a specific directory |
| 267 |
where an associated boot script may find it |
| 268 |
.RI ( /etc/sysconfig |
| 269 |
on older Red Hat systems). |
| 270 |
.P |
| 271 |
In older UNIX systems, |
| 272 |
such a file contained the actual command line options for a daemon, |
| 273 |
but in modern Linux systems (and also in HP-UX), |
| 274 |
it just contains shell variables. |
| 275 |
A boot script in |
| 276 |
.I /etc/init.d |
| 277 |
reads and includes its configuration file |
| 278 |
(that is, |
| 279 |
it |
| 280 |
.RB \[dq] sources \[dq] |
| 281 |
its configuration file) |
| 282 |
and then uses the variable values. |
| 283 |
.SH FILES |
| 284 |
.IR /etc/init.d/ , |
| 285 |
.IR /etc/rc[S0\-6].d/ , |
| 286 |
.I /etc/sysconfig/ |
| 287 |
.SH SEE ALSO |
| 288 |
.BR init (1), |
| 289 |
.BR systemd (1), |
| 290 |
.BR inittab (5), |
| 291 |
.BR bootparam (7), |
| 292 |
.BR bootup (7), |
| 293 |
.BR runlevel (8), |
| 294 |
.BR shutdown (8) |