LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-09-2007, 02:52 PM   #1
bjhinkle
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Rep: Reputation: 0
Unhappy Grub error on reinstall debian etch


Have been trying to setup a router using debian etch. I have found, being new to linux, it's easier for me to reinstall/start over when I screw something up or don't like the way something is installed. I have probably reinstalled about 5-10 times so far. On each reinstall I repartition and reformat the drive and fix what I did not like about the last installation. During the last install I repartitioned and reformatted then continued with the install. When I got to the grub install portion I got the following error:

The grub package failed to inatll to /target/. Installing GRUB as a boot loader is a required step.

GRUB installation failed. Continue anyway?

I choose yes then get the message stating this is a new installation and do I want to install GRUB. I choose yes.

Then the screen turns red and I get this error.

Unable to install GRUB in (hd0) Executing 'grub-install (hd0) failed. This is a fatal error.

I thought the hard disk may be corrupt so I installed a new one and get the same error. Thought my install cd may be corrupt so created another and get the same error. I then downloaded debian sarge and tried to install and it works! I would be satisfied with installing sarge but my network cards don't seem to work under sarge. So, if anyone can help me figure out why grub won't install under etch, I would be thankful.

One last thing I did search the forums and came across this thread http://www.linuxquestions.org/questi...d.php?t=459705.

I tried checking out the bios and don't have any options for boot sector protecion. The solution the author had was booting to win98 disk and fdisk. But I don't have a windows partition on this computer.
 
Old 02-09-2007, 04:00 PM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I don't think it has anything to do with Grub or etch but more to do with the installer.

I would in such a case restore Grub or even write the menu.lst myself if the installer doesn't manage it.

Have a look at the Task B4 and B5 on the last link of my signature on how to restore Grub.

For Grub to work all you need are 3 files of stage1, stage2 and menu.lst in /boot/grub subdirectory. The stage1.5 if available will be used but Grub can survive without it. If menu.lst isn't there Grub simple defaults to a Grub prompt. Even without menu.lst a user can still boot a Debian manually using the "tab" key to let Grub match the kernel and initrd files names.

Also check out this thread and the advice gave by Pixellany.

Last edited by saikee; 02-09-2007 at 04:02 PM.
 
Old 02-12-2007, 05:03 AM   #3
bjhinkle
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Ok what am I doing wrong here. Getting frustrated may be easier to install sarge and just get the network adapters to work under sarge. I have followed every instruction I came across including yours saikee. I did a fresh install of etch set my partitions to approx 30gig each home, var, root, etc. Setup a 1.6gig swap. Thinking maybe has something to do with large partition size, but no still getting error when I get to the grub install. Tried lilo and get same error that it cannot install. So, I continued the install without bootloader. After reboot get grub error 15. Downloaded debian live cd and boot to it. Tried running "sudo grub" but was not found. So sudo apt-get install grub while booted to live cd. Ran sudo grub > then find /boot/grub/stage 1 and get error 15. Quit grub and run sudo fdisk -l and get:

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 4255 34178256 83 Linux
/dev/hda2 4256 19457 122110065 5 Extended
/dev/hda5 4256 8510 34178256 83 Linux
/dev/hda6 8511 12157 29294496 83 Linux
/dev/hda7 12158 16412 34178256 83 Linux
/dev/hda8 16413 19257 22852431 83 Linux
/dev/hda9 19258 19457 1606468+ 82 Linux swap / Solaris

Then run grub again

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no

Error 15: File not found

Then try mounting hda /mnt/root, proc /mnt/root/proc, and bind /dev /mnt/root/dev and chroot to /mnt/root/bin/bash.

Try to run grub from here and file not found. Try apt-get install grub and apt-get not found. Try install-grub and file not found.


What is the deal am I missing something or going out of my mind. Have not had any problems installing debian etch multiple times. Nothing has changed on this computer except new hard disk since I was having the same problem with the old disk. Thanks.
 
Old 02-12-2007, 08:34 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Grub has already told you that stage1 (also stage2) has not been found in the 1st partition of 1st disk and that is (hd0,0) to Grub or hda1 in Linux. Grub always counts from 0.

If you found /boot/grub/stage1 it is the version in the Live CD as it is that version that you are booting to and not inside hda1!

You can get away the problem pretty qickly by boot up Debian Live CD, mount hda1, copy all the files from Debian's /boot/grub directory into hda1, invoke a Grub shell, tell Grub the root partition you are insterested is in (hd0,0) and ask it to set itself up in the MBR or (hd0) as follow

Code:
sudo mkdir /mnt/hda1 
sudo mount /dev/hda1 /mnt/hda1
sudo mkdir /mnt/hda1/boot/grub
sudo cp -R /boot/grub/* /mnt/boot/grub
sudo grub
root (hd0,0)
setup (hd0)
quit
On a reboot you should boot to a Grub prompt and that is where you can start the real computing by booting Debian "manually".

In Manual booting with a Grub prompt there are only 4 commands

(1) "root (hd0,0)" will tell Grub you are insterested in hda1
(2) "kernel /boot/(name of kernel) root=/dev/hdax ro" telling what kernel to be used and supply the "/" partition name for hdax
(3) "initrd /boot/(name of initrd)" telling what ramdisk file to be used.
(4) "boot" statement as the green light for Grub to go ahead

You obviously have no idea of where to get (name of kernel) and (name of initrd) right? You can use the Live CD to mount hda1 and write it down. Or more cleverly using the "tab" key because Grub (just like Bash) responds to the tab key by try to match the filing name. The Debian kenerl and initrd always start with "vmlinux" and "initrd" respectively.

Here is the relevant section of my Debian Sarge Grub
Code:
title		Debian GNU/Linux, kernel 2.4.27-2-386 
root		(hd0,22)
kernel		/boot/vmlinuz-2.4.27-2-386 root=/dev/hda23 ro 
initrd		/boot/initrd.img-2.4.27-2-386
boot
if you type at Grub prompt
Code:
kernel		/boot/vmlinuz-
and then press the "tab" key you will find Grub responds by
Code:
kernel		/boot/vmlinuz-2.4.27-2-386
so use it to the good effect.

All the commands that boot a Linux are those you need to put ine /boot/grub/menu.lst, except you need an extra "title" statement to identify the system.
 
Old 02-12-2007, 06:49 PM   #5
bjhinkle
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Maybe I don't have the right live cd but when I try the instructions you gave me I don't have /boot/grub when booted into the live cd.

Opened terminal then:

casper@live:~$ cd /
casper@live:/$ sudo mkdir /mnt/hda1
casper@live:/$ sudo mount /dev/hda1 /mnt/hda1
casper@live:/$ sudo mkdir /mnt/hda1/boot/grub
casper@live:/$ sudo cp -R /boot/grub/* /mnt/boot/grub
cp: cannot stat '/boot/gru/*': No such file or directory
casper@live:/$ cd boot
casper@live:/boot$ ls
config-2.6.18-4-486
initrd.img-2.6.18-4-486.bak
vmlinuz-2.6.18-4-486
initrd.img-2.6.18-4-486
System.map-2.6.18-4-486
 
Old 02-13-2007, 05:31 PM   #6
bjhinkle
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Any help ?????????
 
Old 02-13-2007, 07:35 PM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
From the howto of 145 systems in my signature
Quote:
(B) The next task is to get hold of 3 files Grub needs for installation. They are called stage1, stage1.5 and stage2, which are held together in a directory, and are available in any Linux Live CD that supports Grub. So just boot up a Live CD and ask Linux to report to you their position by command
Code:
find / -name stage1
you will find these files are typically held in the following directories

Red Hat, Fedora C2 to C6
/usr/share/grub/x86_64-redhat/stage1
/usr/share/grub/i386-redhat/stage1

Mandriva
/lib/grub/i386-mandriva/stage1

Mandrake
/usr/local/lib/grub/i386-pc/stage1
/usr/lib/grub/i386-pc/stage1


Suse
/usr/lib/grub/i386-suse/stage1

Gentoo, Knoppix, Mepis, Xubuntu, Ubuntu, Kubuntu, Debian
/lib/grub/i386-pc/stage1


Frugalware, Kanotix
/usr/lib/grub/i386-pc/stage1
If your Debian boot disk, which I never use, doesn't have Grub's stage files just get them from any of the above Live CDs. Any consistent set of stage files can boot up your PC. I tried Grub from version 0.91 to 0.97 myself.
 
Old 02-14-2007, 09:37 AM   #8
bjhinkle
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
That did it. The live cd I downloaded from http://live.debian.net/ did not have grub. At least I could not find it. I started, once again, by booting to debian etch installation cd. Repartition and reformatted the drives. Got to the grub installation and got error then just skipped and continued without boot loader. Popped in knoppix cd and booted. Mounted hda1, created grub folder and copied stage files, installed grub to mbr, then rebooted. Grub came up, typed boot parameters and booted. Created menu.lst file with boot parameters and rebooted. Thanks for your help.
 
Old 02-14-2007, 10:32 AM   #9
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Nice to see a happy ending.

You obviously picked a bit experience about Linux booting too.
 
Old 02-17-2007, 01:35 AM   #10
soccercisco
Member
 
Registered: Dec 2006
Location: Fullerton, CA
Distribution: Debian
Posts: 36

Rep: Reputation: 15
Just wanted to add my two cents...

I have a netinstall CD of Debian Etch and for some reason grub works fine on some Computers (my 2 desktops) but not on others (my Dell Laptop). That is, when I install Debian Etch with the "same" CD on different computers I get different results, namely, grub or no grub. Although, thanks to this AWESOME explanation, what I thought it was a "lost battle" (installing Etch on my Laptop) has come to a happy ending.

Thanks for the clear explanations, I just wanted to add that (as in my case) the installation of grub might not even be related to the means of installation (in my case the netinstall CD), but perhaps something more sinister... Although, I can prove by experience that following the steps above (and extrapolating the information to one's own configuration) you will get a working boot, just like the default one.

Cheers,
 
Old 02-28-2007, 05:05 AM   #11
lyckantropen
LQ Newbie
 
Registered: Feb 2007
Posts: 1

Rep: Reputation: 0
although the initial problem may be solved by using a livecd to fix grub, this is a serious issue for mass deployment of linux installations using systemimager for example. i've been trying to replace images of sarge running lilo with new etch images using systemimager and grub has been failing to install on fresh copies.

Tests i ran so far:

with a sarge system, and trying to load an image on a clean HD:

- using different versions of syslinux (stable and etch/testing) ...works fine.
- using different versions of systemimager (stable and etch/testing) ...works fine.
- basic image with sarge + grub ...works fine.
- using the basic image, changing the sources.list to point to etch and not stable, preforming a dist-upgrade and upgrading to kernel 2.6.18-3-i686: grub_install fails.

On loading the image, grub_install sends a warning on the different paths (/sbin/ and /usr/sbin) and then the process shuts down, leaving the image with no bootloader.

At first i thought this would have to do with systemimager's compatibility with etch, but from what i'm reading in forums the problem is a lot more widespread.

For now our temporary solution is to load all computers with sarge + grub and then reload the etch images, as the previous install of grub holds out fine.

Last edited by lyckantropen; 02-28-2007 at 05:13 AM.
 
Old 03-01-2007, 07:35 AM   #12
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
From my experience with Grub the script "grub-install" is executed inside a Linux kernel and will suffer whatever problem you have with the kernel.

A more reboust implementation of Grub is to do it "outside" the Linux kernel from a Grub prompt.

You can get a Grub prompt when booting up a Grub screen in Debian and pressing immediately the "c" key.

If you have the /boot/grub directory in the 2nd partition of the 1st disk, which is known to Grub as (hd0,1) and want to place Grub in the MBR then these lines will guarantee success
Code:
root (hd0,1)
setup (hd0)
If you restore a system image it is generally necessary to restore its boot loader because the hard disk addresses may not match the original. To make sure the hard disk addresses (so the the boot loader can find the kernel position) matched you will need to clone the whole disk or put the partition back at the exact spot where it was cloned out.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Grub error 17, and wont reinstall using grub-install! chiefreborn Linux - General 6 06-06-2007 11:29 AM
Dual boot Debian Etch and XP with GRUB - Debian installed First - one HDD bence8810 Debian 11 01-07-2007 11:45 AM
Urgent: Installing debian etch on a new hdd but grub won't install (fatal error) MrInept Debian 4 09-14-2006 09:54 AM
Grub error 15 at boot, error 20 at reinstall serafean Linux - Software 4 08-17-2006 02:47 PM
GRUB Error 17 after reinstall of XP (FC 2) centrepid Linux - Newbie 1 07-20-2005 05:59 PM


All times are GMT -5. The time now is 02:36 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration