1, power
Haha, the most simple question you, Xiao Bian put a computer there are times at night, the next day the computer can not be switched, So now, finally think of it, the dormitory at night blackout, the computer is dead.
2, BIOS initialization
Effect: the hardware detection, initialization of the hardware clock;
Error: the hardware itself has destroyed, such as: broken head, burned motherboard;
Restoration: replacement of hardware facilities.
3, disk boot
Effect: to guide the boot process, wherein the master boot record mbr (tracks 0, 1 omitted, 446 bytes) for recording the position of the boot file grub2; mbr when data is lost, the system will not find the boot partition is stopped due to run;
Simulated error: dd IF = / dev / ZERO of = / dev / nvme0n1 BS = 446 COUNT =. 1 (/ dev / ZERO:. Unlimited provide a null character (0x00, ASCII codes NUL) used to generate a specific size of the file ; / dev / nvme0n1: mbr data storage disk; bs: block size; count: the number of blocks)
Recovery manner: (1) to save the CD-ROM into the environment (in the start mode for the interface modification bios CD; start trouble mode selection screen;
(2) Input: chroot / mnt / sysimage;
(3) Input grub2-install / dev / ****** (disk mounted position: fdisk can view, '*' is the identification of the mounted disk mbr); an input exit, exit Release installation mode, you can be restored.
4, grub2 file guide
作用:指定/boot位置;指定系统启动时加载文件位置
rhel7 | rhel8 | |
位置 | /boot/grub2/grub.cfg | /boot/grub2/grub.cfg /boot/loader/entries/*****.config |
模拟问题 | rm -fr /boot/grub2/grub.cfg | rm -fr /boot/loadr/entries/*****.config |
自动修复(进入挽救模式) | grub2-mkconfig > /boot/grub2/grub.cfg | kernel-install add $(uname -r) /ib/modules/$(uname -r)/vmlinuz |
手动修复 | 手动引导: set root='hd0,msdos1' linux16 /vmlinuz-3.20.***x86 ro root=/dev/nvme0n1p1(跟分区) initrd16 /initramfs-********.img 重启服务: boot |
【注】$(uname -r):自动查询主机的内核版本型号
【注】这里进行手动引导后,若不处理,重启后任然需要进行手动引导,故为彻底解决问题,我们应重新装载内核信息。
5、内核加载
目录:/boot/vmlinuz-$(uname -r)
作用:系统初始化硬件设备;只读挂在/设备
模拟错误:rm -fr /boot/vmlinuz-$(uname -r)
恢复方式:重装内核
(1)进入挽救模式:chroot /mnt/sysimsge
(2)挂载磁盘:mount /dev/cdrom /mnt
(3)安装内核:
安装包 | |
rhel7 | cd /mnt/BaseOS/Packages rpm -ivh kernel-xxxxx.rpm --force |
rhel8 | cd /mnt/BaseOS/Packages rpm -ivh kernel-core-xxxxx.rpm --force |
6、系统初始化镜像
目录:/boot/initramfs-4.18.0-80.el8.x86_64.im
作用:加载系统时钟;加载selinux;加载系统主机信息;加载/etc/fstab文件中磁盘挂在策略;加载磁盘配额;初始化系统程序开;启开机启动服务(/etc/systemd/system);开启虚拟控制台;开启图形;
模拟错误:rm -fr /boot/initramfs-xxxxx.img;
恢复方式:在恢复环境中:mkinitrd /boot/initramfs-$(uname -r).img $(uname -r);
7、系统启动级别
级别 | 含义 |
0 | 关机 |
1 | 单用户模式 |
2 | 无图形网络模式 |
3 | 无图形网络模式 |
4 | 无图网络形模式 |
5 | 有图形网络模式 |
6 | 重启 |
模拟错误:systemctl set-default reboot.target
恢复方式:(1)在开机启动界面<e>,进入引导文件编辑模式;
(2)在内核加载选项加入启动级别5,<ctrl>+<x>运行;
(3)systemctl set-default graphical.target
此时虽然已经启动成功,但是问题并未解决,当再次启动时,依然会不断启动。
8、修改超级用户密码
(1)在开机选项界面<e>,进入信道文件编辑模式;
(2)删除内核加载选项ro后面的内容;
(3)将ro(只读权限)修改为rw (读写权限);
(4)加入rd.break参数种植系统启动进入单用户模式;
(5)<ctrl>+<x>启动;
(6)进入shell环境:chroot /sysroot;
(7)修改超级用户密码:echo lee | passwd --stdin root;
(8)重新加载selinux标签:touch /.autorelabel。
上述为Linux下系统中开机时系统错误的处理,若有问题,欢迎大家指出;因实验有时结果会覆盖上一条命令的操作,若上述内容还有所不懂,欢迎留言,会在第一时间给尽自己所能,给大家解决。愿上述内容有所用!