Change default GRUB

I installed OpenSUSE 12.2. Then I installed Ubuntu 12.04.1.

Now my computer boots from GRUB installed in the root filesystem of Ubuntu. But I want the GRUB installed in the root file system of Suse to work as the default bootloader. How can I do that?

My Suse in installed in sda2 and Ubuntu in sda5. I have GRUB2. I tried this command but it did not work:


grub-install /dev/sda
update-grub

I got this error:


WARNING! You are trying to invoke the unsupported grub-install script  with a parameter. To really do this, call grub-install.unsupported. You  should rather call "yast2 bootloader" or create configuration files  appropriate for the intended target. 

[RIGHT] Thanx in advance…
[/RIGHT]

grub-install in openSUSE belongs to legacy GRUB. To install GRUB2 use /usr/sbin/grub2-install (or YaST, although personally I prefer low level commands).

In openSUSE do

grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda

Thanx for you quick reply…

The above command worked well, I got this output:


Generating grub.cfg ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found background: /boot/grub2/themes/openSUSE/background.png
Found linux image: /boot/vmlinuz-3.4.11-2.16-default
Found initrd image: /boot/initrd-3.4.11-2.16-default
  No volume groups found
Found Ubuntu 12.04.1 LTS (12.04) on /dev/sda5
done

So, my Ubuntu got detected. But…

The above command did not work. I am getting this error:


/usr/sbin/grub2-bios-setup: warning: this LDM has no Embedding Partition; embedding won't be possible.
/usr/sbin/grub2-bios-setup: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub2-bios-setup: error: will not proceed with blocklists.

[RIGHT]Thanx again…[/RIGHT]

I don’t understand that
Maybe someone else does

Maybe switch back to ubuntu grub until we find out what that all means

Shall I try this out:


/usr/sbin/grub2-install

No
I stand by my earlier comment

Do you have Windows on this disk? Did you ever have Windows on this disk?

Yes. I had Windows many days ago. But then I completely formatted my HDD and deleted all my partitions. So there should not be any part of Windows left on it.

Dear caf4926, do you remember giving me a link in which you wrote how to reinstall the grub from the installation media (by going into the rescue mode and etc. etc.). Shall I try that out?
[RIGHT]Thanx again…
[/RIGHT]

No. The problem is, even though you removed Windows dynamic disks signature is left somewhere on disk. Reinstalling grub won’t remove it (you already did it).

If I am not mistaken, LDM signature is located in blocks 6 and the very last one on disk. Could you show output of “fdisk -l /dev/sda”?

Deleted partitions doesn’t help. You should probably have zero filled the first track.
See this bug report: GRUB recognizes defunct LDM headers

and the last disk sector too. But I’d love to see partition table first. And if possible, image of the first and last disk tracks.

And you didn’t have problems with Ubuntu 12.04 beause it is still using Grub2 v. 1.99 (unlike Ubuntu 12.10 and openSUSE 12.2), and - according to the bug report - it affects version 2.00. Is that right?


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

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sda2   *     4208640    35663871    15727616   83  Linux
/dev/sda3        46153728    62926847     8386560   83  Linux
/dev/sda4        62928894   312580095   124825601    5  Extended
/dev/sda5        62928896   104874609    20972857   83  Linux
/dev/sda6       104878080   251678719    73400320   83  Linux

[RIGHT]Thanx…
[/RIGHT]

Well, you seem to have enough unused space after partitions so it may be possible there is LDM header there. I would try to zap last sector:

dd if=/dev/zero of=/dev/sda count=1 seek=312581807

Recheck it! It should be number of sectors - 1. And be careful - errors or typo may zap your whole disk … may be there are some HEX editors that are less dangerous.

After this is done, try to install grub2 again.

If you could do me a favor and before you do it (if you will do it) capture first and last 1M and make it available somewhere (e.g. paste.opensuse.org):

dd if=/dev/sda count=2048 of=disk.start
dd if=/dev/sda skip=312579760 count=2048 of=disk.end
tar czf ldm.tgz disk.start disk.end

and upload ldm.tgz.

Hmmm…what you say is really very confusing…
I have unused space before sda3 (5 GB), before sda6 (1.69 MB) and after sda6 (29.04 GB). So tell me now, which command should I go for first, the first one (

dd if=/dev/zero of=/dev/sda count=1 seek=312581807

) or the last one (

dd if=/dev/sda count=2048 of=dis...k.start disk.end

)?[RIGHT]Thanx for going on and on helping me…
[/RIGHT]

I still feel reinstalling GRUB2 should solve the problem as Ubuntu’s GRUB began to appear only after installing Ubuntu [and so, also its GRUB]…

How can I reinstall my SUSE’s GRUB2?

Thanx again…

In case it was not clear from previous posts.

  • You had Windows on this disk before
  • Windows was configured to use dynamic disks
  • Windows writes special signature on disk in multiple locations when dynamic disks are used
  • this signature was not cleaned up when you reformatted disk
  • GRUB2 finds this stale signature and believes you are still using Windows dynamic disks and refuses to install

To install GRUB2 you need to clean up stale signature. To know exactly where this signature is located images of first and last 1MB of your disks are needed. Otherwise educated guess is to zero out the very last sector on disk.

Did you read my posts? It is a bug in Grub2 version 2.0. Your Ubuntu (12.04) is using Grub2 v. 1.99, which is noit affected by this bug, AFAIK. If you had installed the latest Ubuntu release (12.10), you would have encountered the same problem (according toi the bug report I saw).

Yes. I understand what you say. So, what should I do next?
[RIGHT]Thanx…[/RIGHT]