Jump to content

GRUB error 22 in mdv2007.1


pmpatrick
 Share

Recommended Posts

Just installed mdv2007.1("Spring Edition) on my test partition and in general. I am favorably impressed. As some of you may know, mandriva has moved away from lilo in mdv2007.1 and is now using grub for the default bootloader.

Although I've used lilo for over seven years and am familiar with it, I decided to take the plunge and give grub a try. Big mistake. On reboot after installation, I wound up with an error 22 message and a blinking cursor. Couldn't even get to a grub prompt to see what was going on. Wound up restoring my lilo from my mdv2007 install and creating an entry for mdv2007.1 there. Rebooted into mdv2007.1 without a problem but decided to investigate what went wrong with grub. Thought I'd pass along what I found as I've encountered the identical problem in debian based sidux.

 

This is a problem you may encounter if you have both pata and sata drives in your system and use grub. It is a problem with grub and not mandriva as the same problem has been reported on ubuntu:

 

https://bugs.launchpad.net/ubuntu/+source/grub/+bug/8497

 

and mepis:

 

http://www.mepis.org/node/12536

 

And I've seen the same thing on sidux.

 

Essentially, the problem arises from grub's attempt to identify and label the bootable hard drives on your system. When you have both sata and pata drives, this identification occurs differently at boot time than after the kernel is loaded. To illustrate, I have two pata hard drives on hde and hdg and two sata drives on sda and sdb. mdv2007.1 is installed sda12. During installation, grub designated sda as hd2 with root at (hd2,11) and that was reflected in menu.lst. I confirmed this again after I rebooted by running:

 

# grub

grub> find /boot/grub/stage1

 

and sure enough, it came back with (hd2,11).

 

I reinstalled grub but made a grub boot floppy so I could investigate things if I got another error 22. Sure enough, that's exactly what happened, error 22. Rebooted with the grub floppy I made and ran from the grub prompt:

 

grub> find /boot/grub/stage1

 

but this time it came back with (hd1,11). That, in a nutshell is the problem.

 

I believe, I found the source of the problem as well. By checking device.map, it is clear that with kernel loaded which is the state the system is in when grub is installed during the installation, the hard drives are enumerated as follows:

 

(hd0) /dev/hde

(hd1) /dev/hdg

(hd2) /dev/sda

(hd3) /dev/sdb

 

In short, the pata drives come first followed by the sata drives. However, at boot, the bios setup seems to control this enumeration. In my bios setup, I had the boot order for the hard drives set as follows:

 

hde

sda

hdg

sdb

 

and using my grub boot floppy, I confirmed that the enumeration from the floppy grub prompt was:

 

(hd0) /dev/hde

(hd1) /dev/sda

(hd2) /dev/hdg

(hd3) /dev/sdb

 

I could boot from the grub floppy with:

 

> root (hd1,11)

> kernel (hd1,11)/boot/vmlinuz root=sda12

> initrd (hd1,11)/boot/initrd.img

> boot

 

But running grub from a console after booting gave:

 

grub> find /boot/grub/stage1

(hd2,11)

 

I went back and changed the boot order in my bios setup to:

 

hde

hdg

sda

sdb

 

and booted with the grub floppy. Then the enumeration changed in line with mdv2007.1:

 

(hd0) /dev/hde

(hd1) /dev/hdg

(hd2) /dev/sda

(hd3) /dev/sdb

 

I booted back into mdv2007.1 reinstalled grub and rebooted. It finally worked.

 

The moral of the story, if you have both pata and sata drives and get an error 22 with grub, get ready to spend several hours playing with your new and improved Grand Unified Boot Loader. :wall: :blink: :furious3::furious3:

 

[moved from software - arctic]

Link to comment
Share on other sites

The install is fine. It was just a boot loader problem with grub and it will only occur with certain hard drive configurations I suspect. I had grub installed on my first pata drive, hde and mdv2007.1 installed on my first sata drive on sda12.

I have another pata drive on hdg and a second sata data drive on sdb.

 

I suspect that grub tends to give the drive whose mbr it's installed on the designation hd0 so hde was hd0 in all conditions. At boot time it must have looked to the bios setup hard drive boot sequence and doled out the hdx numbers to the other drives based on their bios boot order. That information is apparently lost or inaccessible after the kernel loads and if you do any grub operations then, the hdx numbers are assigned differently. That's clearly the source of the problem.

 

You are looking at a situation where you have multiple hard drives, some pata and some sata. That's where the problem is likely to occur.

Edited by pmpatrick
Link to comment
Share on other sites

I have used (now removed in readiness for the Official Release) 2007-1rc2 and never ever had any trouble with Grub.

I don't have any ide HDDs only the two DVDburners are on ide. I am using two SATA II HDDS.

I think the problem may actually arise from Bios setup. Some ( maybe most, I don't know) allow you to set up so that you can choose to select SATA as the booting preferred Hard drive and maybe yours was still set to ide.

I have found a number of users who had newly installed SATAs had failed to look in their bios to see if maybe they needed to change the setup and wondered why they had problems. When the bios was appropiately reset then "magically" all was well. I am not saying the present situation is necessarily the case since I am just thinking out loud.

 

Cheers. John.

Edited by AussieJohn
Link to comment
Share on other sites

Cannot help, as my only Mandriva 2007.1 is set on a vmware virtual machine, and not on real hardware. It works much better than expected, but...

You could (after installing the system) booting from the installation CD, chrooting to the installation partition, an doing

grub-install /dev/sda

(or whatever disk you want grub installed).

Edited by scarecrow
Link to comment
Share on other sites

  • 2 months later...
Guest dusanmal

:D Thanks pmpatrick!

 

Your explanation solved my "head-banging" on very similar issue. For any other users who come to this topic,

if you get grub error 22 or grub error that it "cant find file" or even that the partition is in the wrong format,

this may apply to you. Also, you don't need to have pata/sata combination. As long as you have more than 1 HD,

this can happen. Also on other Linux distro's (my problem was on SUSE 10.1).

 

Key info that have helped me is that on boot, GRUB treats HD on which it is installed as hd0. Other HD's you have

will be given order as in the BIOS boot list, NOT by the IDE channel or anything else. Finally, and most confusing (as to why?)

once you do boot and you are in the OS, GRUB goes back to the standard mapping we expect, ex. hda == hd0, hdb == hd1,...

Hence, although you ex. install GRUB on hd2, if it is first HD BIOS will boot, in the menu.lst or grub.conf you referre to it as hd0.

 

I haven't find this mentioned anywhere else, so thanks to googling and pmpatrick! (Or I'd go crazy, because without knowing this

tidbit, you might beleive your setup is exactly correct, yet things go bad...).

Link to comment
Share on other sites

  • 4 months later...

To everyone that is not really a Linux guru, like me ;) I'm posting this to let you know how I solved this error 22 issue.

 

I tired the solution posted by pmpatrick, but it was very difficult to me.

I have the following disks setup:

 

disc 1: windows(C:) windows (D:)

disc 2: windows (E:) linux (/) linux (SWAP) linux (/home)

 

Next I tried to see if it was a BIOS problem. I found on my BIOS a "Configure drives as: [iDE | RAID | AHCI] I chose IDE and didn't work.

 

Finally I installed PartitionMagic and ran it on WindowZZZ and made the disks setup as follows:

 

disc 1: windows(C:) windows (D:) linux (/boot)

disc 2: windows (E:) linux (/) linux (SWAP) linux (/home)

 

and it worked.

 

So if you are having the grub error 22 problem you can try creating a /boot partition ON THE FIRST DRIVE of your computer

 

I really don't know if mine was a strike of luck, but it worked.

 

Hope this is helpful to somebody.

 

Balpo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...