DevOps From Scratch: Entry #03
TL;DR
The article details the Linux system startup process, covering BIOS/UEFI, bootloader (GRUB), kernel, and init/systemd. It emphasizes understanding these steps for troubleshooting and introduces the dmesg command for viewing kernel logs.
Key Takeaways
- •The Linux startup process involves sequential steps: BIOS/UEFI hardware check, bootloader (e.g., GRUB) loading the kernel, kernel initialization, and init/systemd starting services.
- •Understanding the startup sequence is crucial for diagnosing boot failures and system issues, moving beyond guesswork to log analysis.
- •The dmesg command displays kernel buffer messages, providing insights into hardware interactions and startup events, useful for debugging.
Tags
After installing Ubuntu on my laptop mainly for this linux learning journey, I left it there for about almost two weeks (not my fault! had to focus on some uni work). I am continuing my journey through the Linux Foundation course, for the DevOps from Scratch journey. Today I am looking at chapter 4. This chapter is about how a Linux system starts up. When I first started learning I just pressed the power button and waited. Now I want to understand the steps happening behind the screen.
Understanding the startup process is important. If a system fails to start you need to know which step went wrong to fix it. Here is what happens when you turn on a Linux machine.
The Startup Steps
The process follows a specific order. Each step prepares the system for the next one.
1. BIOS and UEFI
When you turn on the computer the first thing that runs is the BIOS or UEFI. This is small software stored on your motherboard. It checks your hardware like your RAM and keyboard to make sure everything is working. This check is called a POST.
2. The Bootloader
Once the hardware is ready the BIOS looks for a bootloader. In Linux the most common one is called GRUB. The job of the bootloader is to load the Linux Kernel into the memory of the computer. There is a funny story linked to the GRUB, this is why I love to document my entire learning process, because even before I continued with the learning process into chapter 4, I literally forgot the password to the laptop I installed the Linux on! I had to do a quick google search on how to reset your ubuntu passcode at the welcome screen, and it was actually a smooth processs really, All I had to do was to hard restart my machine thrice, and it did take me to the GRUB bootloader, so I really had a happy moment when I saw that in the online course :)
3. The Linux Kernel
The kernel is the heart of the operating system. It manages the hardware and the memory. It also starts the very first process on the system.
4. Init and Systemd
The kernel starts a process called init. On most modern Linux systems this is now called systemd. This is the mother of all processes. It has a process ID of 1. Its job is to start all the other services you need like your network or your desktop interface.
Kernel Space and User Space
The system is divided into two parts.
Kernel Space is where the kernel runs. It has full access to the hardware.
User Space is where your applications like a browser or a terminal run.
This division keeps the system safe. If an app in the user space crashes it should not take down the whole kernel.
A Useful Command
One way to see what happened during your startup is using the dmesg command.
dmesg | less
I will explain this command thoroughly.
dmesg stands for display message. It shows the messages from the kernel buffer. These are logs that tell you exactly what the kernel did while the system was starting.
The pipe symbol takes the output of the first command and sends it to the second command.
less is a tool that lets you scroll through a long list of text one page at a time.
Using this command is a great way to see how the kernel interacts with your hardware.
My Progress
Learning these basics helps me move away from just following tutorials. Instead of guessing why a system is slow or not starting I can now look at the logs and understand the steps.I am enjoying documenting this path as I learn how systems work under the hood.
And for my flash card buddies, I have updated Flashy, it has flash cards for this chapter of the course, in case you want to revise :)