Linux Introduction-8 Linux system boot details

Source: Internet
Author: User
Tags dmesg

    • System startup process
    • Bios
    • Mbr
    • Grub
    • KERNEL
    • Init
    • Single-User change root password
    • GRUB Encryption
System startup process
    • Bios
    • Mbr:boot Code
    • Execute Bootstrapper-GRUB
    • Load kernel
    • Execute init
    • RunLevel
Bios
    • Basic Input Output System, typically stored in the motherboard's BIOS chip
    • Run the BIOS first when the computer starts, check the hardware and look for bootable devices
    • Bootable devices are defined in BIOS settings, such as USB, CDROM, HD
Mbr

Different systems have different MBR

    • Boot code is executed after the BIOS has found a bootable device
    • The boot code is the first 446 bytes of the MBR
Grub

MBR generally acts as a jump, starting a more complex boot program, such as Grub

    • Grub is now the mainstream boot program for Linux use
    • Can be used to boot almost all of the operating systems now, PE is also grub boot
    • Grub related files are saved in the /boot/grub directory
      Stage1 (MBR), xxx_stage1_5 (file system driver), Stage2
    • The Grub configuration file is/boot/grub/grub.conf
    • Configuration format:
default=0 # 第一个引导程序timeout=5 # 停留时间splashimage=(hd0,1)/boot/grub/splash.xpm.gz # 引导界面背景hiddenmenu # 默认隐藏菜单title CentOS # 操作系统名称    root (hd0,1) # 操作系统所在分区,第一块硬盘第二个分区    # 内核以及传递给内核的参数(ro root=...),用空格分开    kernel /boot/vmlinuz-2.6.32-431.el6.x86_64 ro root=...    # initial ram file system,内核模块打包文件    initrd /boot/initramfs-2.6.32-431.el6.x86_64.img
KERNEL
    • The MBR boot code will be responsible for locating and loading the Linux kernel
    • The Linux kernel is saved in/boot/vmlinuz-2.6.32-431.el6.x86_64
    • Kernel module Packaging files are also typically loaded:/boot/initramfs-2.6.32-431.el6.x86_64.img
    • Linux to keep the kernel of the simplification of some of the less common drivers, functions compiled into a module, when needed to dynamically load, and these modules are packaged to save as a Initramfs file
    • Earlier versions of Linux use the Initrd file, Initramfs is a initrd alternative optimized version, more space-saving and more flexible than INITRD
    • Command dmesg or /var/log/dmesg file to view the output information of the kernel at the start of this boot
Init
    • Init ( /sbin/init ) is the first process running in a Linux system, the parent process of all processes.
    • The call /etc/rc.d/rc.sysinit is responsible for initializing the system, mounting the file system, and starting the corresponding service based on the RunLevel
    • Linux RunLevel (runlevel):
      • - 0Shutdown
      • - 1Single-User mode
      • - 2Multi-user mode with no network
      • - 3Multi-user mode
      • - 4Not used
      • - 5X11 Graphical mode
      • - 6Restart
    • /etc/inittabThe default runlevel can be modified through the configuration file
    • etc/init/The files under are other configuration information
    • Each level corresponding to the startup service is saved in the /etc/rc.d/rc[0-6].d/
    • runlevelcan display current and previous RunLevel
    • initAvailable to change the current run level
Single-User change root password
    • Pass parameters to the kernel 1 or single enter single-user mode
    • No services are started in single-user mode
    • Single-user mode log in directly with the root user and require a password
    • You can use passwd to modify the root password
GRUB Encryption
    • By adding the following parameters to the boot configuration in grub.conf
      password --md5 $1$aoWpTe$/MWUUYbBIF.2RUZK8nbWU0
    • The encrypted password can be generated by the grub-md5-crypt

Alternatively, you can refer to Nanyi's blog:

    1. How the computer is started
    2. Linux Start-up process

Linux Introduction-8 Linux system boot details

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.