Operating System - Linux
1752480 Members
5679 Online
108788 Solutions
New Discussion юеВ

Re: how can repair grub.conf?

 
Beginner_2
Occasional Advisor

how can repair grub.conf?

in rhel5, how can we repair or change grub.conf as we will not be able to boot without repairing that ?we cant even boot in single user mode..help.....?
8 REPLIES 8
Matti_Kurkela
Honored Contributor

Re: how can repair grub.conf?

Insert the installation CD/DVD, boot from it and type "linux rescue" to the syslinux boot prompt.

The rescue environment will search for your existing RHEL installation. If it can be found (i.e. not too badly damaged), it will automatically mount it to /mnt/sysimage. You can then go to /mnt/sysimage/boot/grub directory (= the real /boot/grub when the system is running normally) and fix your grub.conf.

If you run "chroot /mnt/sysimage" your rescue session's root directory will be switched to the installation's root directory (e.g. /mnt/sysimage/boot/grub becomes simply /boot/grub), so all the tools of your RHEL5 installation will work more or less normally.

The RHEL5 Installation Guide has more information about the rescue mode:

https://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.5/html/Installation_Guide/pt-rescue-mode.html

MK
MK
Beginner_2
Occasional Advisor

Re: how can repair grub.conf?

it was really gud explanation . i understood first part but didn't fully understood chroot part . could u pls elaborate it a bit more.
Matti_Kurkela
Honored Contributor

Re: how can repair grub.conf?

It's kind of hard to explain simply. Try it and see what happens:

- boot into rescue environment

- run "ls /etc", you see the very limited /etc directory of the rescue environment

- run "ls /mnt/sysimage/etc", you see the complete /etc directory of your RHEL5 installation

- now run "chroot /mnt/sysimage"

- run "ls /etc" again: now it's the complete one! Now the system looks just like it does when running normally.

- run "ls /mnt/sysimage": you find it does not seem to exist.

- run "exit" to return to non-chrooted rescue environment

- running "exit" a second time will exit the rescue environment and cause the system to reboot.

MK
MK
Ralph Grothe
Honored Contributor

Re: how can repair grub.conf?

> - boot into rescue environment

Maybe you should mention here to type
"linux rescue" and hit Enter at the CD's boot prompt.
Madness, thy name is system administration
Steven E. Protter
Exalted Contributor

Re: how can repair grub.conf?

Shalom,

Linux rescue, as noted above should do the trick.

If there is real damage to your system, you may need to install an OS to a secondary disk, as I once had to do to recover a system.

grub contains all the commands needed to fix the issue.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Gerardo Arceri
Trusted Contributor

Re: how can repair grub.conf?

Do you need to re-install grub to your MBR?
if so,
Boot up with a rescue cdrom/usb.
Assuming that hda is the active boot disk and that /boot is on the first partition, you need to:
rescue# grub
grub>root(hd0,0)
grub>setup(hd0)

That should reinstall grub and fix your MBR problems.
Let me know if it works, and don't forget about assigning points.!

Beginner_2
Occasional Advisor

Re: how can repair grub.conf?

thanks a lot for all replies but what i understood is when we do chroot /mnt/sysimage , our already installed faulty root filesystem on disk gets ignored and the fresh reliable root filesystem gets mounted in root partition so that we can carry out repairing on our faulty filesystem?
i understoot what to do but didn't understand how it happens?
Gerardo Arceri
Trusted Contributor

Re: how can repair grub.conf?

You should not need to chroot, can you tell me if /boot is a separate filesystem or is it part of / ?