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 add GRUB2 Startup items to Centos7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

GRUB2 is the default boot loader for Centos7. It can easily load all Linux distributions and other operating systems. It provides a menu showing all operating systems. GRUB2 has advanced features as well as some basic features that make it valid on all Linux. How to add Windows 10 Startup items to GRUB2

Install the dual system, the first system is installed with Windows 10, and then install Centos7. After installing Centos7, it is found that there is no startup entry for Windows 10, so you need to manually add the startup entry for windows 10.

# Open the 40_custom file and add the following content [root@localhost ~] # vim / etc/grub.d/40_custommenuentry 'Windows 10' {insmod ntfs set root='hd0,1' chainloader + 1} # after the modification is completed, you need to export the generated configuration file to take effect. [root@localhost] # grub2-mkconfig-o / boot/grub2/grub.cfg

Restart the computer and check to see if there are Windows 10 startup items

How to change the default startup items list all startup items [root@localhost ~] # grep'^ menuentry' / boot/grub2/grub.cfg | cut-d "'"-f 2CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core) CentOS Linux (0-rescue-2fbe0839e3b3416b960e84dab68c8bb3) 7 (Core) Windows 10

Modify Windows10 as the default startup item [root@localhost ~] # grub2-set-default "Windows10" to check whether the setting is successful [root@localhost ~] # grub2-editenv listsaved_entry=Windows 10

Save changes [root@localhost ~] # grub2-mkconfig-o / boot/grub2/grub.cfg Generating grub configuration file... Found linux image: / boot/vmlinuz-3.10.0-1062.el7.x86_64Found initrd image: / boot/initramfs-3.10.0-1062.el7.x86_64.imgFound linux image: / boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3Found initrd image: / boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.imgdone

How to change the timeout of the grub2 menu

Open the / etc/default/grub file and modify the value of the GRUB_TIMEOUT variable, which is the number of seconds.

[root@localhost ~] # vim / etc/default/grubGRUB_TIMEOUT=5GRUB_DISTRIBUTOR= "$(sed's, release. * $, g' / etc/system-release)" GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT= "gfxterm" GRUB_BACKGROUND=/boot/grub2/background.jpgGRUB_GFXMODE=1440x900,1024x768640x480GRUB_CMDLINE_LINUX= "crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet" GRUB_DISABLE_RECOVERY= "true"

Save the build configuration file

[root@localhost] # grub2-mkconfig-o / boot/grub2/grub.cfgGenerating grub configuration file... Found linux image: / boot/vmlinuz-3.10.0-1062.el7.x86_64Found initrd image: / boot/initramfs-3.10.0-1062.el7.x86_64.imgFound linux image: / boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3Found initrd image: / boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.imgdone

Summary

In this article, you learned how to add grub boot records, modify timeouts, and modify default startup items. If you like this article, you can like it.

Original address of this article: https://www.linuxprobe.com/centos7-grub2-boot-option.html

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