I want to know how LINUX works!

PC20171027neko_TP_V.jpg

I'm sure there are people who want to know or need to know about LINUX in LPIC exams and in actual work. However, when I look it up, some people may say, "I tried to look up commands and words, but in the end it's complicated and I don't understand?" (I became). This is an article for those who want to know how LINUX works easily!

In order to know how LINUX works, it is effective to deepen your understanding of the startup process of LINUX. The reason is that the system involved in the boot process is the system that runs LINUX, and running LINUX is all about LINUX. For example, by turning the car key to know how the car works and knowing how the engine is started, you can deepen your understanding of how the car works. By knowing about the LINUX engine, you will know what LINUX can do!

Positioning of LINUX

First, let's talk about the position of LINUX among many OSs. LINUX is a type of OS called UNIX-based OS. The version of LINUX is branched in the form called a distributor, but this LINUX kernel (the source of the OS) was widely released as open source, and the OS was developed by various people. .. As a result, various branches have been created, such as Debian, Ubuntu, and fashion. (This system Roughly divided, it is divided into a free version and a paid version, CentOS is famous for no charge, and Red Hat is famous for paid version)

Linux boot process

The following table shows the flow of the Linux startup process from turning on the power button to being able to enter commands.

1.Power on
2.Firmware boot
3.Firmware loads the bootloader
4.Bootloader kernel and filesystem image(initramfs)Read
5.Bootloader runs kernel
6.Kernel is a file system image(initramfs)Run
7.Kernel init(Or systemd)Launch and mount the root file system
8.Kernel init(Or systemd)Run

1. Power on

When you turn on the power, the firmware engraved on the terminal will start up. Well-known firmware has BIOS (Boot Input / Output System) and UEFI (Unified Extendable Farmware Interface), and the type of boot loader handled by each firmware changes.

2. Start the boot loader

The firmware first loads the bootloader stored at the top of the hard disk and begins preparing to launch LINUX. At this time, if it is BIOS, an image file is generated and expanded, and if it is UEFI, the stored EFI file is read and started. What is started at this time is called GRUB2 (GRand Unified Bootloader). (It is attached with 2 because it is the second generation)

3. Booting the kernel and root file system

The bootloader loads the LINUX kernel (vmlinuz) and filesystem image (initramfs). vmlinuz is a strange name, but it seems that the initial name is VM of Virtual Machine, and the end is z is a compressed file, so x of linux is changed to z. After running the kernel and deploying the filesystem image from the bootloader, we assume that the root filesystem is ready for use. The kernel launches the user process.

4. Start user process

After all the preparations, the kernel finally calls its own process (inti or systemd). At this time, start Linux in the boot mode that matches the runlevel or Target. After booting, control is returned to the user again and Linux can be operated.

Explanation of detailed words

Firmware: A system that boots Linux from the hardware side Bootloader: The one that wakes up Linux Kernel: Linux seed initramfs: Top of file system, top of file system User process: Init or systemd, user operation itself Runlevel: GUI, CGI or emergency mode is divided by level

Related files

Boot loader and kernel settings related to Linux booting are located in specific locations.

◇ Bootloader (GRUB2: GRandUnifiedBootloader2)

Body file In case of BIOS (Basic input / output system), boot.img and core.img (* not image file)

Difference between Init and Systemd

For details, refer to this site, but roughly speaking, systemd is an upward compatible system that has grown init. It's more convenient and more responsible! In terms of specific functions, processes that were managed separately in the init era will now be managed on a unit-by-unit basis. By managing this process on a unit-by-unit basis, each service can be operated stably. (Easy to start and stop)

reference

I wrote it with reference to the following books. If you want to see it in detail with Plus Alpha, you can pick it up and use it like a dictionary ☺

-[Linux Textbook LPIC Level 1 Speed Master Problem Collection Version 5.0 Compatible](https://www.amazon.co.jp/gp/product/B07TVTKW2C/ref=as_li_tl?ie=UTF8&camp=247&creative=1211&creativeASIN=B07TVTKW2C&linkCode=as2&tag = vk4268370f-22 & linkId = 8965e118505185053b84e77611a602dc)

Recommended Posts

I want to know how LINUX works!
I want to use Linux on mac
I want to log file I / O on Linux
less command I want to definitely remember this [linux command]
I want to solve Sudoku (Sudoku)
I tried to reintroduce Linux
I want to use OpenJDK 11 on Ubuntu Linux 18.04 LTS / 18.10
I didn't know how to use the [python] for statement
I want to know the features of Python and pip
I want to know the legend of the IT technology world
I want to understand systemd roughly
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
How to install MBDyn (Linux Ubuntu)
Key operations you want to know
I want to scrape images to learn
I want to do ○○ with Pandas
How to check Linux OS version
I want to copy yolo annotations
I want to debug with Python
I want to know the weather with LINE bot feat.Heroku + Python
I want to use shortcut translation like DeepL app on Linux
I want to know if you install Python on Mac ・ Iroha
I don't know how to get query parameters on GAE / P
I want to know the population of each country in the world.
[For black screen phobia] I want to know about Linux and shells, so I illustrated it loosely.
How to check and change Linux permissions (permissions) (chmod) (I want to be saved from Permiss on denied)
I want to pin Spyder to the taskbar
I want to detect objects with OpenCV
[Linux] How to subdivide files and folders
I want to output to the console coolly
How to install aws-session-manager-plugin on Manajro Linux
I want to print in a comprehension
I want to scrape them all together.
I want to handle the rhyme part1
I want to blog with Jupyter Notebook
I want to handle the rhyme part3
I want to use jar from python
[Linux] How to use the echo command
I want to build a Python environment
I want to pip install with PythonAnywhere
How to use the Linux grep command
How to update php on Amazon linux 2
I want to analyze logs with Python
How to display emoji on Manjaro Linux
I want to play with aws with python
How to install packages on Alpine Linux
How to install Anisble on Amazon Linux 2
How to operate Linux from the console
I want to use IPython Qt Console
How to install Windows Subsystem For Linux
How to power off Linux with Ultra96-V2
How to update security on CentOS Linux 8
I want to display the progress bar
I want to make an automation program!
How to install php7.4 on Linux (Ubuntu)
I want to embed Matplotlib in PySimpleGUI
How to find large files on Linux
How to get started with laravel (Linux)
I want to handle the rhyme part2
I want to develop Android apps on Android