LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   grub error 2 (https://www.linuxquestions.org/questions/linux-software-2/grub-error-2-a-622077/)

SPF 02-18-2008 03:31 PM

grub error 2
 
Code:

GRUB loading stage1.5



GRUB loading, please wait...
Error 2

Hi, I've been reading through a lot of threads regarding grub error 2. But I'm still unable to find the problem here.

First a bit of information about my system:
Motherboard Asus A7v133 (2-ide, 2-onboard raid)
Jumper settings for RAID: J13 (1-2) J14 (2-3)
( Chapter 3.4 section 5 manual )

I installed Debian 4.0 r2 on /dev/hde1 (swap = /dev/hde2):
Code:

livecd ~ # fdisk -l

Disk /dev/hde: 80.0 GB, 80054059008 bytes
255 heads, 63 sectors/track, 9732 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hde1  *          1        9561    76798701  83  Linux
/dev/hde2            9562        9732    1373557+  82  Linux swap / Solaris

Disk /dev/hdg: 81.9 GB, 81964302336 bytes
16 heads, 63 sectors/track, 158816 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

  Device Boot      Start        End      Blocks  Id  System

As you can see /dev/hdg is not being used, although according to the RAID bios this hard disk is being mirrored.

My menu.lst:

Code:

livecd mnt # mount /dev/hde1 hde/
livecd mnt # cat /mnt/hde/boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default        0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        5

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title        Windows 95/98/NT/2000
# root          (hd0,0)
# makeactive
# chainloader  +1
#
# title        Linux
# root          (hd0,1)
# kernel        /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/hde1 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(single-user) single
# altoptions=(single-user mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title          Debian GNU/Linux, kernel 2.6.18-5-486
root            (hd4,0)
kernel          /boot/vmlinuz-2.6.18-5-486 root=/dev/hde1 ro
initrd          /boot/initrd.img-2.6.18-5-486
savedefault

title          Debian GNU/Linux, kernel 2.6.18-5-486 (single-user mode)
root            (hd4,0)
kernel          /boot/vmlinuz-2.6.18-5-486 root=/dev/hde1 ro single
initrd          /boot/initrd.img-2.6.18-5-486
savedefault

### END DEBIAN AUTOMAGIC KERNELS LIST

By default it was set to (hd0,0). (hd4,0) also doesn't work. I don't have anything on hda b c or d.

When I read several other threads ppl said that you cannot boot from raid or that the driver is missing in the kernel.

Quote:

i have another suggestion, reboot from the live CD and enter a terminal, run sudo grub-install let it run and then try rebooting, it may fix the issue, but then it may not so...
Didn't work.

Also the rescue mode that is on the same debian cd is able to read from the partition. So it is my assumption that the driver is loaded in the kernel.

Code:

Output of grub-install /dev/hde:
...
(hd0) /dev/hde
(hd1) /dev/hdg

With this I conclude why it choose (hd0,0) by default during setup. I also tried changing root=/dev/hde1 into root=/dev/hda1. But also failed.

Quote:

LVM?
Could be a solution. But I want to know the problem here.

bigrigdriver 02-18-2008 03:50 PM

Quote:

Error 2 : Bad file or directory type
This error is returned if a file requested is not a regular file,
but something like a symbolic link, directory, or FIFO.
For more information, including the grub error codes, google up a copy of "Solving Boot Problems with Grub".

Looking at your fdisk and menu.lst, it looks right, but the error leads me to suspect this is wrong:
Code:

title          Debian GNU/Linux, kernel 2.6.18-5-486
root            (hd4,0)
kernel          /boot/vmlinuz-2.6.18-5-486 root=/dev/hde1 ro
initrd          /boot/initrd.img-2.6.18-5-486
savedefault

Grub knows to look in /boot for kernel and initrd images. You don't need to put the leading /boot in there unless /boot is in a seperate partition.

Try this:
Code:

title          Debian GNU/Linux, kernel 2.6.18-5-486
root            (hd4,0)
kernel        (hd4,0)/vmlinuz-2.6.18-5-486 root=/dev/hde1 ro
initrd          (hd4,0)/initrd.img-2.6.18-5-486
savedefault


SPF 02-18-2008 04:41 PM

http://www.gnu.org/software/grub/manual/grub.html

yes, I read about the error 2 there.

The kernel files are located in ./boot on /dev/hde1.

I tried all posibilities of your suggestion, but those didn't work.

Everytime I edit the menu.lst, save and grub-install /dev/hde.

jailbait 02-18-2008 05:18 PM

Quote:

Originally Posted by SPF (Post 3061759)
[CODE]

Motherboard Asus A7v133 (2-ide, 2-onboard raid)

By default it was set to (hd0,0). (hd4,0) also doesn't work. I don't have anything on hda b c or d.

Grub only counts drives that exist, not drive addresses. /dev/hde is the first existing drive so to grub it is device hd0. Grub references the /boot partition as (hd0,0).

With your controller configuration the first device on the raid controller may be /dev/hdc instead of /dev/hde. That would be the case if all four hard drive slots were on the same controller chip.

If the ide controller and the raid controller are separate chips then the first device on the raid chip could be /dev/hde. However secondary IDE controllers (and a raid chip is a somewhat altered IDE chip) are often less than a complete IDE controller. Common missing functions on a secondary IDE controller are CD-ROM support and the ability to boot. Another common failure is that they will work with some brands of hard drives and not others.

I suggest that you physically move your hard drive to /dev/hda and make the appropriate changes to grub and fstab. Then boot to check if things will work OK on the primary controller. If they do then that means that you have a separate raid controller chip and that the raid controller chip doesn't have all possible functions. In that case you might have to do something like put /boot on /dev/hda and the rest of the OS on /dev/hde.

Also you should go through your BIOS and see what configuration settings are available for your IDE and RAID controller(s).

----------------------
Steve Stites

PTrenholme 02-18-2008 07:06 PM

It's fairly easy to hit "e" key when GRUB displays the menu and then use the GRUB editor and tab-completion to find out what GRUB would like to use for the drive and file name entries.

Since changes made with the GRUB editor are only made in memory, you're free to experiment 'till you find out what works.

SPF 02-19-2008 02:17 PM

Quote:

Originally Posted by jailbait (Post 3061855)
Grub only counts drives that exist, not drive addresses. /dev/hde is the first existing drive so to grub it is device hd0. Grub references the /boot partition as (hd0,0).

With your controller configuration the first device on the raid controller may be /dev/hdc instead of /dev/hde. That would be the case if all four hard drive slots were on the same controller chip.

I tried that as well, it didn't work.

Quote:

Originally Posted by jailbait (Post 3061855)
I suggest that you physically move your hard drive to /dev/hda and make the appropriate changes to grub and fstab. Then boot to check if things will work OK on the primary controller. If they do then that means that you have a separate raid controller chip and that the raid controller chip doesn't have all possible functions. In that case you might have to do something like put /boot on /dev/hda and the rest of the OS on /dev/hde.

Before, I had linux running on /dev/hda. And that was working fine.
I can also put /boot and mbr grub on /dev/fd0 or /dev/cdrom or /dev/usb. I don't want to use an entire harddrive for that (although on my old system, I used a very old harddrive and used hdparm to turn off the harddrive after boot).

Quote:

Originally Posted by jailbait (Post 3061855)
Also you should go through your BIOS and see what configuration settings are available for your IDE and RAID controller(s).

When I boot up my normal BIOS I have the following boot settings:
1) cd/dvd (my dvd drive / disabled)
2) ide hard drive (none / disabled)
3) removable device (disabled / floppy / ls-120 / zip / atapi mo / usb fdd / usb zip)
4) other boot device (disabled / onboard ata100 boot device/scsi / int18 device (network)

And a bit further:
SCSI/ATA100 boot sequence

Currently using onboard ata100 boot device/scsi as boot medium.

Quote:

Originally Posted by PTrenholme (Post 3061936)
It's fairly easy to hit "e" key when GRUB displays the menu and then use the GRUB editor and tab-completion to find out what GRUB would like to use for the drive and file name entries.

Since changes made with the GRUB editor are only made in memory, you're free to experiment 'till you find out what works.

In my case, I haven't gotten that far yet. But I know what you mean.

My conclusion is that it isn't possible to boot from raid devices. The drivers you need are in the kernel. But because the raid system is composed of a differend filesystem, grub cannot read the kernel because of that differend filesystem, and that results in grub error 2.

Solution:
Install grub on a filesystem that grub can read, such as a device on hda, b, c or d. A floppy disk, cdrom or usb drive.
These are just examples, there's much more.

What about me? Well, I think I'm going to try md software raid-1 on /dev/hda and /dev/hdc.


All times are GMT -5. The time now is 08:36 PM.