1
00:00:00,000 --> 00:00:01,380
In this lesson,

2
00:00:01,380 --> 00:00:04,022
we're going to discuss the different Linux boot components.

3
00:00:04,022 --> 00:00:06,270
Now, that we've configured the kernel,

4
00:00:06,270 --> 00:00:09,300
we need to learn about how the kernel is loaded into memory

5
00:00:09,300 --> 00:00:12,510
and how the operating system is actually going to start up.

6
00:00:12,510 --> 00:00:15,600
We're also going to configure the boot process to our liking,

7
00:00:15,600 --> 00:00:17,190
ensuring that the Linux workspace

8
00:00:17,190 --> 00:00:20,070
operates as intended from the very beginning.

9
00:00:20,070 --> 00:00:21,780
Now, have you ever wondered what it takes

10
00:00:21,780 --> 00:00:24,960
to get your system ready to run applications and programs?

11
00:00:24,960 --> 00:00:28,260
To begin with, we have to understand the Linux boot process,

12
00:00:28,260 --> 00:00:29,580
because this is very important

13
00:00:29,580 --> 00:00:31,380
for us to be able to configure Linux

14
00:00:31,380 --> 00:00:33,000
and resolve startup issues,

15
00:00:33,000 --> 00:00:35,250
as well as to identify various components

16
00:00:35,250 --> 00:00:36,780
that make up the boot process

17
00:00:36,780 --> 00:00:39,480
and configure them whenever we need to.

18
00:00:39,480 --> 00:00:40,410
Now, in Linux,

19
00:00:40,410 --> 00:00:43,110
there are going to be six different stages of booting.

20
00:00:43,110 --> 00:00:45,450
This is called the booting process.

21
00:00:45,450 --> 00:00:47,665
So, what is the booting process?

22
00:00:47,665 --> 00:00:50,160
Well, booting is a process of starting

23
00:00:50,160 --> 00:00:51,660
or restarting a computer

24
00:00:51,660 --> 00:00:55,350
and loading an operating system for the user to access.

25
00:00:55,350 --> 00:00:56,773
In the boot process,

26
00:00:56,773 --> 00:00:59,070
a booting environment reads a small program

27
00:00:59,070 --> 00:01:02,550
that's stored in read-only memory known as ROM.

28
00:01:02,550 --> 00:01:05,310
This program then executes various operations

29
00:01:05,310 --> 00:01:08,370
inside your RAM or your random-access memory,

30
00:01:08,370 --> 00:01:10,740
and that's going to bootstrap the operating system

31
00:01:10,740 --> 00:01:12,660
and make it available for use.

32
00:01:12,660 --> 00:01:15,210
Linux like most other operating systems

33
00:01:15,210 --> 00:01:18,030
has to be booted before it can function.

34
00:01:18,030 --> 00:01:19,860
Now, there are various options associated

35
00:01:19,860 --> 00:01:21,870
with the boot process that you're going to be able

36
00:01:21,870 --> 00:01:24,480
to configure as well if you need to.

37
00:01:24,480 --> 00:01:27,690
A boot loader is a small program that's stored in ROM

38
00:01:27,690 --> 00:01:30,060
and that's going to load the kernel from a storage device,

39
00:01:30,060 --> 00:01:31,650
like a hard disc drive.

40
00:01:31,650 --> 00:01:34,680
And then, it's going to start up the operating system.

41
00:01:34,680 --> 00:01:36,960
When a computer is powered up or restarted,

42
00:01:36,960 --> 00:01:40,140
the basic input/output system performs initial tests

43
00:01:40,140 --> 00:01:43,560
and then transfers control over to the Master Boot Record.

44
00:01:43,560 --> 00:01:46,590
And this is where the boot loader is going to reside.

45
00:01:46,590 --> 00:01:47,700
Boot loaders are able

46
00:01:47,700 --> 00:01:50,400
to protect the boot process with a password,

47
00:01:50,400 --> 00:01:51,270
and that's going to prevent

48
00:01:51,270 --> 00:01:53,610
unauthorized booting of your system.

49
00:01:53,610 --> 00:01:56,610
The boot loader can also use three main components

50
00:01:56,610 --> 00:01:59,340
that are going to work together to systematically load up

51
00:01:59,340 --> 00:02:02,430
the operating system in three different stages.

52
00:02:02,430 --> 00:02:05,280
The first component is the boot sector program

53
00:02:05,280 --> 00:02:08,160
and this is loaded by a boot environment on startup,

54
00:02:08,160 --> 00:02:12,300
but it's main function is to load up the second boot loader.

55
00:02:12,300 --> 00:02:13,980
The second stage boot loader

56
00:02:13,980 --> 00:02:15,600
is going to load the operating system,

57
00:02:15,600 --> 00:02:17,880
and this contains a kernel loader.

58
00:02:17,880 --> 00:02:20,340
On the other hand, the boot loader installer

59
00:02:20,340 --> 00:02:23,040
is going to control the installation of drive sectors

60
00:02:23,040 --> 00:02:25,920
and can only be run when booting from a drive.

61
00:02:25,920 --> 00:02:27,420
It's going to coordinate the activities

62
00:02:27,420 --> 00:02:30,180
of the boot sector and the boot loader.

63
00:02:30,180 --> 00:02:32,040
Now, there are several boot options

64
00:02:32,040 --> 00:02:35,280
where you can boot Linux from a basic input/output system

65
00:02:35,280 --> 00:02:37,950
known as BIOS or the UEFI,

66
00:02:37,950 --> 00:02:42,330
the Unified Extensible Firmware Interface or UEFI.

67
00:02:42,330 --> 00:02:44,850
Now, when a computer with BIOS is powered on,

68
00:02:44,850 --> 00:02:47,400
the BIOS firmware is the first thing to run,

69
00:02:47,400 --> 00:02:48,450
and this is going to enable it

70
00:02:48,450 --> 00:02:51,120
to test the various hardware components in a computer,

71
00:02:51,120 --> 00:02:52,680
as well as run a boot loader,

72
00:02:52,680 --> 00:02:55,260
so the operating system can start up.

73
00:02:55,260 --> 00:02:57,210
The BIOS has access to the ports

74
00:02:57,210 --> 00:02:59,940
that are used by the basic hardware input devices,

75
00:02:59,940 --> 00:03:02,010
things like the mouse and the keyboard

76
00:03:02,010 --> 00:03:04,950
And users can also load up a BIOS interface

77
00:03:04,950 --> 00:03:07,320
instead of going into an operating system.

78
00:03:07,320 --> 00:03:08,340
This is done if they need

79
00:03:08,340 --> 00:03:10,860
to make various hardware level changes.

80
00:03:10,860 --> 00:03:15,150
On the other hand, UEFI is going to run faster than the BIOS.

81
00:03:15,150 --> 00:03:17,520
It also operates with a greater amount of memory

82
00:03:17,520 --> 00:03:19,380
and it gives you access to storage drives

83
00:03:19,380 --> 00:03:21,360
of various different sizes.

84
00:03:21,360 --> 00:03:23,970
It'll also allow you to access more hardware types

85
00:03:23,970 --> 00:03:26,550
and has much more improved security protections

86
00:03:26,550 --> 00:03:28,590
than standard BIOS does.

87
00:03:28,590 --> 00:03:30,810
One security feature that both the BIOS

88
00:03:30,810 --> 00:03:34,350
and UEFI will have is the ability to set a password.

89
00:03:34,350 --> 00:03:36,870
If this password is not provided at boot time,

90
00:03:36,870 --> 00:03:39,270
the system will simply not boot.

91
00:03:39,270 --> 00:03:42,630
Now, because the BIOS and UEFI are firmware,

92
00:03:42,630 --> 00:03:44,250
they do differ based on the different

93
00:03:44,250 --> 00:03:46,500
hardware manufacturers that make them.

94
00:03:46,500 --> 00:03:48,330
And the process of setting up this password

95
00:03:48,330 --> 00:03:49,800
is not going to be consistent

96
00:03:49,800 --> 00:03:52,800
across all BIOS or UEFI firmwares.

97
00:03:52,800 --> 00:03:55,860
Another boot option includes booting from an ISO

98
00:03:55,860 --> 00:03:57,420
which is an image file.

99
00:03:57,420 --> 00:03:59,670
This is where you need to write that ISO file

100
00:03:59,670 --> 00:04:02,400
to an optical disc or a USB thumb drive,

101
00:04:02,400 --> 00:04:04,800
and then insert that media into the computer

102
00:04:04,800 --> 00:04:07,470
and instruct your boot environment like the UEFI

103
00:04:07,470 --> 00:04:11,130
or the BIOS to boot from that media device instead.

104
00:04:11,130 --> 00:04:14,190
Another way you can boot up is by using PXE,

105
00:04:14,190 --> 00:04:16,769
which is a Preboot eXecution Environment.

106
00:04:16,769 --> 00:04:18,690
This is part of the UEFI standard,

107
00:04:18,690 --> 00:04:19,769
and it enables a client

108
00:04:19,769 --> 00:04:21,600
to retrieve the necessary boot loader

109
00:04:21,600 --> 00:04:24,780
and system files from a server over the network.

110
00:04:24,780 --> 00:04:28,320
Now, the client configures UEFI to boot from the PXE.

111
00:04:28,320 --> 00:04:30,750
And during the startup process, it's going to search

112
00:04:30,750 --> 00:04:33,510
for a Dynamic Host Configuration Protocol server

113
00:04:33,510 --> 00:04:37,890
or DHCP server that also acts as your PXE server.

114
00:04:37,890 --> 00:04:40,890
Clients can also acquire boot data over a network

115
00:04:40,890 --> 00:04:44,190
from the content delivery protocols like HTTP,

116
00:04:44,190 --> 00:04:46,110
the Hypertext Transfer Protocol

117
00:04:46,110 --> 00:04:49,200
or FTP the File Transfer Protocol.

118
00:04:49,200 --> 00:04:51,810
These are typically going to be faster, more reliable,

119
00:04:51,810 --> 00:04:55,530
and more secure than using a standard TFTP protocol

120
00:04:55,530 --> 00:04:58,189
like you'd normally use in PXE environments.

121
00:04:58,189 --> 00:05:02,610
Finally, booting from NFS or a Network File System

122
00:05:02,610 --> 00:05:05,130
allows a client to mount an NFS share

123
00:05:05,130 --> 00:05:08,490
as its root file system, and then operate over the network.

124
00:05:08,490 --> 00:05:10,500
This share must be prepared ahead of time though,

125
00:05:10,500 --> 00:05:12,510
and stored on an NFS server

126
00:05:12,510 --> 00:05:14,940
that the client can retrieve the files from.

127
00:05:14,940 --> 00:05:18,000
Therefore, the client does not store the data locally,

128
00:05:18,000 --> 00:05:19,920
but instead, it stores everything

129
00:05:19,920 --> 00:05:22,120
on that network file server.

130
00:05:22,120 --> 00:05:23,820
Another thing we have to think about

131
00:05:23,820 --> 00:05:25,710
is how is a hard disk read from

132
00:05:25,710 --> 00:05:28,380
or written to by an operating system.

133
00:05:28,380 --> 00:05:29,250
Now, the information

134
00:05:29,250 --> 00:05:31,320
about how a hard disc has been partitioned

135
00:05:31,320 --> 00:05:34,080
is going to be stored inside your Master Boot Record,

136
00:05:34,080 --> 00:05:36,120
known as the MBR.

137
00:05:36,120 --> 00:05:38,010
The Master Boot Record is a sector

138
00:05:38,010 --> 00:05:39,780
that the BIOS is going to read in

139
00:05:39,780 --> 00:05:42,480
and start when the machine is first booted.

140
00:05:42,480 --> 00:05:45,180
The Master Boot Record contains a small program

141
00:05:45,180 --> 00:05:46,890
that reads the partition tables

142
00:05:46,890 --> 00:05:48,990
and it checks which partitions are active

143
00:05:48,990 --> 00:05:52,140
and then reads the first sector of that partition.

144
00:05:52,140 --> 00:05:54,990
This boot sector contains another small program

145
00:05:54,990 --> 00:05:56,310
that's going to read the first part

146
00:05:56,310 --> 00:05:59,250
of the operating system that's stored on that partition,

147
00:05:59,250 --> 00:06:01,080
assuming it's active and bootable,

148
00:06:01,080 --> 00:06:03,480
and then it's going to start it up.

149
00:06:03,480 --> 00:06:05,670
If you're using a GUID Partition Table,

150
00:06:05,670 --> 00:06:07,650
also known as the GPT,

151
00:06:07,650 --> 00:06:10,650
this is a newer version of a Master Boot Record.

152
00:06:10,650 --> 00:06:12,840
And it basically makes up for the shortcomings

153
00:06:12,840 --> 00:06:14,940
that were inside of a Master Boot Record,

154
00:06:14,940 --> 00:06:17,130
because it is an older technology.

155
00:06:17,130 --> 00:06:18,930
Just like a Master Boot Record,

156
00:06:18,930 --> 00:06:21,420
a GPT is a partition structure,

157
00:06:21,420 --> 00:06:24,240
but it's going to employ a more modern design,

158
00:06:24,240 --> 00:06:26,670
and it's part of the UEFI standard

159
00:06:26,670 --> 00:06:29,640
instead of relying on the older BIOS standards.

160
00:06:29,640 --> 00:06:31,080
Every partition on a drive

161
00:06:31,080 --> 00:06:36,030
is assigned a globally unique identifier or a GUID, or GUID.

162
00:06:36,030 --> 00:06:38,940
This allows it to distinguish it from every other partition

163
00:06:38,940 --> 00:06:41,790
on every other drive theoretically.

164
00:06:41,790 --> 00:06:45,360
Other than formatting a partition as MBR or GPT,

165
00:06:45,360 --> 00:06:48,060
you can also format a partition as raw.

166
00:06:48,060 --> 00:06:50,250
Now, a raw partition enables users

167
00:06:50,250 --> 00:06:51,960
and applications to read from

168
00:06:51,960 --> 00:06:54,990
or write to a block storage device directly

169
00:06:54,990 --> 00:06:57,150
without using the system's cache.

170
00:06:57,150 --> 00:06:59,490
This is useful in situations where a software

171
00:06:59,490 --> 00:07:01,290
like a database management system

172
00:07:01,290 --> 00:07:04,656
or DBMS has its own caching mechanism.

173
00:07:04,656 --> 00:07:07,770
Another thing we need talk about is RAM disk.

174
00:07:07,770 --> 00:07:12,360
There's this thing known as the initial RAM disk or initrd.

175
00:07:12,360 --> 00:07:14,610
And this refers to the root file system

176
00:07:14,610 --> 00:07:18,295
that's temporarily loaded in the memory upon system boot.

177
00:07:18,295 --> 00:07:22,350
This initial RAM disk is going to load alongside the kernel

178
00:07:22,350 --> 00:07:25,020
and it's going to control all the functionality.

179
00:07:25,020 --> 00:07:26,400
This initial RAM disk

180
00:07:26,400 --> 00:07:29,280
will enable the system to be started in two phases.

181
00:07:29,280 --> 00:07:30,570
During the first phase,

182
00:07:30,570 --> 00:07:33,180
the system is booted with a minimal set of modules

183
00:07:33,180 --> 00:07:34,800
that are required to load the main

184
00:07:34,800 --> 00:07:37,050
or the permanent root file system.

185
00:07:37,050 --> 00:07:38,430
In the second phase,

186
00:07:38,430 --> 00:07:40,980
the main root file system is going to be mounted.

187
00:07:40,980 --> 00:07:42,900
And then, the previously mounted

188
00:07:42,900 --> 00:07:45,990
initial RAM disk file system can be removed.

189
00:07:45,990 --> 00:07:47,700
And this way, the user space

190
00:07:47,700 --> 00:07:50,010
boot process can continue forward.

191
00:07:50,010 --> 00:07:52,110
The initial RAM disk is going to be useful

192
00:07:52,110 --> 00:07:53,910
because there are potential variables

193
00:07:53,910 --> 00:07:56,370
that can complicate the boot process.

194
00:07:56,370 --> 00:07:58,500
For example, the kernel needs to find

195
00:07:58,500 --> 00:08:01,020
and load the necessary device driver modules,

196
00:08:01,020 --> 00:08:03,750
as well as the actual route file system itself.

197
00:08:03,750 --> 00:08:05,190
There's also the possibility

198
00:08:05,190 --> 00:08:07,230
that the route file system uses one

199
00:08:07,230 --> 00:08:09,420
of several advanced storage mechanisms

200
00:08:09,420 --> 00:08:12,060
like LVM the Logical Volume Manager,

201
00:08:12,060 --> 00:08:14,760
or NFS the Network File System.

202
00:08:14,760 --> 00:08:16,590
And these have different mounting requirements

203
00:08:16,590 --> 00:08:18,442
than a standard partition would.

204
00:08:18,442 --> 00:08:21,720
The Linux initial RAM disk image is an archive file

205
00:08:21,720 --> 00:08:23,520
that contains all the essential files

206
00:08:23,520 --> 00:08:26,460
that are required for booting up the operating system.

207
00:08:26,460 --> 00:08:29,760
It can be built or customized to include additional modules

208
00:08:29,760 --> 00:08:34,470
or remove unnecessary modules, or update existing modules.

209
00:08:34,470 --> 00:08:35,789
Typically, this image

210
00:08:35,789 --> 00:08:38,532
is going to be stored in the /boot directory.

211
00:08:38,532 --> 00:08:40,950
Now, to make our initial RAM disk,

212
00:08:40,950 --> 00:08:44,070
we're going to use the make initial RAM disk command.

213
00:08:44,070 --> 00:08:45,960
The make initial RAM disk command

214
00:08:45,960 --> 00:08:48,390
is used to create the initial RAM disk image

215
00:08:48,390 --> 00:08:50,700
for preloading the kernel modules.

216
00:08:50,700 --> 00:08:55,050
This command is written as mkinitrd.

217
00:08:55,050 --> 00:08:56,760
Now, there's a couple of different options

218
00:08:56,760 --> 00:08:59,010
for the make initial RAM disk command.

219
00:08:59,010 --> 00:09:03,480
This includes the --preload equals module name option,

220
00:09:03,480 --> 00:09:05,040
and this is used to load a module

221
00:09:05,040 --> 00:09:06,900
into that initial RAM disk image

222
00:09:06,900 --> 00:09:09,270
before loading the other modules.

223
00:09:09,270 --> 00:09:14,070
Another option we have is --width equals the module name.

224
00:09:14,070 --> 00:09:15,540
This option is going to be used

225
00:09:15,540 --> 00:09:18,330
to load a module in the initial RAM disk image

226
00:09:18,330 --> 00:09:20,580
after the loading of the other modules.

227
00:09:20,580 --> 00:09:22,830
The -f option is going to be used

228
00:09:22,830 --> 00:09:26,040
to overwrite an existing initial RAM disk image file.

229
00:09:26,040 --> 00:09:28,140
And the -nocompress option

230
00:09:28,140 --> 00:09:31,740
is used to disable the compression of that initial image.

231
00:09:31,740 --> 00:09:34,740
In order to run the make initial RAM disk command,

232
00:09:34,740 --> 00:09:38,760
you have to type in mkinitrd,

233
00:09:38,760 --> 00:09:39,810
the options,

234
00:09:39,810 --> 00:09:43,230
the initial RAM disk image name and the kernel version.

235
00:09:43,230 --> 00:09:46,500
For example, if you want to create the initial RAM disk image

236
00:09:46,500 --> 00:09:48,960
from your current kernel version and name it

237
00:09:48,960 --> 00:09:51,993
as initrd-<kernel version>.img,

238
00:09:53,250 --> 00:09:58,250
you can type mkinitrd/boot/initrd-$(uname -r)

239
00:10:05,348 --> 00:10:10,348
.img $(uname -r)

240
00:10:11,160 --> 00:10:12,930
in the command prompt.

241
00:10:12,930 --> 00:10:15,840
Now, as defined by the File System Hierarchy Standard

242
00:10:15,840 --> 00:10:19,740
or FHS, the /boot directory contains files

243
00:10:19,740 --> 00:10:23,100
that are used to facilitate the Linux boot process.

244
00:10:23,100 --> 00:10:24,930
Now, some of the files and sub-directories

245
00:10:24,930 --> 00:10:27,510
within the /boot directory that you should know about

246
00:10:27,510 --> 00:10:30,630
are things like the /boot/grub directory.

247
00:10:30,630 --> 00:10:32,520
This contains configuration files

248
00:10:32,520 --> 00:10:35,100
for a type of boot loader known as GRUB.

249
00:10:35,100 --> 00:10:38,400
If you go into the /boot/grub2 directory,

250
00:10:38,400 --> 00:10:40,230
this is also a different type of boot loader,

251
00:10:40,230 --> 00:10:41,730
but it's known as GRUB 2.

252
00:10:41,730 --> 00:10:44,070
It's an improved version of GRUB.

253
00:10:44,070 --> 00:10:47,670
The /boot/efi directory contains boot files

254
00:10:47,670 --> 00:10:51,420
for an EFI system partition known as ESP,

255
00:10:51,420 --> 00:10:52,710
which is going to be required

256
00:10:52,710 --> 00:10:53,970
for partitions of a system

257
00:10:53,970 --> 00:10:56,970
that boot from the UEFI interface.

258
00:10:56,970 --> 00:10:59,820
It also will contain a boot loader, device drivers,

259
00:10:59,820 --> 00:11:03,810
and system application files that are executed by the UEFI.

260
00:11:03,810 --> 00:11:05,250
The next one we need to talk about

261
00:11:05,250 --> 00:11:09,543
is /boot/initramfs-<kernel version>.img.

262
00:11:10,761 --> 00:11:12,150
This is a file

263
00:11:12,150 --> 00:11:15,120
that is going to be the initial RAM file system image.

264
00:11:15,120 --> 00:11:16,350
And this is an alternative

265
00:11:16,350 --> 00:11:19,440
to the initial RAM disk image that we talked about before.

266
00:11:19,440 --> 00:11:20,880
It's going to use different methods

267
00:11:20,880 --> 00:11:22,740
to do the same basic things.

268
00:11:22,740 --> 00:11:25,140
It's going to initialize a temporary route file system

269
00:11:25,140 --> 00:11:28,830
on the boot drive and then load in those modules as needed.

270
00:11:28,830 --> 00:11:33,630
Lastly, we have /boot/vmlinuz-<kernel version>

271
00:11:33,630 --> 00:11:36,450
and this contains the Linux kernel itself.

272
00:11:36,450 --> 00:11:39,330
The boot loader is going to load this file into memory

273
00:11:39,330 --> 00:11:40,710
during the boot process

274
00:11:40,710 --> 00:11:44,370
to initialize the overall Linux operating system.

275
00:11:44,370 --> 00:11:46,350
Another command you need to be familiar with

276
00:11:46,350 --> 00:11:49,620
is the dracut command.

277
00:11:49,620 --> 00:11:53,370
This is used to generate an init RAM file system image,

278
00:11:53,370 --> 00:11:57,330
similar to how we use the mkinitrd command

279
00:11:57,330 --> 00:11:59,790
to generate an initial RAM disk image.

280
00:11:59,790 --> 00:12:02,160
In fact, on some distributions,

281
00:12:02,160 --> 00:12:05,460
the make initial RAM disk is a compatibility wrapper

282
00:12:05,460 --> 00:12:08,520
that'll actually call the dracut command.

283
00:12:08,520 --> 00:12:11,610
When you want to create an initial RAM file system image,

284
00:12:11,610 --> 00:12:13,500
you can use the dracut command

285
00:12:13,500 --> 00:12:18,500
by typing in dracut /boot.initramfs-$(uname -r)

286
00:12:26,553 --> 00:12:31,553
.img $(uname -r).

287
00:12:32,580 --> 00:12:34,650
This boot process is going to be repeated

288
00:12:34,650 --> 00:12:36,720
each time your computer is started

289
00:12:36,720 --> 00:12:40,230
by loading up the operating system from a storage device.

290
00:12:40,230 --> 00:12:42,750
It's going to involve a series of sequential steps

291
00:12:42,750 --> 00:12:46,410
that can be divided into the BIOS or UEFI initialization,

292
00:12:46,410 --> 00:12:49,830
the boot loader, the kernel, and the initial RAM disk

293
00:12:49,830 --> 00:12:52,260
or initial RAM file system initiation,

294
00:12:52,260 --> 00:12:54,570
and finally, your boot scripts.

295
00:12:54,570 --> 00:12:57,330
First, the processor's going to check for the BIOS

296
00:12:57,330 --> 00:13:01,170
or UEFI firmware, and if it finds it, it's going to execute it.

297
00:13:01,170 --> 00:13:02,490
This is also where your power

298
00:13:02,490 --> 00:13:05,580
on self-test or post is going to occur.

299
00:13:05,580 --> 00:13:08,220
Second, the BIOS or UEFI is going to check

300
00:13:08,220 --> 00:13:10,950
for bootable media from the internal storage devices

301
00:13:10,950 --> 00:13:15,300
or peripherals like USB thumb drives and DVD ROMs.

302
00:13:15,300 --> 00:13:17,820
By doing this, it's going to locate a valid device

303
00:13:17,820 --> 00:13:19,620
to boot up your system from.

304
00:13:19,620 --> 00:13:23,400
Then, the BIOS or UEFI is going to load the primary boot loader

305
00:13:23,400 --> 00:13:27,030
from the Master Boot Record or the GUID Partition Table.

306
00:13:27,030 --> 00:13:29,100
It's going to do this into your memory.

307
00:13:29,100 --> 00:13:32,730
And then, it's going to load the partition table along with it.

308
00:13:32,730 --> 00:13:33,990
The user will then be prompted

309
00:13:33,990 --> 00:13:36,570
by the GRUB 2 boot loader or other boot loader

310
00:13:36,570 --> 00:13:39,660
to select the operating system that they want a boot from.

311
00:13:39,660 --> 00:13:41,400
If the user doesn't respond,

312
00:13:41,400 --> 00:13:44,413
then the default operating system is going to be booted up.

313
00:13:44,413 --> 00:13:47,280
Next, the boot loader determines the kernel

314
00:13:47,280 --> 00:13:50,040
and locates the corresponding kernel binary.

315
00:13:50,040 --> 00:13:53,220
It'll then upload the respective initial RAM disk image

316
00:13:53,220 --> 00:13:55,110
into memory and transfer control

317
00:13:55,110 --> 00:13:57,450
of the boot process to the kernel.

318
00:13:57,450 --> 00:13:58,680
Then, the kernel

319
00:13:58,680 --> 00:14:01,140
will configure the available hardware drivers,

320
00:14:01,140 --> 00:14:02,640
including your processors,

321
00:14:02,640 --> 00:14:05,310
input/output systems, and storage devices.

322
00:14:05,310 --> 00:14:07,800
It'll decompress the initial RAM disk image

323
00:14:07,800 --> 00:14:10,320
and mount it to load the necessary drivers.

324
00:14:10,320 --> 00:14:12,990
If the system implemented any virtual devices,

325
00:14:12,990 --> 00:14:15,870
such as the LVM or software RAID,

326
00:14:15,870 --> 00:14:18,120
those will also be initialized.

327
00:14:18,120 --> 00:14:20,580
The kernel will then mount the main root partition

328
00:14:20,580 --> 00:14:23,970
and release unused memory back into the system.

329
00:14:23,970 --> 00:14:25,710
To set up the user environment,

330
00:14:25,710 --> 00:14:28,320
the systemd program is going to run.

331
00:14:28,320 --> 00:14:32,010
It's going to become Process ID 1 on that system.

332
00:14:32,010 --> 00:14:35,280
Then, the systemd or the system Daemon program

333
00:14:35,280 --> 00:14:37,950
is going to search for the default.target file,

334
00:14:37,950 --> 00:14:38,940
which contains details

335
00:14:38,940 --> 00:14:41,400
about the services that need to be started.

336
00:14:41,400 --> 00:14:43,080
It'll then mount the file system

337
00:14:43,080 --> 00:14:46,500
based on the /etc/fstab file

338
00:14:46,500 --> 00:14:49,440
and begin the process of starting up at services.

339
00:14:49,440 --> 00:14:51,420
On most systems, the target either

340
00:14:51,420 --> 00:14:55,800
be a multiuser.target or graphical.target file.

341
00:14:55,800 --> 00:14:57,750
If the graphical mode was selected,

342
00:14:57,750 --> 00:15:00,990
then a display manager like XDM or KDM

343
00:15:00,990 --> 00:15:02,070
is going to be started up

344
00:15:02,070 --> 00:15:04,890
and the login window will be displayed on the screen.

345
00:15:04,890 --> 00:15:06,360
The user can then enter a username

346
00:15:06,360 --> 00:15:08,550
and password to log into the system.

347
00:15:08,550 --> 00:15:09,810
And then, the system

348
00:15:09,810 --> 00:15:13,050
will authenticate the user based on those credentials.

349
00:15:13,050 --> 00:15:14,550
If the user is valid,

350
00:15:14,550 --> 00:15:17,730
the various profile files are going to be executed.

351
00:15:17,730 --> 00:15:19,410
Finally, the shell has started

352
00:15:19,410 --> 00:15:22,288
and the system is ready for the user to begin their work.

353
00:15:22,288 --> 00:15:24,060
Now, everything I just said

354
00:15:24,060 --> 00:15:27,030
assumes that everything went right in the boot up process,

355
00:15:27,030 --> 00:15:29,310
but there's times things go wrong.

356
00:15:29,310 --> 00:15:31,170
And this is why we have a mechanism

357
00:15:31,170 --> 00:15:34,170
for the system to detect if there's been a fatal error,

358
00:15:34,170 --> 00:15:35,460
and it's going to respond to that

359
00:15:35,460 --> 00:15:37,860
by doing what's called a kernel panic.

360
00:15:37,860 --> 00:15:39,720
Now, a fatal error typically results

361
00:15:39,720 --> 00:15:43,290
in the system becoming unstable or totally unusable.

362
00:15:43,290 --> 00:15:45,660
There is software that handles these kernel panics

363
00:15:45,660 --> 00:15:47,970
and those display an error message to the user

364
00:15:47,970 --> 00:15:50,220
and dump the current state of the kernel memory

365
00:15:50,220 --> 00:15:53,070
to a storage device for later debugging as well.

366
00:15:53,070 --> 00:15:55,110
Depending on how your system is configured,

367
00:15:55,110 --> 00:15:56,610
the panic handler will either

368
00:15:56,610 --> 00:15:58,410
reboot the system automatically,

369
00:15:58,410 --> 00:16:00,180
or it'll shut itself down

370
00:16:00,180 --> 00:16:02,680
and wait for the user to turn on the system again.

