LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Grub2 won't load some OS's after expanding partitions (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/grub2-wont-load-some-oss-after-expanding-partitions-872276/)

slacker_et 03-31-2011 09:15 PM

Grub2 won't load some OS's after expanding partitions
 
Hello,

I recently expanded some partitions on my laptop.
And now grub2 will not load two of the five OS's.

Here is my laptop's current partition layout:
Code:

root@laptop:~# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa8a8a8a8

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              1        8486    68163763+  7  HPFS/NTFS
/dev/sda2  *        8487      12403    31463302+  a5  FreeBSD
/dev/sda3          12404      12926    4200997+  82  Linux swap
/dev/sda4          12927      19457    52460257+  5  Extended
/dev/sda5          12927      16843    31463271  83  Linux
/dev/sda6          16844      18149    10490413+  83  Linux
/dev/sda7          18150      19455    10490413+  83  Linux
root@laptop:~#

bash-4.1$

sda2 is FreeBSD 8.2
sda5 is Slackware 13.1 (and is the OS the has the grub2 bootloader.)
sda6 is Ubuntu 10.04
sda7 is SuSe 11.2

The only thing that changed was the size of partitions 1,2,3,4,and 5.
Partitions 6 + 7 are the same size as before.
AND all OS's are on the same partition #'s as before I did the expansion.

The steps I took were:
  1. Boot with a Slackware 13.1 installation DVD.
  2. Backup the three Linux's to an external disk; using "cp -a".
  3. Repartition the internal disk.
  4. Restore the 3 Linux's to the same partition they before. Again using "cp -a".
  5. Reboot with FreeBSD 8.2 installation DVD; and install FreeBSD 8.2.
  6. Reboot after installing FreeBSD.
  7. Experience a few minutes of terror when the single OS I did not back up; Windows.
    Would not boot. Until I realized that it's partition ID was set to 83 (Linux) instead of 7 (HPFS/NTFS). Oops.

After that little bit of a brain fart and correcting the Windows partition ID.
Windows, FreeBSD, and Slackware all booted without issue.

But when attempting to boot Ubuntu or Suse; I get the error message:
Code:

error : you need to load the kernel first
I've tried everything I can think of; reinstalling grub2, new grub probe, various incarnations of grub.cfg, making new initrd's for Ubuntu and Suse.
But nothing has worked. And all the online searching I've done has gotten nothing.

Although I really don't think the problem is with my grub.cfg.
Here it is anyway (same as before the partition changes):
Code:

menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
        insmod ntfs
        set root=(hd0,1)
        drivemap -s (hd0) ${root}
        chainloader +1
}

menuentry "FreeBSD 8.2" {
        set root=(hd0,2,a)
        #kernel /boot/loader
        chainloader +1
}

menuentry "Slackware 13.1" {
        insmod ext2
        set root=(hd0,5)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux  /boot/vmlinuz-huge-smp-2.6.33.4-smp root=/dev/sda5 ro vga=773
}

menuentry "Ubuntu 10.04" {
        insmod ext2
        set root=(hd0,6)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot/vmlinuz-2.6.32-28-generic root=/dev/sda6 resume=/dev/hda3 splash=0 showopts ro vga=773
        initrd /boot/initrd.img-2.6.32-28-generic
}

menuentry "openSUSE 11.2" {
        insmod ext2
        set root=(hd0,7)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part7 resume=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part3 splash=silent quiet showopts vga=0x317
        initrd /boot/initrd-2.6.31.14-0.6-default
}

menuentry "Failsafe -- openSUSE 11.2" {
        insmod ext2
        set root=(hd0,7)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part7 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x317
        initrd /boot/initrd-2.6.31.14-0.6-default
}


Does anyone have any idea what is going wrong ?

Thanks;
--ET

Larry Webb 04-01-2011 04:38 AM

Run the command

os-prober

then

update-grub

syg00 04-01-2011 05:25 AM

With grub2, update-grub automagically runs os-prober

Larry Webb 04-01-2011 05:37 AM

Quote:

Originally Posted by syg00 (Post 4310522)
With grub2, update-grub automagically runs os-prober

Thanks for the info, as usual covering my back

slacker_et 04-01-2011 08:03 AM

Hmm; thanks. But there is no update-grub.

The grub on my system only has the following:

Code:

root@laptop:~# ls /usr/local/bin/*grub*
/usr/local/bin/grub-editenv*  /usr/local/bin/grub-fstest*  /usr/local/bin/grub-mkelfimage*  /usr/local/bin/grub-mkfont*  /usr/local/bin/grub-mkimage*  /usr/local/bin/grub-mkrescue*
root@laptop:~# ls /usr/local/sbin/*grub*
/usr/local/sbin/grub-emu*  /usr/local/sbin/grub-install*  /usr/local/sbin/grub-mkconfig*  /usr/local/sbin/grub-mkdevicemap*  /usr/local/sbin/grub-probe*  /usr/local/sbin/grub-setup*
root@laptop:~#

and I've tried them all. :(

--ET

Larry Webb 04-01-2011 10:04 AM

First if you are running grub2 from your ubuntu installation it should respond to the update-grub command. Anyway my suspicitions are the mapping of the partitions has changed. You can check your partition numbers and uuid numbers against those listed in the grub.cfg.

slacker_et 04-01-2011 10:07 AM

Quote:

Originally Posted by Larry Webb (Post 4310795)
First if you are running grub2 from your ubuntu installation it should respond to the update-grub command. Anyway my suspicitions are the mapping of the partitions has changed. You can check your partition numbers and uuid numbers against those listed in the grub.cfg.

I'm running grub2 from the Slackware partition. And all the partition numbers are correct.

--ET

Larry Webb 04-01-2011 11:11 AM

I think you may have corrupted some files then. You might try fsck. If that does not do the job it looks like a repair or new install is the only alternative. I know Suse has a repair option on their dvd that you might try.

slacker_et 04-01-2011 01:31 PM

Well now; this is peculiar.
Slackware, FreeBSD, and Windows all see partitions 6 + 7.
But Grub does not.

When issuing an "ls" from Grub's command line prompt. I get the following:
Code:

sh:grub> ls
(hd0) (hd0,5) (hd0,3) (hd0,2,b) (hd0,2,a) (hd0,2) (hd0,1) (fd0)
error: no such disk
sh:grub>

Hmm; why doesn't grub2 see partitions 6 + 7 ?
(It saw them before expanding partitions 1 through 5.)

--ET

slacker_et 04-01-2011 02:50 PM

Solved it !

It appears that by expanding the first 5 partitions. I pushed partitions 6 + 7 beyond a BIOS / drive limitation.
I stumbled across the following at https://help.ubuntu.com/community/Grub2:
Code:

error: no such partition

If you have an older computer it's possible the BIOS cannot see your GRUB 2 files if they reside past the BIOS limitations
(generally 33 GB on very old computers and 137 GB on slightly newer computers). If this is the case the boot will fail
and an error: no such partition message will be displayed.

If at the grub prompt, type ls and ENTER. If the command does not display all the partitions, reboot and enter your
computer's BIOS setup. Ensure the BIOS reports the full disk size. If it doesn't, check for LBA/partition settings
or obtain a BIOS update from the manufacturer.

If unable to eliminate the BIOS limitation, the user can create a separate /boot partition within the disk area seen by the BIOS.
CreateBootPartitionAfterInstall

So my solution (at least for now) was to copy the Ubuntu's and Suse's /boot directories to the Slackware filesystem (aka partition #5).
And then modify grub.cfg as follows:
Code:

menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
        insmod ntfs
        set root=(hd0,1)
        drivemap -s (hd0) ${root}
        chainloader +1
}

menuentry "FreeBSD 8.2" {
        set root=(hd0,2,a)
        #kernel /boot/loader
        chainloader +1
}

menuentry "Slackware 13.1" {
        insmod ext2
        set root=(hd0,5)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux  /boot/vmlinuz-huge-smp-2.6.33.4-smp root=/dev/sda5 ro vga=773
}

menuentry "Ubuntu 10.04" {
        insmod ext2
        set root=(hd0,5)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot_ubuntu/vmlinuz-2.6.32-28-generic root=/dev/sda6 resume=/dev/hda3 splash=0 showopts ro vga=773
        initrd /boot_ubuntu/initrd.img-2.6.32-28-generic
}

menuentry "openSUSE 11.2" {
        insmod ext2
        set root=(hd0,5)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot_suse/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part7 resume=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part3 splash=silent quiet showopts vga=0x317
        initrd /boot_suse/initrd-2.6.31.14-0.6-default
}

menuentry "Failsafe -- openSUSE 11.2" {
        insmod ext2
        set root=(hd0,5)
        #search --no-floppy --fs-uuid --set d363b0a3-88f5-480b-be7e-ff2d374d6538
        linux /boot_suse/vmlinuz-2.6.31.14-0.6-default root=/dev/disk/by-id/ata-SAMSUNG_HM160HC_S12TJF0S952139-part7 showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 x11failsafe vga=0x317
        initrd /boot_suse/initrd-2.6.31.14-0.6-default
}

Hope this also helps anyone else who stumbles upon this error.

Thanks for the replies;
--ET

Larry Webb 04-01-2011 04:37 PM

I had heard of that problem but you are the first I have seen with the problem. The link you listed to ubuntu's tutorial is one of the best and easiest to understand I have seen.

JZL240I-U 04-04-2011 07:01 AM

Please mark this thread as [SOLVED] in the thread-tools at the top so others may easier find it as reference.

<edit> Uuups, fast work ;) </edit>

syg00 04-04-2011 07:08 AM

Erk - haven't seen that in 4-5 years. Can't you get a BIOS update ?.


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