LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Grub (https://www.linuxquestions.org/questions/linux-desktop-74/grub-670500/)

mshankarsingh 09-17-2008 07:44 AM

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-------

watcher69b 09-17-2008 07:49 AM

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

b0uncer 09-17-2008 11:03 AM

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".


All times are GMT -5. The time now is 12:53 PM.