LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-18-2008, 04:31 PM   #1
SPF
Member
 
Registered: Jul 2007
Location: /home
Distribution: Debian
Posts: 37

Rep: Reputation: 15
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.
 
Old 02-18-2008, 04:50 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
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
 
Old 02-18-2008, 05:41 PM   #3
SPF
Member
 
Registered: Jul 2007
Location: /home
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 15
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.
 
Old 02-18-2008, 06:18 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Linux Mint 17, Debian 8
Posts: 7,865

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
Quote:
Originally Posted by SPF View Post
[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

Last edited by jailbait; 02-18-2008 at 06:20 PM.
 
Old 02-18-2008, 08:06 PM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
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.
 
Old 02-19-2008, 03:17 PM   #6
SPF
Member
 
Registered: Jul 2007
Location: /home
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jailbait View Post
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 View Post
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 View Post
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 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sofware RAID 1 + Fedora Core 3 + Boot Error L1 + GRUB 21 ERROR najeebsyed2 Linux - Hardware 0 10-25-2007 02:20 PM
Grub error 17, and wont reinstall using grub-install! chiefreborn Linux - General 6 06-06-2007 11:29 AM
Error Grub stage2 loading error (using FC6) on seperate hdd Anifield Linux - Newbie 7 03-20-2007 02:14 PM
Grub Error 17: Cannot mount selected partition and other Grub problems Sebastian Naitsabes Linux - General 1 07-05-2005 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration