LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 03-20-2018, 03:34 PM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
Dual Boot with Windows 10 on UEFI System


Hi All,

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.

Thanks in advance for your help,
~ Bob
 
Old 03-20-2018, 05:08 PM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,375

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
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
 
1 members found this post helpful.
Old 03-20-2018, 06:44 PM   #3
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Thanks colorpurple21859,

I will keep that in mind moving forward. I still need to figure out how to add options to GRUB's boot menu. Have you had any luck in doing that?
 
Old 03-20-2018, 07:56 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,375

Rep: Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593Reputation: 1593
run this after editing your /etc/grub.d/40_custom:

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
 
Old 03-20-2018, 08:30 PM   #5
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Hi All,

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.

Thanks for your help!
~ Bob
 
Old 11-09-2018, 11:16 AM   #6
fometeo
LQ Newbie
 
Registered: Jul 2009
Location: Portugal
Distribution: CentOS, Ubuntu, SuSE
Posts: 3

Rep: Reputation: 0
example of a working dual boot system for a legacy Linux with GRUB v.1 at a PC with this partitions: (hd0 starts counting at 0)

Code:
sda1 Microsof recovery
sda2 ESP,BOOT partition
sda3 Microsoft reserved 16 MB
sda4 NTFS win. 10
sda5 swap
sda6 Linux
/boot/efi/EFI/redhat/grub.conf

Code:
device (hd0) HD(1,800,100000,314d5444-d170-4e02-95a4-b388331857bb)
default=0
timeout=120
splashimage=(hd0,7)/boot/grub/splash.xpm.gz

title Red Hat Enterprise Linux 6.6 (2.6.32-504.30.3)
root (hd0,7)
kernel /boot/vmlinuz-2.6.32-504.30.3.el6.x86_64 ro root=UUID=49b8182c-cc3c-47e4-a960-3e4d91ceb0c6 nomodeset rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16  KEYBOARDTYPE=pc KEYTABLE=pt-latin1 rd_NO_LVM rd_NO_DM rhgb quiet crashkernel=auto
initrd /boot/initramfs-2.6.32-504.30.3.el6.x86_64.img

title Windows 10 Professional EN - boot manager
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 49b8182c-cc3c-47e4-a960-3e4d91ceb0c6
else
  search --fs-uuid --set=root 49b8182c-cc3c-47e4-a960-3e4d91ceb0c6
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Dual boot without windows - Windows 10 UEFI dual boot with Metamorphose Panther(Debian/KDE) mithidieri Linux - Newbie 7 11-03-2017 12:10 AM
[SOLVED] elilo broken on Slackware 14.2 after Windows 10 update on dual boot UEFI system hyperhead Slackware 5 08-03-2016 01:45 PM
Dual boot for windows 8 and rhel6 workstation in UEFI system JATA01 Linux - Desktop 3 03-23-2015 01:41 PM
[SOLVED] Dual boot Windows 8 and ubuntu on UEFI system enrico_dvchp Ubuntu 3 02-18-2013 12:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration