CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to dual boot Windows 10 and CentOS 7 using GRUB2 with UEFI and GPT partitioning, but I haven't been able to update the boot menu options despite trying several ideas. Can you help? See the details below.
I started by enabling UEFI on boot. Once enabled, I used "parted" to set GPT partitioning on the drive. I installed CentOS 7, and then I installed Windows 10. At that point, I could select from the UEFI boot menu to boot into either Linux or Windows, but I want to have Windows presented as an option in the GRUB2 menu, and then boot directly into GRUB for easier access to my OS's.
To add an entry to the boot menu options, I tried updating /etc/grub.d/40_custom with the following
Code:
menuentry "Windows 10" {
set root=(hd0,gpt6)
chainloader +1
}
I then ran grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg. It lists a number of entries for different kernels, and when I inspect the file, I can see that my Windows 10 entry is there. Afterwords, I installed the grub2-efi-modules package for GRUB2 EFI installations. I ran "grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Centos --recheck --debug /dev/sda". It says the installation finishes without errors. When I restart and boot into GRUB though, I do not have menu entries, and I'm faced with just the grub2 prompt.
to chainload windows in uefi mode the grub entry for windows will be something similar to this if your esp partition is on the first harddrive first partition:
insmod part_gpt
insmod fat
set root='hd0,gpt1'
chainloader /EFI/microsoft/Boot/bootmgfw.efi
I finally solved the problem. I created the grub.cfg file in the wrong location. The proper location is /boot/grub2/grub.cfg. The rest of the steps above were correct. Simply moving the file to the correct location caused the grub menu to appear. Also, for those wondering, it is not necessary to run grub2-install after updating the configuration file. Simply update the file and changes will occur.
Coincidentally, I also had to repair my Windows 10 bootloader. Somehow, it was damaged during this process. For those facing a similar issue, see https://neosmart.net/wiki/fix-uefi-boot/ under the section "Fix UEFI Boot in Windows 8, 8.1 or 10". Once I added the Windows boot manager besides my Linux boot manager, I found that the OS prober picked up on my Windows installation, and I didn't even need to make a custom entry for Windows! In other words, all this trouble could have been avoided, but a I learned a lot.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.