Solved

Re-establish GRUB bootloader

Posted on 2004-04-23
8
385 Views
Last Modified: 2010-04-20
Somehow GRUB was giving me a Hard Disk Error when I tried to boot up.
I've used the rescue option of the install disk get into the system.
It appears all the files are there under a /mnt/sysimage.  Is there a
command I can use to get things back as they were on the hard disk so
I can just boot up?
0
Comment
Question by:xoxomos
  • 4
  • 4
8 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 10904882
From a rescue boot you'd need to execute:

chroot /mnt/sysimage
grub-install /dev/hda

replacing hda by whatever the disk device is (hda, hdb, sda, etc). You can see that from a 'df' in resuce mode.
0
 

Author Comment

by:xoxomos
ID: 10905235
Could you make that a bit more idiot-proof?
When I do df
/dev/root         5900       3506       2094     63%     /
/tmp/cdrom        660480     660480     0        100%    /mnt/source
/tmp/hda6         381139     34146      127315   65%     /mnt/sysimage
/tmp/hda1         46636      8998       35230    20%     /mnt/sysimage/boot
/tmp/hda5         17686464   10264360   6541672  61%     /mnt/sysimage/usr
/tmp/hda2         39697740   27130184   10551000 72%     /mnt/sysimage/usr
/tmp/hda7         256667     35490      207925   15%     /mnt/sysimage/var
/tmp/hda2         39697740   27130184   10551000 72%     /mount-hard-drive

The /mount-hard-drive is a directory I just made and mounted /dev/hda2 on it.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10905387
Your boot disk is /dev/hda
0
 

Author Comment

by:xoxomos
ID: 10905929
It looks like grub-install calls grub, but can't find it even though it's in the very same directory.
Error message just comes back 'grub not found'
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 40

Accepted Solution

by:
jlevie earned 300 total points
ID: 10906182
Did you execute 'chroot /mnt/sysimage' before executing grub-install? The grub-install command is simply a shell script that invokes /sbin/grub. Unless your system has been damaged in some manner such that the grub binary can't run or that the shared libs it uses needs aren't available grub-install should work. You can find out if that's the case by:

chroot /mnt/sysimage
/sbin/grub

That will start grub in interactive mode. If that fails it should emit an error message indicating what the problem is.
0
 

Author Comment

by:xoxomos
ID: 10906414
ok.  noi did not.  it'll have to wait till tomorrow
0
 
LVL 40

Expert Comment

by:jlevie
ID: 10907658
It is necessary to execute the chroot first so that grub-install will execute from your system image and not from the rescue envirormnet. Not doing so could be a good reason why it didn't work.
0
 

Author Comment

by:xoxomos
ID: 10909518
Mil gracias!!!!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem logging tar errors 11 35
LINUX, CPANEL & WHM 5 23
My bash alias isn't executing 5 32
Linux as a middle box 7 28
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now