Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
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.
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.
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.
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
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
(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
find / -name stage1
you will find these files are typically held in the following directories
Red Hat, Fedora C2 to C6
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.
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.
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.
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.
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
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.