LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 09-17-2008, 07:44 AM   #1
mshankarsingh
LQ Newbie
 
Registered: Feb 2008
Posts: 2

Rep: Reputation: 0
Unhappy Grub


Hi, I accidently deleted the grub.conf file available in the /boot/grub directory.
Then I did the following step to boot the system proper but went in vein.
1st in the 1st RHCE CD then type the command # linux rescue
2md type the command # chroot /mtn/sysimage
3rd type the command # grub-install /dev/hda

before giving the 3rd command you have to know which type Hard disk your system uses which can found by fdisk command.

But even after doing this, I could not boot the system properly as it was giving me the error messages the grub.conf file is missing.

-----Please could someone tell me how to fix this or similar sort of problem-------
 
Old 09-17-2008, 07:49 AM   #2
watcher69b
Member
 
Registered: Nov 2007
Location: /home/watcher69b
Distribution: RH, Fedora & CentOS
Posts: 539

Rep: Reputation: 39
do a ls of the /boot and look for your kernel
from a prompt
su
touch grub.conf
vi grub.conf

here is mine just edit it and put your kernel name in






# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=200
splashimage=(hd0,0)/grub/tuxos.xpm.gz
hiddenmenu
title Fedora (2.6.26.3-29.fc9.i686)
root (hd0,0)
kernel /vmlinuz-2.6.26.3-29.fc9.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.26.3-29.fc9.i686.img
 
Old 09-17-2008, 11:03 AM   #3
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
You can have a look at the Grub package (.rpm if you're using RedHat) which should contain the basic grub configuration file (that's what you're looking for if you haven't done any changes yourself). However for a quick start you can write it yourself like described above.

Note that you'll need to check that the "root", "kernel" and "initrd" lines match your configuration.

"root": the partition where your kernel and other boot-related files are; first number means disk and second partition, starting from zero. Fist partition of primary disk is "(hd0,0)", second partition of primary disk is "(hd0,1)", first partition of secondary disk is "(hd1,0)" and so on. This is either your root partition, or if you have a separate boot partition, then that.

"kernel": path to the kernel file, assuming that root ("/") is on the partition mentioned in the previous line. If you have a separate /boot partition and the files are there, the paths are like in watcher69b's post. However if your /boot is on your root partition (= you don't have a separate boot partition), you probably need to add the "/boot" to the path, so following the above post example the line would become
Code:
kernel /boot/vmlinuz-2.6.26.3-29.fc9.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
This is because now the files are in a directory called "boot" which is in the partition's root; in case of a separate boot partition the files probably reside in the boot partition's root directory. The option "root=" tells, like it says, the root partition, and is like above ("/dev/VolGroup00/LogVol00") if you are using LVM, but if you are not (your partitions are just normal partitions) it's probably "/dev/sda1" (first partition of primary disk) depending on the partition. If this is wrong, Grub fails to boot With some kernels you'll need to use "hda" instead of "sda" in this case if you have an IDE disk..

"initrd": basically same story as with "kernel" line: path and filename of "initrd", relative to the partition mentioned in the "root" line.

The other lines are optional as far as I know, but at minimum you need the lines starting with "title", "root", "kernel" and very probably "initrd".

Last edited by b0uncer; 09-17-2008 at 11:05 AM.
 
  


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
Changing GRUB-GRUB, GRUB-LILO and vice versa andreas_skw Linux - Newbie 1 06-05-2008 06:40 AM
/grub/menu.lst file disappeared but computer still boots (grub) rrrssssss Linux - General 5 04-08-2007 09:02 AM
Booting my new ubuntu install = "GRUB GRUB GRUB GRUB GRUB" etc. dissolved soul Ubuntu 2 01-13-2007 12:55 PM
can some fc4 user mail his grub.conf and tell me how can i make this grub read this amolgupta Linux - Software 1 03-15-2006 04:04 AM
Why grub prompt after installing Grub inder Debian woody 3.0r2? velan Debian 1 04-20-2004 04:55 AM


All times are GMT -5. The time now is 01:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration