From the course: Exploring Linux Internals: Advanced Insights and Practical Applications
The boot procedure from firmware to shell - Linux Tutorial
From the course: Exploring Linux Internals: Advanced Insights and Practical Applications
The boot procedure from firmware to shell
- So in this video, I want to give you an overview of the boot procedure. At the same time, I'm going to draw in how you can interrupt the boot procedure for troubleshooting. So if you switch on your computer, first thing that happens is the firmware. And when I say firmware, I'm talking BIOS or UEFI. You'll learn more about it in the next lesson. So from the firmware, a bootable disk is found. Now on the disk, it's starting to be interesting because your disk can use MBR. It can also be using GPT. GPT is the Grid Partition Table. This is a newer way of booting. MBR is the 1981 standard. The old way of booting. So what do we need to do once we are on MBR or GPT? Well, we need to find the boot loader and that will be GRUB. And how are we going to find GRUB? Well, from MBR, it's easy. MBR is accessing GRUB from the boot sector. In GPT, there's a step in between and that is the boot partition. So on this boot partition, GPT will find GRUB and then the GRUB boot loader is here. And that's the part where it all starts for the Linux operating system. So once you are in the GRUB boot loader, and let me use a different color to indicate that Linux is now playing its role, we have the kernel that is going to be loaded. The kernel comes together with the initramfs. And the initramfs contains all the drivers that are needed for your operating system. And the next thing that is happening is the init process. Now init, normally on normal recent systems is systemd. So systemd is loaded. And systemd from that moment is taking over. So let's make a difference between what I'm calling early boot, where early boot is taking care of all the essential stuff, essential stuff that you are going to need to have a functional computer. Next, your services are loaded also by systemd. And in the end, systemd is starting a shell. And the shell can be a bash shell or it can be a GDM. Now that you have an overview of what is happening in the boot procedure, it's also interesting to know what you can do for troubleshooting. So if anything goes wrong before GRUB is showing, you need a rescue disk. No doubt about it because without GRUB, you don't get to your kernel and well, you need something external to boot. So once have access to the GRUB boot menu, you can step in into the different phases of the boot procedure. For instance, you can break in at the end of the loading of the initramfs. That's a Red Hat-only option as far as I know. You pass the rd.brake option. And rd.brake is stopping the boot procedure at the end of the loading of your initramfs. You already see your disk because all the drivers are here and you can do very early troubleshooting. A little bit later, you can step in before systemd is loaded. It's really the next step. And there, you are using init=/bin/bash. That means that you are going to bypass the loading of systemd, and that is good for any troubleshooting that happens later on when systemd is already there. Next, you can also step in before the early boot is starting. So that will be by using systemd.unit is emergency.target. The emergency.target makes sure that only the bare minimum is available and everything else that makes part of your operating system is not loaded yet. And the last step where you can get in is by using systemd.unit is rescue.target. So in rescue.target, you already have a fully functional system just passed by the early boot, you just don't have your services yet. So that is all that is happening in the boot procedure of Linux. In the next couple of videos, we are going to investigate these steps a little bit closer.
Contents
-
-
-
-
(Locked)
Learning objectives51s
-
The boot procedure from firmware to shell4m 51s
-
(Locked)
System firmware: UEFI and BIOS1m 34s
-
(Locked)
Managing UEFI booting6m 55s
-
(Locked)
Bootloaders5m 34s
-
(Locked)
Where GRUB is stored2m 48s
-
Configuring GRUB28m 17s
-
(Locked)
Understanding and modifying initramfs3m 40s
-
(Locked)
Service managers1m 9s
-
(Locked)
Booting cloud Linux instances50s
-
(Locked)
Accessing an early boot shell5m 47s
-
(Locked)
Real-world scenario: Recovering from a lost MBR7m 33s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-