LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-19-2009, 10:15 AM   #1
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Rep: Reputation: 0
grub doesn't recognise logical partition until Ubuntu Hardy Heron boots up


I'm hoping this is an obvious question and that I'm not understanding something very basic!

I have 2 HDs. The first HD has a Windows install. The 2nd has a ubuntu 8.04.

The MBR of the first HD has a grub install. The actual grub menu.lst files etc. are on the 2nd HD

This all worked fine until I tried to install Ubuntu 9.04. (I know I should have upgraded through System -> Administration -> Software Sources instead of using a live CD - my mistake)

The installer created an extended partition on the 2nd HD for Ubuntu 9.04 and its swap space, and modified the MBR to point to grub files on a logical partition.

This gave me grub error 5 as stage 1.5. I was able to recover by reverting to the previous grub install.

I then tried to add 9.04 to the bottom of the grub menu, but it still gives me grub error 5

Basically, it seems that grub cannot recognise the logical partition until I boot the previous ubuntu install (8.04).

If I go to the grub command line from the grub menu (ie. on startup) only the first partition is available on the 2nd HD. However, if I boot up hardy and kick off grub from the command line, it recognises the logical partition(s).

I realise I could probably just remove the extended partition and start again, but I want to understand why I'm seeing the behaviour that I am, and am hoping that someone can explain this to me.

Thanks!
 
Old 05-19-2009, 12:07 PM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I for one cannot understand your problem.

If you say Grub doesn't recognise logical partitions you have to prove it with error message and post your information here.

Grub can see more logical partition than many parts of the kernel can!

As an example I have a disk with 130 partitions out of which 126 of them are logical. Fdisk can only display 60. cfdisk can be used to create up to 64 partitions. My 130 partitions were created by a script with sfdisk. Gparted is the only tool I know that can cross the 130 partitions barrier to create more.

Grub can see all of them and more importantly fire up any system in any of these logical partitions.

When I check the Grub manual Error 5 is "Partition Table invalid or corrupt". That means you may have inadvertently damaged the partition table of one of the disks. This should show up in Ubuntu terminal command
Code:
sudo fdisk -l
 
Old 05-19-2009, 01:19 PM   #3
NeddySeagoon
Gentoo support team
 
Registered: May 2009
Location: 56N 3W
Distribution: Gentoo
Posts: 178

Rep: Reputation: 40
wreckgar23,

Grub is claiming (from info grub)
Code:
5 : Partition table invalid or corrupt
     This error is returned if the sanity checks on the integrity of the
     partition table fail. This is a bad sign.
What does
Code:
fdisk -l
show ?

I presume you are using MSDOS Partition Tables?
If you have swapped to GPT (unlikely), I don't know if grub supports that yet.

Does your three parts of grub have different versions?
Thats known to cause issues from time to time.
 
Old 05-19-2009, 03:43 PM   #4
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks for the responses.

To hopefully clarify this:

From the grub menu on bootup, if I enter the grub command line and type the following...

root (hd1,[tab key]

... it is auto-completed as

root (hd1,0)

However, if I load up Hardy Heron and invoke grub from the terminal and do the same, I get the following

Possible partitions are:
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type is ext2fs, partition type 0x83
Partition num: 5, Filesystem type unknown, partition type 0x82
Partition num: 6, Filesystem type unknown, partition type 0x82

So my question is why is there this different behaviour?

btw here is the output of fdisk -l

Disk /dev/sda: 123.5 GB, 123522416640 bytes
255 heads, 63 sectors/track, 15017 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe63f1ecc

Device Boot Start End Blocks Id System
/dev/sda1 * 1 15016 120615988+ 7 HPFS/NTFS

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000875aa

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 38399 308439936 83 Linux
/dev/sdb2 38400 38913 4128705 5 Extended
/dev/sdb5 38400 38703 2441817 83 Linux
/dev/sdb6 38704 38725 176683+ 82 Linux swap / Solaris
/dev/sdb7 38726 38913 1510078+ 82 Linux swap / Solaris
 
Old 05-19-2009, 03:57 PM   #5
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
In answer to NeddySeagoon

Ubuntu 8.04 uses grub 0.97-29ubuntu21
Ubuntu 9.04 uses grub 0.97-29ubuntu53

It is the 9.04 installer that has created the extended partition and its logical partitions. It also gave me grub error 5 at stage 1.5 when I rebooted!

I had to revert to the 8.04 install's grub to recover. I can access the logical partition from ubuntu 8.04. But trying to modify 8.04's grub menu so that it loads 9.04 doesn't work for me. I get the grub error 5 whenever I try to refer to it. It doesn't seem like there is a problem with the partition table - maybe you can see one from the output of fdisk?
 
Old 05-19-2009, 05:11 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,206

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Let me guess - one IDE disk and one S-ATA disk ???
 
Old 05-19-2009, 05:34 PM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Have you tried the command to display all the partition of the 1st disk by
Code:
geometry (hd0)
for the 2nd disk
Code:
geometry (hd1)
I couldn't see anything wrong with the partition table myself.

It is impossible to tell the difference here as potentially there are two Linux, in sdb1 and sdb5 respectively so there are two versions of Grub implementation of "Grub shell". The Grub in the MBR was sourced from one of the Linux to provide a Grub prompt which is a stripped version of a Grub shell. The former does not have access to a kernel (as none has been booted) while the latter has. Therefore it is pointless to expect them behave identically.

Last edited by saikee; 05-19-2009 at 05:48 PM.
 
Old 05-20-2009, 05:00 AM   #8
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks again for all the responses

It's clear from saikee's original response that grub should have no problem recognising logical partitions. In my case it does, but these are partitions created by the Ubuntu 9.04 installer.

I was puzzled by the different behaviour of grub depending upon whether its invoked from the bootup menu or from the terminal, but I realise now I'm assuming that I'm using the same grub in both cases, which probably isn't true. Not all the same commands aren't available, for example.

It's not true however to say that I'm using the grub from 2 different "Linux" however - the one on the bootup menu and the one from the terminal are both from 8.04

Both hard drives are IDE. I don't have the geometry command available on the command-line or in the synaptic package manager

I think that I have to take grubs word for it at bootup that the partition table is invalid or corrupt. I'll see if there is a known defect in the 9.04 installer
 
Old 05-20-2009, 05:13 AM   #9
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
The command
Code:
geometry (hd0)
is a Grub command available in any Grub prompt. You will see it as part of the command set if you type "help" at the Grub prompt.

That is a very useful command because that is exactly what Grub sees in the first bootable disk. In other word you get the word directly from the horse's mouth!

If you have installed Ubuntu 8.04 twice then the two Grub are the same but the version before and after the Linux has been boot is different.

As a simple example and you can try it any time.

If you are booting to an internal hard disk and has a USB disk (pen drive or external hard disk) Grub will not be able to see it in a Grub prompt before a Linux has been booted. Grub can only see one "USB" device if you force the Bios to boot to that USB device.

However after the Linux has been booted Grub can see all the disks.

The above shows Grub is different before and after a Linux has been booted. In the former the hardware information is supplied by the Bios whereas in the latter Grub gets it from the kernel.

Last edited by saikee; 05-20-2009 at 05:22 AM.
 
Old 05-20-2009, 05:27 AM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,206

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Quote:
Originally Posted by wreckgar23 View Post
It's clear from saikee's original response that grub should have no problem recognising logical partitions. In my case it does, but these are partitions created by the Ubuntu 9.04 installer.
...
It's not true however to say that I'm using the grub from 2 different "Linux" however - the one on the bootup menu and the one from the terminal are both from 8.04
Ahhh - I hadn't read this closely enough before.
Are the Jaunty (9.04) partitions ext3 (or ext4) ?. If so, they will have been created with the larger inode - you'll (probably) need the grub from Jaunty that has been patched to recognise this.
I bumped into this with Fedora 10 - Intrepid grub couldn't handle it, but Fedora had a patched grub.

Last edited by syg00; 05-20-2009 at 05:28 AM.
 
Old 05-20-2009, 05:30 AM   #11
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
From the terminal

Code:
grub> geometry (hd1)
drive 0x81: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sdb
   Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 4,  Filesystem type is ext2fs, partition type 0x83
   Partition num: 5,  Filesystem type unknown, partition type 0x82
   Partition num: 6,  Filesystem type unknown, partition type 0x82
From the bootup menu

Code:
grub> geometry (hd1)
   drive 0x81: C/H/S = 1024/255/63, The number of sectors = 625142448, LBA
Partition num: 0,  Filesystem type is ext2fs, partition type 0x83
I've marked the differences, but don't know what they mean yet!
 
Old 05-20-2009, 05:50 AM   #12
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks syg00. I wonder if I end up with a chicken-and-egg type situation here though. Jaunty was installed to the logical partition that its installer created. I had to revert to Hardy's grub because I would get grub error 5 at stage 1.5, which is the same behaviour I get now if I try to load Jaunty from the boot menu ie. the logical partition it resides on can't be recognised at bootup.

I'm assuming that the Jaunty installer has given me a version of grub that can recognise the file systems it has created! It's on a logical partition, though, and I can only rely upon the primary partition for now.

Hopefully I can just copy the grub directory over from the logical to the physical partition. I should first verify with the liveCD that the Jaunty installer has created ext4 filesystems - as seems likely.

Thanks everyone
 
Old 05-20-2009, 06:23 AM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
syg00 got a valid point.

The legacy Grub 0.97 was declared no longer maintained by the GNU/Grub team about 3 years ago but this is still the most widely version. The Grub2 has few customer because it has next to nil documentation.

Ext4 was born after Grub 0.97 so it unlikely Grub can read its content. Linux distros intending to run Ext4 filing system may need to patch their versions of Grub.

I haven't used Ext4 much and didn't get into too much bother with it. Ext4 partitions cannot be mounted by Linux with kernel older than 2.6.28 so it is not easy to rescue.

It is possible if the OP has an Ext4 partition then it will be regarded by Grub as an unknown filing system. If this is the case then an unpatched normal Grub may have difficulty to boot a Ext4 partition directly as Grub needs to get inside to find the kernel and ramdisk files.

Not able to read a partition doesn't stop Grub from booting it. Grub never understand a ntfs partition but that it can chainload any or all of the Win2k, Xp, Vista and Win7.
 
Old 05-20-2009, 06:28 AM   #14
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,206

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
ext3 (not just ext4) created by newer systems is affected by this as well. Have a look at this for some background.
 
Old 05-20-2009, 07:28 AM   #15
wreckgar23
LQ Newbie
 
Registered: Apr 2009
Posts: 9

Original Poster
Rep: Reputation: 0
According to the Jaunty liveCD, my filesystem is ext3. ext3 is recognised by Hardy as well.

I've since remembered that while I was trying to recover from the original grub error that I had after installing Jaunty, I ran Hardy's fdisk on the hard drive to "repair" the partition table. This may well have not been a good move, especially considering that Jaunty may have created a file system of a type that Hardy doesn't support.

Maybe because of this, the Jaunty version of grub, booted from a cd, still only recognises the one partition on my linux hard drive.

Having messed about with the partition table, I can't reliably recover the Jaunty install. I need to remove the existing extended partition and try again. At least I have learnt that grub should support logical partitions and to be wary of installers' default options and of new file systems as they come along.

I appreciate everyone taking the time to answer my questions, so thanks. The only other thing I'm wondering about now is whether it's possible that some BIOS issue could cause grub to not recognise the logical partitions? The number of cylinders reported by grub from the terminal is a great deal bigger than from the bootup menu grub command line
 
  


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
LXer: Simple Guide How to Upgrade Ubuntu 8.04 (Hardy Heron) to Ubuntu 8.10 (Intrepid LXer Syndicated Linux News 0 10-31-2008 10:50 AM
Partition Sizes for Ubuntu Hardy Heron jezzabart Linux - General 4 09-22-2008 09:49 PM
LXer: Installing Xen On An Ubuntu 8.04 (Hardy Heron) Server From The Ubuntu Repositor LXer Syndicated Linux News 0 05-08-2008 02:10 PM
Ubuntu 8.04 Hardy Heron greengrocer Ubuntu 3 05-03-2008 09:05 PM
LXer: Upgrade Ubuntu 7.10 (Gutsy Gibbon) to Ubuntu 8.04 LTS (Hardy Heron) Beta LXer Syndicated Linux News 0 03-26-2008 07:30 PM


All times are GMT -5. The time now is 01:27 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration