How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

General support questions including new installations

How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby jvsrvcs » 2011/06/24 01:17:39

I have searched and searched and found many articles some specific to using a CentOS CD to boot and install grub but things do not work. Everything I find about installing grub has a different approach.

It is possible to create a "install_grub.exe" and after double clicking and reboot, have a grub UI where config info can be entered, saved and grub installed such that on reboot one is good to go, but that has yet to be done, and as soon as I get some spare cycles and knowledge will create a .exe that can be run from within Windows to do this magical thing.

--- But for now....

I have two disk drives in my box. One has Windows 7 and another VMWare ESXi 4.1. When my system boots, I can press F10 (if I am quick enough and paying attention) and choose which disk to boot from and life is dandy.

Most of the time I am not quick enough and not paying attention, so I want my system to boot to a menu and wait (for a period of time just beyond my distraction point) and the autoboot if I do not select an option.

This is where grub comes in.

So my Windows 7 is on sda1 (sata slot 1) and was installed first and boots to that by default.

Is it possible to install grub on the Windows 7 disk and create a customized menu?

---> When I search I get a lot of ubuntu articles on how to install grub.


This was supposed to go to the version 5 forum, but guess I did not click in the right place the first time.

What I have is a CentOS 5.6 x64 live CD.

I found one article here: http://www.centos.org/docs/5/html/5.2/I ... oader.html

I am lost on the first two steps:

1. Boot the system from an installation boot medium <= OK
2. Type linux rescue at the installation boot prompt to enter the rescue environment <= how do I get to a boot prompt?

If I hit space or tab am given 4 options

Boot
Boot (text mode)
Memory Test
Boot from local drive

and if I choose the first two, I get a grey screen with the first line being black that has white text that says "Memory for crash kernel... nowithin range) and then it prints out a dozen or
so more lines and says "Enterning non-interactive startup..."

---
So my question is: Is it possible to install grub on my windows 7 hd from a CentOS 5.6 x64 Live CD? and if so how?

Regards,

J.V.
jvsrvcs
 
Posts: 31
Joined: 2011/06/24 01:00:39

How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD

Postby pschaff » 2011/06/24 01:50:32

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature. Your post to the CentOS 4 forum has been deleted.

jvsrvcs wrote:
... What I have is a CentOS 5.6 x64 live CD.

I found one article here: http://www.centos.org/docs/5/html/5.2/I ... oader.html

I am lost on the first two steps:

1. Boot the system from an installation boot medium <= OK
2. Type linux rescue at the installation boot prompt to enter the rescue environment <= how do I get to a boot prompt?

The CentOS 5.6 LiveCD is not installation media, so those instructions do not apply, but it may still be suitable for your purposes.


If I hit space or tab am given 4 options

Boot
Boot (text mode)
Memory Test
Boot from local drive

and if I choose the first two, I get a grey screen with the first line being black that has white text that says "Memory for crash kernel... nowithin range) and then it prints out a dozen or
so more lines and says "Enterning non-interactive startup..."

If you choose the first do you not eventually get a GUI login, and for the second a text-mode login? If so, you may be able to login to the GUI and "su -" to become root, or log in as root on the text console. I can't test the procedure as I am currently in a mountain resort with only a laptop and no LiveCD, but if you can create a small boot partition to hold the grub files, and create the grub.conf menu file by hand, it should be possible to install GRUB.

It would probably be easier to obtain installation media and do a minimal CentOS install to get it going. In any case, you will need at least enough free disk space and a partition table entry to create a primary partition. The boot partition could be on either disk, but the GRUB boot record should be written to the MBR of the boot disk.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby jvsrvcs » 2011/06/24 21:14:34

I tried the full install medium and could not get that to work either. The chroot did not work. I found grub-install but when I ran that it said "grub" not found even though it was in the same directory as "grub-install". I am no closer to getting this solved. If possible would like to chat with someone via gtalk to get this working, as I have to get up and running now.

I have tried a number of things, google'd searched, tried many different instructions. Chat by gtalk would help me to get this done more quickly instead of back and forth forum posts. And I will buy you a beer for your help.
jvsrvcs
 
Posts: 31
Joined: 2011/06/24 01:00:39

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby jvsrvcs » 2011/06/24 21:56:17

When I boot from the install CD and type boot: linux rescue and get to a prompt

I then type:

/usr/sbin/grub-install /dev/sda

and get:

/sbin/grub: Not found

that's because grub is actually in /usr/sbin and not /sbin but in the grub-install script it is hard coded sbindir=/sbin

so I am not sure how it is possible to install grub using a CentOS install CD or from a live CD.

If there is another way, let me know. I have seen articles on how to do this by downloading Ubuntu live CD but I have on had three CentOS 5.6 cd's now (x32, x64 and Live) so would really like to make this work and if there is something wrong with a bug in the 5.6 release with installing grub with a boot CD, then would like to contribute to get it fixed.

jv
jvsrvcs
 
Posts: 31
Joined: 2011/06/24 01:00:39

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby jvsrvcs » 2011/06/24 21:59:30

Also because I was able to find instructions on how to do this in 5.2, does this mean that 5.6 was a digression in that it worked in a previous release but was later broken for some reason? Does anyone have a copy of the grub-install script from 5.2? I cannot edit the file because, well I am on a CD.

I do not have any form of linux installed on any HD, just Windows 7 on one disk and VMWare ESXi on another (under which I hope to run several CentOS instances).

Can someone rule out that it is is impossible to use any CentOS cd to install grub? If so will try to do something with F10 boot options and just be there to hit it at the right time, but would like to get this working as we have many machines we wish to replicate this on.
jvsrvcs
 
Posts: 31
Joined: 2011/06/24 01:00:39

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby pschaff » 2011/06/25 00:57:17

It sounds like you are trying to use chroot from the rescue media without actually installing CentOS. You can't use the chroot from the rescue media without an installed system, and if you have a properly installed system (as suggested) then chroot should not be required.

I should have suggested earlier that you may want to try Super Grub Disk rather than the mis-application of CentOS just to get a bootloader going.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby jvsrvcs » 2011/06/27 22:38:50

Thanks, I downloaded the SuperGrub2 disk and it presents me with a menu that provides information about my system, but there is no option to "Install grub". Any ideas? I had assumed it would let me install grub.

---
Basically I can see that grub can be installed using a few commands at the command line and editing a .conf file. This should be possible using a CentOS CD (full install in rescue / command line prompt mode, or by using a live CD), however because of they way the scripts are setup it is not now possible. /usr/sbin/grub-install needs to find /sbin/grub but it cannot because 'grub' is hardcoded in the script to be /sbin/grub and not /usr/sbin/grub where it really lives.

Any way around this? the scripts cannot be edited on the live CD boot or on the full install DVD boot and going into rescue mode.

Maybe I can download Fedora or Ubuntu to get grub installed, not sure but you would think a disk labled "SuperGrub2" would allow the installation of grub on any hard drive it finds. Any additional help would be appreciated.
jvsrvcs
 
Posts: 31
Joined: 2011/06/24 01:00:39

Re: How to install GRUB (from CentOS 5.6 Live CD to Windows 7 HD)

Postby pschaff » 2011/06/28 18:15:29

jvsrvcs wrote:
Thanks, I downloaded the SuperGrub2 disk and it presents me with a menu that provides information about my system, but there is no option to "Install grub". Any ideas? I had assumed it would let me install grub.

That is the one choice of three on the supergrubdisk.org that does not claim the ability to fix GRUB. Please read their documentation.

---
Basically I can see that grub can be installed using a few commands at the command line and editing a .conf file. This should be possible using a CentOS CD (full install in rescue / command line prompt mode, or by using a live CD), however because of they way the scripts are setup it is not now possible. /usr/sbin/grub-install needs to find /sbin/grub but it cannot because 'grub' is hardcoded in the script to be /sbin/grub and not /usr/sbin/grub where it really lives.

Wrong.
[root@wx1 ~]# cat /etc/redhat-release
CentOS release 5.6 (Final)
[root@wx1 ~]# uname -r
2.6.18-238.12.1.el5
[root@wx1 ~]# which grub
/sbin/grub

The script it not suitable for your situation. It expects to find /boot/grub/grub.conf and other files in the standard locations for an installed CentOS system. That does not fit your situation, which is why I suggested you do a minimal install to be able to have a base to work from.

Any way around this? the scripts cannot be edited on the live CD boot or on the full install DVD boot and going into rescue mode.

If you had an installed system then there would be something to edit. You of course cannot edit the scripts on the CD/DVD in-place.

Maybe I can download Fedora or Ubuntu to get grub installed,

I would expect the same issues. You can install GRUB to the MBR with any of the above, but to get full capability you need the stage1, stage2, and menu files installed on disk.

not sure but you would think a disk labled "SuperGrub2" would allow the installation of grub on any hard drive it finds.

I would not expect that, because it does not claim that capability.

Any additional help would be appreciated.

If you are not willing to install to the hard disk then creating a custom GRUB boot CD or USB media (which would still require an installed system to create it on) seem like the only viable options. I don't know enough about ESXi 4.1 to guess what possibilities it offers.

You might be able to use the Windows boot manager, or some 3rd party boot manager, but this is not the appropriate venue to discuss those options.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America


Return to CentOS 5 - General Support

Who is online

Users browsing this forum: No registered users and 1 guest