Error 22 when trying to boot winXP

Hello world!
Could you please give me some advice about the following problem?
I’ve got two systems on my laptop, on the same hard disc: winxp and Opensuse 10.3, recently upgraded to 11.0. When I try to boot into windows, Grub returns error 22, and nothing happens :frowning:

I looked into Grub configuration file, but I was afraid to change anything… Here is the contents of it:

  1. menu.lst

Modified by YaST2. Last modification on Sat Aug 9 19:53:17 MSD 2008

default 2
timeout 8

###Don’t change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.0 - 2.6.25.9-0.2
kernel (hd0,4)/boot/vmlinuz-2.6.25.9-0.2-pae root=/dev/sda5 resume=/dev/sda6 splash=silent showopts vga=0x317
initrd (hd0,4)/boot/initrd-2.6.25.9-0.2-pae

###Don’t change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe – openSUSE 11.0 - 2.6.25.9-0.2
kernel (hd0,4)/boot/vmlinuz-2.6.25.9-0.2-pae root=/dev/sda5 showopts ide=nodma apm=off acpi=off noresume nosmp noapic maxcpus=0 edd=off x11failsafe vga=0x317
initrd (hd0,4)/boot/initrd-2.6.25.9-0.2-pae

title openSUSE 11.0 - Vanilla Kernel
kernel (hd0,4)/boot/vmlinuz-2.6.26-vanilla root=/dev/sda5 resume=/dev/sda6 splash=silent showopts vga=0x317
initrd (hd0,4)/boot/initrd-2.6.26-vanilla

title openSUSE 11.0 - 10.3 Kernel
kernel (hd0,4)/boot/vmlinuz-2.6.22.5-31-default root=/dev/sda5 resume=/dev/sda6 splash=silent showopts vga=0x317
initrd (hd0,4)/boot/initrd-2.6.22.5-31-default

###Don’t change this comment - YaST2 identifier: Original name: windows###
title MustDie
rootnoverify (hd1,4)
chainloader (hd0)+1

  1. grub.conf
    setup --stage2=/boot/grub/stage2 (hd0) (hd1,4)
    quit

:rolleyes:

Alina.

If you have only 1 hard disk, why is there a hd1 in this grub entry


###Don't change this comment - YaST2 identifier: Original name: windows###
 title MustDie
 rootnoverify (hd1,4)
 chainloader (hd0)+1

?

Yes, that’s a key question from topak. How do you think it might have happened? Notice also that grub.conf refers to (hd1,4) too.

I suppose you could change the bolded line:

###Don’t change this comment - YaST2 identifier: Original name: windows###
title MustDie
rootnoverify (hd1,4)
chainloader (hd0)+1

to this:
rootnoverify (hd0,1)

But I feel the problem lies in topak’s question and in where the drive was plugged into the computer, or where the bios was pointing for booting, when (a) windows was installed and (b) when Suse was upgraded

And this means that grub was installing to the boot sector of the 5th partition on the second disk.

But in your original post, you mentioned that you had only one hard disk. Where did the second one come from? Please post the output of this command (must run it as root)

fdisk -l

Thank you all for your replies! :slight_smile:

I didn’t intsall or upgrade my system myself, so I am not sure about what happens inside my laptop :stuck_out_tongue: I’m onlystarting to understand how does this software stuff work. But there must be only one hard disk, I don’t see any other around :slight_smile:
So, ‘hd0’ is for first hard disk, and ‘hd1’ is for second?

Here is the output:
fdisk -l

Disk /dev/sda: 40.0 GB, 40007762432 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x87791648

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4223 33921216 7 HPFS/NTFS
/dev/sda2 4224 4864 5148832+ f W95 Ext’d (LBA)
/dev/sda5 4224 4797 4610623+ 83 Linux
/dev/sda6 4798 4864 538146 82 Linux swap / Solaris

P.S. I guess I can change the string referring to Windows in menu.lst file, and it won’t change any Opensuse booting settings? Then I will try to change it and look what happens :wink:

P.P.S. I think I know where the second drive came from. Recently two our computers were broken, and my laptop was the only working machine in our flat. Maybe, my brother checked other hard disk drivesand then forgot to return to initial settings. Now he is away on vacation, so I can’t ask him :frowning: But I am almost sure that is the reason!

OK it’s sda1. So try what I said in post number 3 where you edit menu.lst and put int the corrected line: rootnoverify (hd0,1). If that doesn’t work, mount the ntfs partition in Suse and look at the contents of the file boot.ini (in the root of the ntfs partition) and copy/paste/post the contents here.

When I try to modify menu.lst, it returns following error:
grub> setup --stage2=/boot/grub/stage2 (hd0) (hd1,4)
Checking if “/boot/grub/stage1” exists… yes
Checking if “/boot/grub/stage2” exists… yes
Checking if “/boot/grub/e2fs_stage1_5” exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… failed (this is not fatal)
Running “embed /boot/grub/e2fs_stage1_5 (hd1,4)”… failed (this is not fatal)
Running "install --stage2=/boot/grub/stage2 /boot/grub/stage1 d (hd0) /boot/grub/stage2 p /boot/grub/menu.lst "… failed

Error 21: Selected disk does not exist
grub> quit

boot.ini:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=“Microsoft Windows XP Home Edition RU” /noexecute=optin /fastdetect

Maybe I should edit grub.conf file as well? (there was also something about hd1) Or reinstall Grub? (there was something like ‘start from scratch’ and ‘propose new configuration’ in menu options…) But what if after that nothing would load at all? :frowning:

You edit menu.lst with a text editor, like this in KDE:

kdesu kwrite /boot/grub/menu.lst

or for Gnome like this:

gnomesu gedit /boot/grub/menu.lst

My grub.conf on sda looks like this:

setup --stage2=/boot/grub/stage2 (hd0,1) (hd0,1)
quit

I don’t understand fully what it means, but it makes more sense than yours. My installation root is on sda2 [which in Grub speak is (hd0,1)]. Maybe you could adapt it to a similar one for your partition.

But I think the main thing is to edit menu.lst (in a text editor). It’s not good idea to “start from scratch”. That will leave menu.lst blank. I think it’s for experts. Try what I suggested earlier posts, because boot.ini is expecting it.

No luck… I changed ‘rootnoverify (hd1,4)’ to hd0,1, but in this case GRUB just restarts and brings me back to menu. sniff
Anyway, what should be written in that ‘rootnoverify (hdx,y)’ line? x is number of hard disk drive, and y is name of partition? NTFS partition is called ‘sda1’, and its ID, according to ‘fdisk -l’, is 7. Maybe I should try other numbers? :slight_smile: This all looks very much like some kind of shamanism, I wish I knew a bit more about it…

It [setup --stage2=/boot/grub/stage2 (hd0,1) (hd0,1)]means that stage2 should be installed to the PBR of the first partition on the first disk (first clause), and that that partition is also where the stage2 file should be retrieved from (second clause). The command in the first post above [setup --stage2=/boot/grub/stage2 (hd0) (hd1,4)] means to install stage2 which is located at (hd1,4) into the MBR at (hd0). The first clause disk/partition is the install point, the second is the install source.

@Zqiean -

You need to post back here the contents of /boot/grub/device.map. Open a terminal, su to root and simply do:

cat /boot/grub/device.map

If there was a 2nd disk connected earlier, both disks may be in the device map which can point grub to the wrong (or, non-existent) device.

Anyway, what should be written in that ‘rootnoverify (hdx,y)’ line? x is number of hard disk drive, and y is name of partition? NTFS partition is called ‘sda1’, and its ID, according to ‘fdisk -l’, is 7. Maybe I should try other numbers?

Guessing is only going to get you into a world of hurt. That “7” is a code from the System ID field in the partition table, identifying the particular file system formatted on that partition (in this case, 7 = NTFS). Also note that the (hd0,1) syntax above is enclosed in quotes; precise syntax and spacing is critical. And finally, Grub’s naming convention is the device boot sequence (not the order of disks on the channels in the machine, although they are often the same), where x is the drive beginning with number 0, and y is the partition number from the partition table (which is not always numbered sequentially) also beginning with 0.

Post back that device.map file.

@mingus725: Thanks for that. Does the “grub.conf” get used during the boot process, every time the machine boots, or is it a remnant of an earlier process of the installation?

@Zqiean: I see from your response that I answered somewhat cryptically. This is what I should have said in full:
You should edit this:

###Don’t change this comment - YaST2 identifier: Original name: windows###
title MustDie
rootnoverify (hd1,4)
chainloader (hd0)+1

to be this:

###Don’t change this comment - YaST2 identifier: Original name: windows###
title MustDie
rootnoverify (hd0,1)
chainloader (hd0,1)+1

And also the device.map requested by mingus725 will be a factor too. If it’s zany like the grub.conf, it won’t match in with boot.ini (sounds like Latin, doesn’t it).

Does the “grub.conf” get used during the boot process, every time the machine boots, or is it a remnant of an earlier process of the installation?

It’s a callable stdin for the grub shell, invoked with the install command. In openSUSE, the YaST Boot Loader takes the parameters from the gui entry and constructs the grub.conf. When you click Finish YaST calls the grub shell and feeds it grub.conf. There is no other use for it except for installation from the grub shell.

device.map contains the following string:

(hd1) /dev/sda

As I understood, hd1 is for second HDD. Maybe I should change it to (hd0)?

I edited menu.lst the way you suggested/ Hope thit time it will work :slight_smile:

The installation must have taken place with the drive switched to be the second position, so, yes do make it (hd0)

Thank you all veru much, it worked!
I changed ‘hd1’ to ‘hd0’ in ‘device.map’.
Also in ‘menu.lst’ I changed both ‘hd1,4’ and ‘hd0’ to ‘hd0,0’ (I did it right in GRUB command line. There is an option so that if you press ‘e’ you can edit configuration files just before booting). I thought that if NTFS is on sda1 (first partition), it could be called ‘hd0,0’.

Thank you once more, I’m very glad that I can use my printer again! (it has no drivers for Linux, unfortunately :frowning: )

Wonderful!!!
Just for interest, what’s the printer – must be an unusual one?

You are quite welcome.

@swerdna -

Just a thought . . . I’ve noticed that often when diagnosing a grub boot problem there are several posting iterations before all the data necessary is on the table and the error gets identified. (In this particular thread, device.map isn’t looked at until post #16.) Perhaps as a matter of standard procedure, unless there is something that clearly pinpoints the problem up front, the full set of relevant data should always be requested at the start. I.e., a canned set of data incl the fdisk, device.map, menu.lst, grub.conf, asking which drive was the configured boot drive at install, what’s installed where, etc. Might streamline and shorten the process, help reduce frustration. fwiw.