LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Grub error 22 (https://www.linuxquestions.org/questions/linux-newbie-8/grub-error-22-a-719175/)

Radikll 04-14-2009 11:45 PM

Grub error 22
 
Hi, I'm not new to linux, but I'm having a problem with grub. I'm trying to setup a multi-boot between Ubuntu, Windows 7, and 6 other operating systems I haven't installed yet. I'm using an old version of Kanotix. I used System rescue 1.1.6 to set up the boot drive.

I'm trying to make sdb12 my boot partition. It boots into grub, but when I try to boot from any of the options on the menu it gives me grub error 22. It's kinda weired, I think my bios boot order effects the hard number. I have an old IDE drive, it had openSolaris on it. I think openSolaris wanted to be free because the boot order keeps changing so the IDE drive boots 1st. I reformated the old 20gb drive because it was getting annoying.

This is what I did to set up sdb12.

1) formated 1024kb to Ext3

2) copied /boot/grub from ubuntu to /mnt/sdb12

3) changed the menu.lst file in /mnt/sdb12/grub

4) used the following commands:

Code:

grub
grub> root (hd1,11)
grub> setup (hd1,11)

Here's the partition info:
Code:

Kanotix:/# fdisk -l

Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1      68368  549165928+  5  Extended
/dev/sda2          68369      77968    77112000    7  HPFS/NTFS
/dev/sda3          77969      182401  838858072+  83  Linux
/dev/sda5            1176      10774    77103936  83  Linux
/dev/sda6          10775      20373    77103936  83  Linux
/dev/sda7          20374      29972    77103936  83  Linux
/dev/sda8          29973      39571    77103936  83  Linux
/dev/sda9          39572      49170    77103936  83  Linux
/dev/sda10          49171      58769    77103936  83  Linux
/dev/sda11          58770      68368    77103936  83  Linux
/dev/sda12  *          1        131    1052163  83  Linux
/dev/sda13            132        1175    8385898+  82  Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 20.0 GB, 20000000000 bytes
255 heads, 63 sectors/track, 2431 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb4  *          1          1          0    0  Empty
Partition 4 does not end on cylinder boundary.

Here's the menu.lst file from grub:
Code:

title                Ubuntu jaunty 9.04 (beth)
root        (hd1,5)
chainloader        +1

title                Winblows 7
root        (hd1,1)
chainloader        +1

title                UNUSED
root

title          sdb5
rootnoverify    (hd1,4)
savedefault
makeactive
chainloader    +1

title          sdb7
rootnoverify    (hd1,6)
savedefault
makeactive
chainloader    +1

title          sdb8
rootnoverify    (hd1,7)
savedefault
makeactive
chainloader    +1

title          sdb9
rootnoverify    (hd1,8)
savedefault
makeactive
chainloader    +1

title          sdb10
rootnoverify    (hd1,9)
savedefault
makeactive
chainloader    +1

title          sdb11
rootnoverify    (hd1,10)
savedefault
makeactive
chainloader    +1


Junior Hacker 04-15-2009 05:23 PM

It appears you installed grub to the MBR of the 20GB drive, which is the second drive /dev/sdb. This must also be the drive set to boot first in the bios. In grub language this is (hd1).
All your operating system partitions are on the first drive /dev/sda, or (hd0).
Change the root to (hd0,x) in all entries. Although it is not imperative, you may also want to change the title to reflect the same, ex: sda8 instead of sdb8.

According to the grub manual, error 22 is produced when the partition does not exist.

Junior Hacker 04-15-2009 05:27 PM

I take it you created an extended partition first, then Windows 7 (/dev/sda2) and one Linux (/dev/sda3) are in primary partitions.

Keep in mind, the first partition is the fastest partition due to zoned bit recording. If you use swap allot due to small amount of RAM memory, then it is good to have it near the beginning of the drive as you now have it. But for performance reasons, you may want to consider putting your favorite, most used OS towards the beginning also. If it is Linux, use /dev/sda5 for your fave.

EDIT:
Take a look at "The mother of all booting schemes - Grub in a data-only partition" in this thread for setting up the grub partition.

Radikll 04-16-2009 03:26 AM

I fixed error 22 and I can now boot into Windows 7, but I still can't boot into Ubuntu. I get error 13 now.

Code:

Error 13: Invalid or unsupported executable format
I'm not really sure what it means, but at least I can boot into windows. It only happens when I try to boot into Ubuntu or one of the blank drives.

ps
I formatted my drive with gparted; for some reason it messed up the partition names.

This is how it's really organized (according to Gparted):
Code:

/dev/sda1              1      68368  549165928+  5  Extended
/dev/sda12  *          1        131    1052163  83  Linux
/dev/sda13            132        1175    8385898+  82  Linux swap / Solaris
/dev/sda5            1176      10774    77103936  83  Linux
/dev/sda6          10775      20373    77103936  83  Linux
/dev/sda7          20374      29972    77103936  83  Linux
/dev/sda8          29973      39571    77103936  83  Linux
/dev/sda9          39572      49170    77103936  83  Linux
/dev/sda10          49171      58769    77103936  83  Linux
/dev/sda11          58770      68368    77103936  83  Linux
/dev/sda2          68369      77968    77112000    7  HPFS/NTFS
/dev/sda3          77969      182401  838858072+  83  Linux

Windows deleted all my partitions (except swap) when I tried to put it in my extended partition. So, I had to give it's own primary partition. The sda3 is going to be my main storage drive once I can figure out how to encrypt it. Right now sda3 is formatted in Ext4, but I think I'm going to use truecrypt to format it to encrypted Ext2, Ext3, or NTFS(maybe). I plan on using symlinks to link directories in sda3 to directories in my /home.
If you guys know of any other encryption programs that will work on Windows and Linux, tell me.

widget 04-16-2009 01:03 PM

You are booting from /dev/sda12 [in grub this will be (hd0,11).

Boot to a LiveCD and pull up the terminal and as root;
Code:

sudo (or whatever to get root status)grub
grub find /boot/grub/stage1

this will give you a list of where there is a grub boot. From your info above it should be;
Code:

(hd0,2)
(hd0,4)
(hd0,5)
(hd0,6)
(hd0,7)
(hd0,8)
(hd0,9)
(hd0,10)
(hd0,11)

seeing how you want to be able to get to sda3 - pick (hd0,2) for;
Code:

grub root (hd0,2)
grub setup (hd0)
grub quit

If this lets you boot to there you can edit (with gedit, kate, krite, vi, vim - some text editer) your /boot/grub/menu.lst to have all the others listed.

Usually the last OS that you install has that menu.lst to include all OSs. You could just try installing some more and seeing what happens. If you have problems try the grub stuff above using the partition for the last installed for root and setup. Should work.

HAVE FUN


All times are GMT -5. The time now is 09:49 AM.