how to reinstall grub
I had Red Hat linux working I had some space on my hard drive I made another LVM partition on that free space. after making the LVMs I could not boot Linux. I get a black screen with just written
grub I think I lost my bootloader, I rescue my system did fdisk -l removed the boot partition and made it again. i gave the command grub--install what to do next to make grub.conf file how the process will after that. thanks in advance shahz |
If you already ran the grub-install command from rescue mode you should be all set. You might have to specify exactly what disk you want to install grub on (i.e. grub-install /dev/sda1, etc...) if you still experience the black screen.
|
This is what I used to do a grub fix.
Boot up using RHEL4 disk. Type: linux rescue Hit OK. Hit OK. Clicked NO (for networking) Hit OK. At prompt, type: chroot /mnt/sysimage At prompt, type: grub At prompt, type: find /boot/grub/stage1 or find /grub/stage1 At prompt, type: root (results or previous step) example: root (hd0,0) At prompt, type: setup (hd0) Note: use results from above, I used what mine was as in the example. At prompt, type: quit At prompt, type: exit At prompt, type: exit Machine will reboot and grub should be fixed. Make sure you remove disk during reboot. Hope this is helpful. |
I will make it more clear for the Gurus and helpers
I installed Red Hat Linux I have partitions like /dev/sda1 /boot /dev/sda2 /root /dev/sda3 swap I booted my system with rescue mode chroot /mnt/sysimage/ fdisk /dev/sda I delted the boot partition (for my lab purpose) I made it again the boot partition on /dev/sda1 I again rebooted my system with rescue cd chroot /mnt/sysimage/ df and I get the following result /dev/sda2 / /dev/sda1 /boot /dev/sda5 /home now I want to install the grub next steps please..... thanks shahz |
|
Well again after some googling I rebooted my system with rescue mode.
and gave the command grub-install /dev/sda type grub grub> find /grub/stage1 (hd0,0) setup (hd0,0) checking if "/boot/grub/stage1" exists .... no checking if "/grub/stage1" exists .... yes checking if "/grub/stage2" exists .... yes checking if "/grub/e2fs_stage1_5" exists ... yes Running "embed /grub/e2fs_stage1_5 (hd,0)" .. failed (this is not fatal) running "embed /grub/e2fs_stage1_5 (hd0,0) ... failed (this is not fatal) running "install /grub/stage1 (hd0,0) /grub/stage2 p /grub/grub.conf" ... succeeded done. grub> reboot after rebooting my system I get the again the prompt for grub grub> and now I am lost what to do and what I am missing. thanks |
At the grub prompt try
root (hd0,0) setup (hd0) |
I see that PART of what you did involves the use of "setup" in the GRUB shell. That is the only method I ever use---further, you would not use that AND grub-install. It's one or the other.
To install GRUB, you have to specify where its files are. GRUB files are in /boot/grub, but you have to specify which partition. Suppose I have the GRUB files---eg the config file, menu.lst---in sda3. ((hd0,2) in GRUB's syntax) And I want GRUB installed in the MBR of sda (hd0). The commands are: grub (starts the GRUB shell) root (hd0,2) setup (hd0) See also the "booting" link below--it includes a link to the GRUB manual |
I don't have any file within the /boot partition because I already delted the partition made it again with fdisk. I rescued the system with a bootable cd.
when I df I get the follwing. /dev/sda2 / /dev/sda1 /boot /dev/sda5 /home when I used the grub command grub> At the grub prompt try root (hd0,0) setup (hd0) the output says checking if "/boot/grub/stage1" exists .... no checking if " /grub/stage1" exists ..... no Please keep in mind that I don't have any files within /boot partition because I deleted the parition made it again now want to install grub on it. thanks |
Quote:
It seems like re-installing Linux might be the easiest solution. |
well thanks brother for advising to reinstall but I want to get everything manually as I told before that I formated the /boot partition my self. if there is a hard way let me know I want to do it.
thanks |
You have to install into the /boot directory all of the files normally found there. This includes the Linux kernel, maybe an initrd file, the /grub directory, and a few other things. The only way that I would know what was needed would be to look at a system running RHEL4.
|
have you tried copying files stage1, stage2 & stage1_5 from /usr/share/grub/i386-pc into /boot/grub/
also cp vmlinuz (kernel binary) from /usr/src/kernel/2.6. . . (if vmlinuz is not there try compiling new kernel) create initrd.img file using mkinitrd command. then do root(hd0,0) find /boot/grub/stage1 (this should be able to find stage1 file) setup(hd0) Note stage1,1_5,2 initrd image, vmlinuz all are needed to boot the system. Quote:
|
can I get the full command for making initrd, I have copied all the files from /usr/share/grub...
|
mkinitrd /boot/initrd-2.2.5-15.img 2.2.5-15
last argument 2.2.5-15 is the name of linux dir /usr/src/kernels/2.2.5-15/ Also have you got your kernel binary. vmlinux. you will also need system.map-2.6.22.9 & config-2.6.22.9 file for your kernel. If you don't have any of these files, then only way is to recompile a new kernel. you can download latest kernel from www.kernel.org and then compile using commands cd /usr/src/kernels/2.6. . .> make mrproper : will remove any previous installation file make defconfig : will create makefile with default configuration make menuconfig: configure any additional options make modules_install: for installing require modules make install : will compile kernel using makefile created by make defconfig & menuconfig commands, will also copy vmlinuz kernel, system.map file, config file into /boot dir. and then create & copy initrd file into /boot. Your system should boot after this. ! ! !. Quote:
|
All times are GMT -5. The time now is 09:28 AM. |