LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   How to add windows 8.1 to linux boot menu. (https://www.linuxquestions.org/questions/centos-111/how-to-add-windows-8-1-to-linux-boot-menu-4175537521/)

vinay45 03-22-2015 09:31 AM

How to add windows 8.1 to linux boot menu.
 
Hi
Recently installed centos on my system.

Already had windows installed but after installing centos the grub boot menu doesn't show the windows8 which is on the same HDD.now i have used the paragon rescue tool to boot to windows How do i add windows to the grub bootmenu?

Head_on_a_Stick 03-22-2015 09:42 AM

Add this to the end of the file at /etc/grub.d/40_custom:
Code:

menuentry "Windows" {
        insmod chain
        insmod ntfs
        set root=(hd0,1)
        chainloader +1
}

You will have to change the "(hd0,1)" bit to reflect your installation -- GRUB2 counts drives from "0" and partitions from "1" so a Windows main partition on (for example) /dev/sda3 would need "(hd0,3)" in that section.

Then run:
Code:

# grub-mkconfig -o /boot/grub/grub.cfg

vinay45 03-22-2015 11:03 AM

i opened /etc/grub.d/40_custom: in vi editor but it doesn't show any content only this ~
~
~in blue along the left side is it okay to add the entry at the top as no content is seen.
how do i navigate the file in vi editor? or should i use any other editor?

Head_on_a_Stick 03-22-2015 11:25 AM

Quote:

Originally Posted by vinay45 (Post 5335974)
i opened /etc/grub.d/40_custom: in vi editor but it doesn't show any content only this ~
~
~in blue along the left side is it okay to add the entry at the top as no content is seen.
how do i navigate the file in vi editor? or should i use any other editor?

Did the file exist before you tried to open it in vi?

I've never used CentOS so I'm not sure how their GRUB implementation is structured.

My /etc/grub.d/40_custom looks like this:
Code:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

You could just add the stanza directly into /boot/grub/grub.cfg under your other menu entries (before the final "}") and it should work but it will get over-written the next time your GRUB menu is updated (ie, after the next kernel upgrade).

I think you might be better waiting for advice from someone who has actually used CentOS (sorry).

If you decide to add the menu entry you would be better using nano (or an editor you are familiar with) if you don't know how to use vi or vim.

pan64 03-22-2015 11:45 AM

you can use any editor, for example nano too (or mc as midnight commander and its editor, mcedit). (and obviously you can easily install them if they were not available.

vinay45 03-22-2015 11:50 AM

would the content if /etc/grub.d/40_custom: be empty?
i am not sure if the file existed or was created when i ran the command
Code:

vi /etc/grub.d/40_custom:
please clarify as i already added the entry :
Quote:

menuentry "Windows" {
insmod chain
insmod ntfs
set root=(hd0,1)
chainloader +1
}
using vi
i haven't run :
Quote:

# grub-mkconfig -o /boot/grub/grub.cfg
yet

Head_on_a_Stick 03-22-2015 12:11 PM

Quote:

Originally Posted by vinay45 (Post 5335992)
would the content if /etc/grub.d/40_custom: be empty?
i am not sure if the file existed or was created when i ran the command
Code:

vi /etc/grub.d/40_custom:

I'm sorry my post wasn't clear enough :(

The file you must add the entry to is:

/etc/grub.d/40_custom

...with no ":" at the end.

vinay45 03-22-2015 12:14 PM

okay i will try it

vinay45 03-22-2015 12:40 PM

i added the entry to
Code:

/etc/grub.d/40_custom
but this command
Quote:

# grub-mkconfig -o /boot/grub/grub.cfg
doesn't work
but the entry doesn't show on boot menu.
what shall i do next

Head_on_a_Stick 03-22-2015 12:45 PM

Did you run the `grub-mkconfig` command as root (or put `sudo` before it)?

Post any terminal output after the command is run.

Try this instead (as root):
Code:

# update-grub
As I say I have never used CentOS so I may be mis-informing you here.

vinay45 03-23-2015 05:14 AM

i ran it as root,the output was :
Code:

bash:grub-mkconfig:command not found
the update-grub too didn't work :
Code:

bash:update-grub:command not found

colorpurple21859 03-23-2015 05:34 AM

If you have a /boot/efi/EFI/<some centos directory with a grub.cfg file> add the windows entry at some point near the end of this file. If you have a /boot/grub/menu.lst file or one in the efi directory let us know for the windows entry will be a different.

vinay45 03-23-2015 07:13 AM

There doesn't seem to be a director
Quote:

/boot/efi/
not even the menu.lst file.
i ran the os prober
Quote:

/etc/grub.d/30_os-prober
but it didn't help.
it gave four lines of output each line had some thing like "I/O error" in the middle may be it doesn't work because there is no unallocated space on my hdd.i couldn't copy that output as there is no GUI i am doing it in command line.
I have added the menuentry to the grub2.cfg file and it works fine though not sure if its the right way to do it.now i am able to select windows from the grub2 boot menu.

johnsfine 03-23-2015 07:32 AM

Have you installed ntfs-3g yet?
I'm not sure that is sufficient to get a subsequent run of grub-mkconfig to work correctly for Windows 8.1 (as it was for earlier Windows versions). But I would expect it to be sufficient and also I would expect anyone with a dual boot Centos/Windows system to need ntfs-3g anyway (even if you got dual boot to work right without ntfs-3g).

See post #4 in this thread
http://www.linuxquestions.org/questi...5/#post5304406

and/or see post #29 in this thread
http://www.linuxquestions.org/questi...2/#post5284444

You can get all this to work by editing the config files for grub. But the exact edits are both harder than many of those suggesting that approach imply and more specific to details of your system that we don't know well enough for advising you. A better approach is installing the relevant package (ntfs-3g) that is supposed to enable grub-mkconfig to do its job automatically (without such edits).

colorpurple21859 03-23-2015 07:51 AM

Quote:

I have added the menuentry to the grub2.cfg
That will work until your first software update that updates your grub menu, then your edit of grub.cfg will be over written. Need to figure out why os-prober isn't working.


All times are GMT -5. The time now is 10:34 PM.