Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to switch between boot kernel and boot mode in centos7

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how centos7 switch boot kernel and switch boot mode, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Centos7 switch Boot Kernel

Note: it is recommended that if necessary, you can first execute yum update-y to upgrade all software packages

Note:

1. The CentOS I used for testing is version 7.2. the installation is minimized by default, and the system kernel is 3.10.0-327.

2. After upgrading to 4.4.x, if you randomly use the yum update-y command to upgrade the software, you will continue to install the 3.10.0-693kernel package in CentOS7.4 as 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 entry. 0 bit is the first item, 1 is the second item, and so on. Check the 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 etc/grub2.cfg = "menuentry" {print iTunes + ":" $2}'/ etc/grub2.cfg

The results are 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 the current default kernel startup items

Grub2-editenv list

The results are as follows:

Saved_entry=0

That is, the default kernel loaded when the system starts is CentOS Linux (3.18.6-2.el7.centos.x86_64) 7 (Core).

3. Change the default startup kernel entry

Grub2-set-default 1

Look at the default kernel startup item again and find that the saved_entry field has changed to 1

4. Restart the system

Reboot

View the 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 toggles startup mode

First, there are only two startup modes for centos:

Multi-user.target: analogous to runlevel 3 # command line mode graphical.target: analogous to runlevel 5 # graphics mode

Check the vim / etc/inittab file. There are commands to change the mode.

Second, view the current mode:

Systemctl get-default

Third, change the startup mode

Start as a command:

Systemctl set-default multi-user.target

Start graphically:

Systemctl set-default graphical.target above is all the contents of the article "how to switch between boot kernel and boot mode in centos7". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report