Case Analysis of centos7 switching Boot Kernel and switching Boot Mode
This article mainly explains "centos7 switching startup kernel and switching startup mode example analysis". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian slowly and deeply to study and learn "centos7 switching startup kernel and switching startup mode example analysis" together!
centos7 switch boot kernel
Note: It is recommended that if necessary, you can first execute yum update -y to upgrade all packages.
Notes:
1. The centos I used for testing is version 7.2, with minimal installation by default, and the system kernel is 3.10.0-327.
After upgrading to 4.4.x, if you use the yum update -y command to upgrade the software, you will continue to install the 3.10.0-693 kernel package in centos 7.4, and it will be the first startup item.
3. After each yum update -y, you need to use the grub2-set-default 0 command to modify the default kernel startup item. The first item is 0, the second item is 1, and so on. Check gru.
1. View the current system kernel
uname -r
3.18.6-2.el7.centos.x86_64
View a list of available kernels
awk -f\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
The results were as follows:
0 : centos linux (3.18.6-2.el7.centos.x86_64) 7 (core)
1 : centos linux (3.10.0-514.el7.x86_64) 7 (core)
2 : centos linux (0-rescue-05653d304ed443db9b60529d6cf7d242) 7 (core)
2. View current default kernel startup items
grub2-editenv list
The results were as follows:
saved_entry=0
That is, the kernel loaded by default when the system is currently booted is centos linux (3.18.6-2.el7.centos.x86_64) 7 (core)
3. Change the default boot kernel entry
grub2-set-default 1
Looking at the default kernel boot entry again, the saved_entry field changes to 1
4. Restart the system
reboot
View current system kernel
uname -r
3.10.0-514.el7.x86_64
You can see that the kernel of the current system has changed
centos7 switch startup mode
Centos has only two startup modes:
multi-user.target: analogous to runlevel 3 #Command line mode graphical.target: analogous to runlevel 5 #Graphics mode
Check the vim /etc/inittab file for commands to change the mode
Second, check the current mode:
systemctl get-default
Third, change the starting mode
Start by command:
systemctl set-default multi-user.target
Start graphically:
systemctl set-default graphical.target Thank you for reading, the above is the content of "centos7 switching boot kernel and switching boot mode example analysis", after learning this article, I believe that everyone has a deeper understanding of centos7 switching boot kernel and switching boot mode example analysis, and the specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!