Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> GRUB 2 does not add Windows to menu during install, GRUB 0.97 (legacy) did automatically
+X^N
 Posted: Sep 6 2014, 05:12 PM
Quote Post


SLF Member
***

Group: Members
Posts: 130
Member No.: 2581
Joined: 27-June 13









'Testing' RHEL 7 & SL 7 , which uses the new GrandUnifiedBootLoader2 ,
showed the issue of existing Windows on your hard drive
not being added to the GRUB boot menu automatically ;
However , the legacy GRUB did this.
"One step forward , two steps back."
.
I have read some of the documantation , and it is a bit 'dry' for me ;
"GNU GRUB Manual 2.00 # 4.1.2 Chain-loading an OS" http://www.gnu.org/software/grub/manual/grub.html#Chain_002dloading
&
"GNU GRUB Manual 2.00 # 5.3 Multi-boot manual config" http://www.gnu.org/software/grub/manual/grub.html#Multi_002dboot-manual-config
says "Currently autogenerating config files for multi-boot environments depends on os-prober and has several shortcomings.
While fixing it is scheduled for the next release
, meanwhile you can make use of the power of GRUB syntax and do it yourself."
Documentation mentions os-prober , however , on the CentOS forums , they ignore that method (see below).
A good tutorial : http://www.dedoimedo.com/computers/grub-2.html
Additionally , at Fedora Project "Adding Other operating systems to the GRUB 2 menu " portion of their GRUB 2 documentation :
https://fedoraproject.org/wiki/GRUB_2?rd=Grub2#Adding_Other_operating_systems_to_the_GRUB_2_menu
? What is the best way to add a Windows entry to the boot menu ?
..
I have learned (correct me , if wrong):
It seems like we cannot directly edit the menu file located
/boot/grub2/grub.cfg
And the /etc/grub2.cfg is only a symlink to the above file.
* editable files {sh ell scripts} are located :
/etc/grub.d/
README
00_header
10_linux
20_linux_xen
20_ppc_terminfo
30_os-prober
40_custom
41_custom
* can add a new file (say 13_wind-xp)
CODE
#! /bin/sh -e
echo “Adding M$ Wind” >&2
cat << EOF
menuentry “Wind XP″ {
set root=(hd0,2)
chainloader (hd0,2)+1
}
EOF

As usual the "Wind" can be anything ;
the hd0 is the first HDD , numbered starting at 0
however , the partition ,2 is numbered strting at 1 !
There seems to be a new syntax also for the partion : msdos2.
...
I am no guru -- please verify.
...
& after adding the above file , need to have GRUB generate the grub2.cfg file with
(you guessed it) a command in a terminal window :
"Re: Anaconda did not cofigure grub 2 correctly" (by paulrooney » 2014/07/24)
https://www.centos.org/forums/viewtopic.php?f=47&t=47376#p201619
says :
CODE
>$ sudo grub2-mkconfig -o /etc/grub2.cfg

& doublecheck that it added to the grub2.cfg ,
>$ sudo cat /etc/grub2.cfg
then reboot
>$sudo reboot.
.
I will try this -2-step later this weekend.

--------------------
DELL Precision 470 Workstation Xeon 3.2GHz (x2) , 2GB ECC ram ;
DELL UltraSharp 2007WFPb (L) ips monitor
Dual boot :1st installed: WinXPPro & then SL6.4 x86_64 - via 2 'everything' DVD s { GRUB going into the SL6.4 partition } ;
Updated to 6.5 via DVD s

& Steelcase vintage / old-school stenographers seat (made in Grand Rapids , MI , USA)
PMUsers Website
^
Faizman
 Posted: Nov 24 2015, 11:40 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 16
Member No.: 3570
Joined: 24-November 15









Hi,
I just now tried installing SL7 on a machine already having windows 7. I was going for the dual boot. But when I start the machine, I dont get the dual boot option. It just goes directly to the SL. I am new in using Scientific linux. Can you please help me in solving this problem.
Faizman
PMEmail Poster
^
+X^N
 Posted: Nov 24 2015, 05:55 PM
Quote Post


SLF Member
***

Group: Members
Posts: 130
Member No.: 2581
Joined: 27-June 13









QUOTE (Faizman @ Nov 24 2015, 06:40 AM)
Hi,
I just now tried installing SL7 on a machine already having windows 7. I was going for the dual boot. But when I start the machine, I dont get the dual boot option. It just goes directly to the SL. I am new in using Scientific linux. Can you please help me in solving this problem.
Faizman

? First , did you make sure install the SL 7 into a 'new' partition , in order to avoid overwritting the Wind partition?
.
CODE
IN GENERAL :
I like to pre - partition the HDD in a live linux with GParted -- it is in Live SL first ,
then 'pick that partition when insalling SL in Anaconda (which is the default GraphicalUserInterface for installation)
[url=https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/ch-guimode-x86.html]https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/ch-guimode-x86.html[/url].
..
During installation {correct me if I am wrong other experts} install the GRUB into the same partition as SL , in order to preserve the Wind boot.
..
Subsequent to installing SL , [i]do the procedure in the first post[/i] of this topic & read the information in the links.

...
Let me know if you did the first ;
& any questions after attempting the procedure in the first post of this topic.

--------------------
DELL Precision 470 Workstation Xeon 3.2GHz (x2) , 2GB ECC ram ;
DELL UltraSharp 2007WFPb (L) ips monitor
Dual boot :1st installed: WinXPPro & then SL6.4 x86_64 - via 2 'everything' DVD s { GRUB going into the SL6.4 partition } ;
Updated to 6.5 via DVD s

& Steelcase vintage / old-school stenographers seat (made in Grand Rapids , MI , USA)
PMUsers Website
^
Faizman
 Posted: Nov 25 2015, 12:27 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 16
Member No.: 3570
Joined: 24-November 15









Hi,
Thank you for the reply. Yes I did install it in a new partition. My hard drive was partitioned into three- C, D and E. I cleared some space on E by shrinking it. Then I installed SL7 on to the freed up space. I have used the SL live CD to install. When I boot into SL, I can see the different drives where my windows stuff is present. SO, I think the windows partition is still there. Please let me know what to do next.
thank you
PMEmail Poster
^
Faizman
 Posted: Nov 25 2015, 05:09 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 16
Member No.: 3570
Joined: 24-November 15









Hi
On SL discussion forum, I found the link to this Red Hat discussion forum.
http://www.linuxquestions.org/questions/red-hat-31/how-to-add-windows-entry-to-grub-in-redhat-linux-7-a-4175520467/

Here they mention this solution-
-----------------------------------------------
If you are using BIOS mode, simple login as root and open a text editor and copy the entry you have in your first post (shown below) to the 40_custom file in the /etc/grub.d/directory. That is if your windows boot files are actually on that partition, sda1.

Code:

menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
chainloader +1
}

Then as root run the "grub2-mkconfig..." command you show in your post. When you reboot, you should see the windows 7 entry.
----------------------------------------
I am very new to these things. So, I am going to list the steps that I will take-
1. login as root
2. edit the 40_custom file located in /etc/grub.d
3. it has the following lines in it-
#!/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.

4. Delete whatever is in this file after the last line- "# the 'exec tail' line above"
5. Insert the following lines-
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
chainloader +1
}

6. On the terminal enter the command- grub2-mkconfig -o /boot/grub2/grub.cfg
here I have a question- before I enter the command at terminal, do i have to navigate to grub.d? Or I can just open the terminal, login as root and enter this command?

7. Restart the PC.

Will these steps work? Can someone please suggest.
thank you
PMEmail Poster
^
duda
 Posted: Nov 25 2015, 05:14 PM
Quote Post


SLF Newbie


Group: Members
Posts: 10
Member No.: 966
Joined: 25-October 11











Open the /etc/default/grub with an editor like nano:
CODE
sudo nano /etc/default/grub

Check the line GRUB_TIMEOUT:
CODE
GRUB_TIMEOUT=0

The value zero means you can see the boot menu for zero seconds.

So edit the value to see the boot menu for five seconds:
CODE
GRUB_TIMEOUT=5

Save changes and close it.

Now update grub2:
CODE
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Reboot your system.
PMEmail Poster
^
Faizman
 Posted: Nov 26 2015, 03:59 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 16
Member No.: 3570
Joined: 24-November 15









QUOTE (duda @ Nov 25 2015, 10:14 PM)
Open the /etc/default/grub with an editor like nano:
CODE
sudo nano /etc/default/grub

Check the line GRUB_TIMEOUT:
CODE
GRUB_TIMEOUT=0

The value zero means you can see the boot menu for zero seconds.

So edit the value to see the boot menu for five seconds:
CODE
GRUB_TIMEOUT=5

Save changes and close it.

Now update grub2:
CODE
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Reboot your system.





So, these 4 steps are to be done after the steps mentioned in my earlier post. Is that correct? the steps you mention will only change the time the boot menu stays ON. Currently, in my case, it already stays on for ~ 5 seconds.

thank you
PMEmail Poster
^
+X^N
 Posted: Nov 27 2015, 01:49 AM
Quote Post


SLF Member
***

Group: Members
Posts: 130
Member No.: 2581
Joined: 27-June 13









QUOTE (Faizman @ Nov 25 2015, 10:59 PM)

<snip>
So, these 4 steps are to be done after the steps mentioned in my earlier post. Is that correct?  the steps you mention will only change the time the boot menu stays ON. Currently, in my case, it already stays on for ~ 5 seconds.
thank you

Yes , it is only to set the time that you see the GRUB 2 menu

--------------------
DELL Precision 470 Workstation Xeon 3.2GHz (x2) , 2GB ECC ram ;
DELL UltraSharp 2007WFPb (L) ips monitor
Dual boot :1st installed: WinXPPro & then SL6.4 x86_64 - via 2 'everything' DVD s { GRUB going into the SL6.4 partition } ;
Updated to 6.5 via DVD s

& Steelcase vintage / old-school stenographers seat (made in Grand Rapids , MI , USA)
PMUsers Website
^
+X^N
 Posted: Nov 27 2015, 02:32 AM
Quote Post


SLF Member
***

Group: Members
Posts: 130
Member No.: 2581
Joined: 27-June 13









QUOTE (Faizman @ Nov 25 2015, 12:09 PM)

On SL discussion forum, I found the link to this Red Hat discussion forum.
http://www.linuxquestions.org/questions/red-hat-31/how-to-add-windows-entry-to-grub-in-redhat-linux-7-a-4175520467/

Here they mention this solution-
-----------------------------------------------
If you are using BIOS mode, simple login as root and open a text editor and copy the entry you have in your first post (shown below) to the 40_custom file in the /etc/grub.d/directory. That is if your windows boot files are actually on that partition, sda1.

Code:

menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
chainloader +1
}

It looks like this is a solution for Wind 7 Mine from my first posting in thsi topic was for XP --
so this part looks good .
Sometimes , i like to read the reference material also ;
that is why i linked to the GRUB documentation in my first posting in this topic .
The fedora forum link that I posted in my first posting in this topic is good also.
Finally , I like to double - check & cross reference these linux commands that I am learning.
QUOTE

Then as root run the "grub2-mkconfig..." command you show in your post. When you reboot, you should see the windows 7 entry.
----------------------------------------
I am very new to these things. So, I am going to list the steps that I will take-
1. login as root
2. edit the 40_custom file located in /etc/grub.d
3. it has the following lines in it-
  #!/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.

4. Delete whatever is in this file after the last line- "# the 'exec tail' line above"
5. Insert the following lines-
      menuentry "Windows 7 (loader) (on /dev/sda1)" {
      insmod part_msdos
      insmod ntfs
      set root='(hd0,msdos1)'
      chainloader +1
  }
.................................................................................................................................................
Personally , I chose to make a new file , so that , if anything went wrong , then I know that I only changed 1 file ;
see my first post in this topic.
.
The "(hd0,msdos1)" needs to be specific for your HDD partitioning ;
the linux command to see your partitions is
CODE
fdisk

Man page on fdisk : http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
See here for info on both fdisk & grub 2 for Wind 7 : http://superuser.com/questions/434130/dual-booting-linux-win7-grub-refuses-to-load-win
QUOTE
6. On the terminal enter the command-  grub2-mkconfig -o /boot/grub2/grub.cfg

That looks right.
QUOTE
  here I have a question- before I enter the command at terminal, do i have to navigate to grub.d? Or I can just open the terminal, login as root and enter this command?

Linux (just like Wind) uses directories & subdirectories (in Wind they call them "Folders").
So the path is relative. If the path starts with "/" , then it is at the "root" of the directory structure.
For example , the above starts with the
/
, then specifies the directory "boot" -- giving :
/boot
, followed by the "/" and then the subdirectory "grub2" and another "/" -- giving
/boot/grub2/
and finally the actual file name grub.cnf.
TL;DR No . The navigation is done in the command itself.
QUOTE
7. Restart the PC.
Will these steps work? Can someone please suggest.
thank you

Looks good so far .
..
Remember , the (hd0,msdos1) is specific for your HDD --
see above here
CODE
fdisk

instructions to find yours.
...

--------------------
DELL Precision 470 Workstation Xeon 3.2GHz (x2) , 2GB ECC ram ;
DELL UltraSharp 2007WFPb (L) ips monitor
Dual boot :1st installed: WinXPPro & then SL6.4 x86_64 - via 2 'everything' DVD s { GRUB going into the SL6.4 partition } ;
Updated to 6.5 via DVD s

& Steelcase vintage / old-school stenographers seat (made in Grand Rapids , MI , USA)
PMUsers Website
^
Faizman
 Posted: Nov 27 2015, 07:39 AM
Quote Post


SLF Rookie
*

Group: Members
Posts: 16
Member No.: 3570
Joined: 24-November 15









Thank you +X^N and Duda for your replies.
The problem is solved.
So, I did the steps like they are listed in my last to last post. Except , I had to add another step between step 5 and 6. The step is- from terminal run - chmod +x /etc/grub.d/40_custom

that took care of it.
thanks
PMEmail Poster
^
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll