LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2007, 04:08 PM   #1
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Rep: Reputation: 0
Installing GRUB


Hi, I currently do not have Linux installed, but I am trying to install GRUB.

I only have one internal hard drive, /dev/hda. My partition structure is as follows:
  • My Windows (NTFS, about 140GB in size) partition is /dev/hda1.
  • The extended partition is /dev/hda2.
  • I do not seem to have a /dev/hda3 or /dev/hda4.
  • My /boot partition (ext3, about 100MB in size) is /dev/hda5 (within the extended partition /dev/hda2).
  • My / partition (ext3, about 10GB in size) is /dev/hda6 (within the extended partition /dev/hda2).

So I boot from the latest Knoppix (5.1.1) into runlevel 2 (a root shell), and run:

Code:
mkdir /tempboot
mkdir /tempboot/boot
mount /dev/hda5 /tempboot/boot
cd /tempboot/boot
mkdir grub
cd /lib/grub/i386-pc
cp * /tempboot/boot/grub
/sbin/grub-install --root-directory=/tempboot /dev/hda
However, grub-install throws up an error, something to do with stage1 not being able to be read.

Furthermore, I try to do things like this:

Code:
/sbin/grub
grub> setup (hd0,0) (hd0,4)
but this also does not work, reporting that it cannot mount the device.

What am I doing wrong?
 
Old 02-14-2007, 10:25 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
GRUB requires much more information than can be stored in the 512 byte MBR. Thus the GRUB MBR points to files stored on the boot media (usually the HD) from which it can load the supplemental information. What you've done is stored that information in a RAM disk, so it goes "poof" when you reboot.

If your system includes a floppy disk drive or if you have a USB drive, try installing GRUB on that medium.

Alternatively, create a FAT partition on your HD and put the GRUB Stage 1, 1.5, and Stage 2 files in it. (Since GRUB does not "understand" NTFS drives, you can't put he boot information in your XP NTFS formatted partition.)
 
Old 02-14-2007, 12:26 PM   #3
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
GRUB requires much more information than can be stored in the 512 byte MBR. Thus the GRUB MBR points to files stored on the boot media (usually the HD) from which it can load the supplemental information. What you've done is stored that information in a RAM disk, so it goes "poof" when you reboot.

If your system includes a floppy disk drive or if you have a USB drive, try installing GRUB on that medium.

Alternatively, create a FAT partition on your HD and put the GRUB Stage 1, 1.5, and Stage 2 files in it. (Since GRUB does not "understand" NTFS drives, you can't put he boot information in your XP NTFS formatted partition.)
I don't think you understand what I am trying to do. I am trying to put GRUB's stage 1.5 and stage 2 files in my partition "hda5". This is not part of the RAMDISK. When I type "mount /dev/hda5 /tempboot/boot", the boot directory is now no longer part of the RAMDISK. It's just that the GRUB install script puts its files in /boot/grub or /grub.

You say "create a FAT partition on your HD and put the GRUB Stage 1, 1.5, and Stage 2 files in it". Why can I not use my existing hda5 partition (ext3) to do this? This is what I am trying to do. I am not trying to put the boot information in the NTFS partition.
 
Old 02-14-2007, 03:08 PM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Ah, OK. (Strange to have an ext partition sans Linux, but why not, eh?)

Then check the grub-install script, with particular attention to the map definitions. That map file needs to be correct for grub to function properly.

Also, you should have the grub info file available on the Knoppix disk.
 
Old 02-14-2007, 09:33 PM   #5
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
Ah, OK. (Strange to have an ext partition sans Linux, but why not, eh?)

Then check the grub-install script, with particular attention to the map definitions. That map file needs to be correct for grub to function properly.

Also, you should have the grub info file available on the Knoppix disk.
I checked my map file and it seems to be correct, I looked at the documentation, the only line I really need is

Code:
(hd0) /dev/hda
I do not even need floppy support, my BIOS handles booting from floppy.

I do not have the grub info file on Knoppix, for some reason. Typing "info grub" simply brings up the normal manpage. However this is no big deal as the "info" manual is available online at http://www.gnu.org/software/grub/manual/.

Incidentally, the exact error which grub-install gives me is

Code:
The file /tempboot/boot/grub/stage1 not read correctly.
However I can check and this file definitely does exist. Furthermore, "file stage1" reports that it is a GRand Unified Bootloader file.
 
Old 02-16-2007, 01:07 PM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Ah, but that error is, explicitly, telling you that GRUB could not read the file. So, maybe a hardware problem. Can you run fsck on the device from which /tempboot is mounted?
 
Old 02-16-2007, 02:39 PM   #7
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
Ah, but that error is, explicitly, telling you that GRUB could not read the file. So, maybe a hardware problem. Can you run fsck on the device from which /tempboot is mounted?
Yes, here is the result:

Code:
> fsck /dev/hda5
fsck 1.40-WIP (14-Nov-2006)
e2fsck 1.40-WIP (14-Nov-2006)
boot: clean, 22/26104 files, 9234/104388 blocks
>
In any case, I do not think that this is a hardware problem. I think that I am not typing in the right commands. Please could someone check the commands I am running, to see if I am making some stupid error somewhere.
 
Old 02-20-2007, 11:07 AM   #8
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I've found (when booting from a USB drive) the GRUB syntax (hd0,4)/tempboot/... soemtimes works better.

Boot to the GRUB menu, and use the "e" option to edit the in-memory copy of the boot instructions. A handy feature is that the <Tab> key will list available "completions" from wherever you are in the line.

Of course the message you get -- "Not read properly" -- implies that the file was found, but not readable. Have you tried re-creating it?
 
Old 02-20-2007, 09:33 PM   #9
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
I've found (when booting from a USB drive) the GRUB syntax (hd0,4)/tempboot/... soemtimes works better.
Ah, but the point is that tempboot is not a subdirectory of (hd0,4). It is a directory, which hda5 just happens to be mounted to. This is under the root filesystem (which is a RAMDISK, as you pointed out earlier).

Quote:
Boot to the GRUB menu, and use the "e" option to edit the in-memory copy of the boot instructions.
I can't boot to the GRUB menu. GRUB is not installed. Installing GRUB is what I am trying to do right now.
 
Old 02-20-2007, 09:35 PM   #10
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
Of course the message you get -- "Not read properly" -- implies that the file was found, but not readable. Have you tried re-creating it?
I am not quite sure how to do this. Presumably I would have to rebuild GRUB from source, but then I would get a different version of stage1 from the one associated with the grub binary included in Knoppix...
 
Old 02-21-2007, 09:19 AM   #11
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
OK, let me see if I've got this straight:

1) You have the GRUB stage boot information on a directory physically located in a RAM disk.
2) You have created a symbolic link to the boot information.
3) You want to point GRUB to the symlink, and boot.

So, a couple questions:

1) When you reboot (to get the GRUB boot process started), how are the contents of the RAM disk recreated? My confusion here is that, unless the RAM disk is created by your BIOS, your RAM will be reset (usually to zeros) during the reboot. If the contents of the RAM disk are copied from some other place (where the contents are preserved across boots), why don't you point GRUB to that place instead of a RAM disk?

2) Any symlink must be interpreted by a running Linux system. What Linux system is running prior to any Linux system being booted?

Why don't you put the /tempboot directory on sda5 as a real, physical, directory and point GRUB to it? (That's the point of my last sentence in item 1, above.)

Bottom line: If the information does not (or will not) exist at the time that GRUB tries to boot, just how do you expect GRUB to be able to run correctly? (I do like reading Si-Fi and Fantasy novels, but I don't really expect magic to work whilst my computer boots.)
 
Old 02-21-2007, 11:22 AM   #12
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by PTrenholme
OK, let me see if I've got this straight:

1) You have the GRUB stage boot information on a directory physically located in a RAM disk.
No. The boot information is physically located on my hard drive, hda5. This drive is mounted on /tempboot/boot.

Quote:
Originally Posted by PTrenholme
2) You have created a symbolic link to the boot information.
No. When did I say that I created a symbolic link? I have not used the "ln" command anywhere!
 
Old 02-21-2007, 11:38 AM   #13
BillyGalbreath
Member
 
Registered: Nov 2005
Location: Houston Texas
Distribution: Debian Sid
Posts: 379

Rep: Reputation: 31
I see wht you are trying to do and it makes sense... except one part..

I dont think GRUB can boot from an extended partition. Try creating a hda3 (as a primary partition) as your boot instead of hda5.
 
Old 02-23-2007, 08:00 AM   #14
kidburla
LQ Newbie
 
Registered: Feb 2007
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by BillyGalbreath
I see wht you are trying to do and it makes sense... except one part..

I dont think GRUB can boot from an extended partition. Try creating a hda3 (as a primary partition) as your boot instead of hda5.
Yes, in fact I had already realised this by the time I am posting this. My hda5 partition crosses the cylinder boundary, and is not a primary partition. In addition, I realised the fs type had not been set correctly in the actual partition table. I wish there was a simple partition table editor, I used to use something called RANISHPART in the old days, but that doesn't work anymore... Anyway I corrected my problem with PartitionMagic from PowerQuest, and everything is now fine.

Thanks for your help everyone. I am sure I will be posting again presently with more problems (as I am getting a "Attempted to kill init" error coming up now) but for now, I just thank you for your suggestions.
 
Old 02-23-2007, 08:30 AM   #15
BillyGalbreath
Member
 
Registered: Nov 2005
Location: Houston Texas
Distribution: Debian Sid
Posts: 379

Rep: Reputation: 31
I want to know how you're getting that "attempted to kill init" error if you dont have a linux os installed...

Are you trying to boot into a linux thats not there?
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
installing GRUB survivor45 Linux - Newbie 1 07-27-2006 04:19 PM
Why grub prompt after installing Grub inder Debian woody 3.0r2? velan Debian 1 04-20-2004 04:55 AM
Re-installing XP with grub Rizla Linux - General 1 04-14-2004 07:43 AM
installing grub amatin Linux - Software 5 12-04-2003 11:45 AM
re-installing GRUB newbix Linux - General 8 10-27-2003 12:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:45 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