LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-22-2015, 09:31 AM   #1
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Rep: Reputation: Disabled
Post 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?
 
Old 03-22-2015, 09:42 AM   #2
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
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
 
1 members found this post helpful.
Old 03-22-2015, 11:03 AM   #3
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
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?
 
Old 03-22-2015, 11:25 AM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by vinay45 View Post
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.
 
1 members found this post helpful.
Old 03-22-2015, 11:45 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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.
 
1 members found this post helpful.
Old 03-22-2015, 11:50 AM   #6
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-22-2015, 12:11 PM   #7
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by vinay45 View Post
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.

Last edited by Head_on_a_Stick; 03-22-2015 at 12:12 PM. Reason: de-crufting the quote
 
Old 03-22-2015, 12:14 PM   #8
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
okay i will try it

Last edited by vinay45; 03-22-2015 at 12:15 PM.
 
Old 03-22-2015, 12:40 PM   #9
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-22-2015, 12:45 PM   #10
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
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.
 
Old 03-23-2015, 05:14 AM   #11
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-23-2015, 05:34 AM   #12
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
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.

Last edited by colorpurple21859; 03-23-2015 at 05:36 AM.
 
Old 03-23-2015, 07:13 AM   #13
vinay45
Member
 
Registered: Mar 2015
Location: india
Distribution: ubuntu
Posts: 48

Original Poster
Rep: Reputation: Disabled
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.

Last edited by vinay45; 03-23-2015 at 07:20 AM.
 
Old 03-23-2015, 07:32 AM   #14
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
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).

Last edited by johnsfine; 03-23-2015 at 07:39 AM.
 
1 members found this post helpful.
Old 03-23-2015, 07:51 AM   #15
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
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.
 
  


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
LXer: How to add an entry for a Linux distribution in Windows’ boot menu LXer Syndicated Linux News 0 07-21-2012 08:32 PM
[SOLVED] Dual Boot 2 seperate Drives - Add option to Boot Menu? janap-146 Ubuntu 11 12-13-2009 08:28 AM
How can I see Linux on Windows boot menu? Mediterranean1024 Linux - General 3 05-08-2006 02:08 PM
GRUB - How to add Windows to boot menu? geekgyrrrl Linux - Newbie 4 06-04-2005 10:02 PM
try to boot windows, and the linux menu comes up Jon512 Linux - General 6 09-03-2003 08:28 PM

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

All times are GMT -5. The time now is 12:29 PM.

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