Solved

grub loading "error 15"

Posted on 2009-07-08
5
1,666 Views
Last Modified: 2013-12-15
I've linux box that won't boot, after POST I get a "grub loading..." then a "error 15". That's it, it hangs at that point. The server is a Dell PE with a SATA/RAID controller.

I'm a linux novice and don't know the first place to begin in trouble shooting this. I'm also not familiar with this install, except that it's running as a VMWare host for guests that are hosting several web sites.

Where do I start?
0
Comment
Question by:Jason Wilcox
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:Daniel McAllister
ID: 24809560
Your GRUB error is simply that it's not finding a bootloader where it was told it could find one...

The SIMPLE reason may simply be that hard drives have become re-ordered and what was once /dev/sda is now /dev/sdb or some such.

But there MAY be a more difficult problem -- it is possible that your Linux kernel has been deleted... but let' not go there just yet.

The easiest way to recover is to follow the steps below:

 1) Boot from an installation disk -- it doesn't matter if it's the same version OS as your server is running, so long as the kernel family is the same. I just repaired a GRUB error on a Fedora Core 5 system using a Centos 5.3 install dvd!

 2) "Pretend" you're going to install a new system (that is, just press enter at the boot screen) -- and step through everything (SKIP any CD or DVD media check -- you won't be using it anyway!) UP TO the point where is searches for old installations -- AT THIS POINT, you have a kernel loaded that has scanned your IDE and SATA ports for hard drives and loaded drivers for them (so the /dev/hd* and /dev/sd* entries are there)... so now, all you have to do is get into them!

3) Press CONTROL-ALT-F2 -- which should get you a SHELL prompt...

4) Make sure you know which drive has your system... I usually do something like:
  cd /dev
  for i in sd?1 ; do e2label $i ; done

Which will show you the FileSystem Label (assuming you're using ext2 or ext3 filesystems -- which you SHOULD on boot partitions)

Let's assume that you find your ROOT partition at sda1 (likely, but not required)

5) Now let's mount that drive
   mkdir /mnt/rescue
   mount /dev/sda1 /mnt/rescue

6) If it reports an error, you MAY need to check the filesystem
   umount /mnt/rescue
   fsck -f /dev/sda1 (NOTE: you may want to run fsck with the -C option as well, so see the progression/status)

Then go back and re-mount it (DO NOT run FSCK on a mounted filesystem -- even a ROOT filesystem if you can help it!)
   mount /dev/sda1 /mnt/rescue

7) Here's the "tricky" part -- we're going to tell Linux to CHANGE the location of the kernel's root drive!
   chroot /mnt/rescue

You'll get a new prompt, and your PWD is now / (which is REALLY /mnt/rescue). Now you'll need to be careful, as no startup scripts have been run!

8) Now, all we need to do is re-install the GRUB boot block --
    cd /sbin
    ./grub-install --recheck /dev/sda   (NOTE: note that's /dev/sda, NOT /dev/sda1 !!!)

If GRUB comes back and tells you where fd0 and hd0 (and so forth) are located, you're in good shape!
If GRUB comes back with an error, well post your results here and we'll go from there

BUT -- assuming no error, you've just re-written your boot block and told GRUB how to access your root partition again. You can now reboot off your hard drive again.

HOWEVER: If you've made hardware changes, you MAY need to change your grub.conf file... if so, DO THIS BEFORE REBOOTING:
  cd /boot/grub
  vi grub.conf

The GOOD news is that changing the grub.conf file DOES NOT require you to re-run the grub-install program!

Best of luck!

Dan
IT4SOHO
0
 
LVL 3

Author Comment

by:Jason Wilcox
ID: 24816333
Excellent post Dan, very detailed.

I'm making some progress, Im at the point where I want to chroot to /mnt/rescue. Unfortunately I'm getting an error;
- entering the command '/dev$ chroot /mnt/rescue' gets me the following result "chroot: cannot change root directory to /mnt/rescue: operation not permitted"
- entering the command 'dev$ sudo chroot /mnt/rescue' gets me the following result "chroot: cannot run command '/bin/bash': no such file or directory".

How I got to this point, booted off a Ubuntu 9.04 CD (kernel 2.6.28). I was nervous running through the install when I got to the partition setup, CTRL-ALT-F2 wasn't getting me to a SHELL. So I booted into the "Try Ubuntu&" menu selection and opened a Terminal from the GUI.

Thoughts?
0
 
LVL 3

Author Comment

by:Jason Wilcox
ID: 24818705
I figured out my error was due to several folders missing from /dev/sda1. I copied /lib, /bin and /sbin to /mnt/rescue. Then I was able to do a chroot /mnt/rescue.

Next I tried the ./grub-install --recheck /dev/sda and got the following error; "your /usr is broken; please fix it before calling this wrapper!"
0
 
LVL 20

Accepted Solution

by:
Daniel McAllister earned 500 total points
ID: 24824068
Check your /etc/fstab file -- are you mounting /usr from another partition?

If you originally installed your Linux with an old *NIX admin guide, it probably told you to create separate partitions for /usr, /var, /tmp, and others... Linux does not expect this, and if this is the case, then BEFORE you chroot to /mnt/rescue, you'll need to mount your /usr filesystem to the proper location.

For grins, I'll assume /usr is on /dev/sda5 (probably wrong, but you'll get the idea) -- you should be able to get the actual partition from the /etc/fstab file, or you may have to do some exploring with the e2label program to find the partition with the correct label for your /usr partition.

In my instructions above, just after steps 5 & 6 (where you mount your / partition), mount your /usr partition -- but remember that your "real" root partition is mounted on /mnt/rescue, so to put it in its proper place, you need to mount it to /mnt/rescue/usr!

So insert a Step 6.5:
  mount /dev/sda5 /mnt/rescue/usr

Then proceed to Step 7 (chroot to /mnt/rescue and run the grub-install)




If, however, you do NOT have a separate /usr partition (or drive), then you're looking at having to restore it -- hope you have a backup, otherwise you'll probably prefer to simply do a new install on a different drive, then copy your important files (including config files) over from the "bad" one.

Good Luck!

Dan
IT4SOHO
0
 
LVL 3

Author Closing Comment

by:Jason Wilcox
ID: 31601339
Gave up on this thing, appeared to be missing files and it was a losing proposition when considering my time. I've restored the data from a backup. Thanks for your help Dan!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

12 Experts available now in Live!

Get 1:1 Help Now