VMware Communities
marbert
Contributor
Contributor

Triple boot with rEFIt, grub unable to start Linux in VM

This problem is very similar to the one described in http://communities.vmware.com/message/1524727

The solution described by Scottee seems to involve writing grub into the MBR which - if I did understand this correctly - would conflict with using rEFIt. Here's a short summary of the problem again:

  • triple boot with Linux on a non-bootcamp partition #3, Windows (not yet) on a bootcamp partition #4

  • boot manager is rEFIt, grub is installed on the Linux partition

  • when started from rEFIt -> grub, Linux starts fine

  • I created a rawdisk for this partition using vmware-rawdiskCreator and configured the VM to boot from it

  • when starting the VM, grub enters the rescue shell saying "error: no such partition"

Scottee described a solution involving several invocations of grub-install. As I understand the trick is to start into the VM from an install CD so that one can issue a grub-install command to repair the setup:

5) Boot VMware Ubuntu from Install CD, grub-install --force (hd0), grub-install --force (hd0,3) , reboot the VM and ensure it now works.

Now I'm not quite sure about the consequences. As it looks to me this would mean installing grub in both the MBR and the Linux partition. This seems to make sense as in the original post grub was used as the main boot manager. Is there a way to get a working setup for both triple boot and the VM without having to install grub in the MBR?

Also, out of interest, what exactly causes the problem and how is the above supposed to fix this (I mean, if grub's understanding of the partition table is different if run from rEFIt or from the VM, can there be one setting which fixes both)?

Grateful for any hint Smiley Happy

0 Kudos
3 Replies
marbert
Contributor
Contributor

Replying to myself, just in case others are running across the same problem...

Obviously grub gets confused if it was installed from a VM if you want to use it for booting in the triple boot setup, the same applies the other way round.

So obviously one needs to find a setup in which the same Linux installation is started from different boot disks / partitions into each of which grub was installed from the "right" environment. Since I want to use rEFIt as boot manager in my triple boot setup, obviously, I do not want to install grub to /dev/sda, thus for "native" booting, /dev/sda3 is occupied by the grub install I need to start into from rEFIt. Now how do I go about booting the VM? The answer is astonishingly simple. I create a virtual IDE hard disk (scsi might do as well, but I did not try it), make it visible to the VM and boot into the VM from a rescue disk. Next, I create a (very small) partition on my new IDE disk, flag it as bootable, format it and add the necessary mapping to /boot/grub/device.map (let /dev/hda point to hd1).Finally, I run 'grub-install /dev/hda' (no --force necessary here).

This worked in the end. However I had to perform this sequence twice before I had it working. I'm not quite sure, maybe it's because after partitioning and formatting /dev/hda1 the system could not yet handle the new partiton without rebooting. After I had the VM running, my grub on /dev/sda3 was broken again, so I had to boot the "real" Linux from my rescue CD again and then re-install grub to /dev/sda3. Fearing the worst I rebooted into MacOS and launched my VM, but it still worked (and still does).

I now have a working setup: /dev/sda3 contains my Linux installation. From rEFIt I enter the grub installation I created from the running, "real" Linux on /dev/sda3, from VMWare I boot using the grub I installed to /dev/hda from within the VM. The process to get there was anything but flawless, but the result is fine.

0 Kudos
SterlingButters
Contributor
Contributor

I am trying to get this exact same setup and have been for awhile, perhaps you could help me out? I had it working a couple of times but it didn't last, I have a post here that no one has answered: Virtualize Partition

I'd be down for some collaboration in figuring out this puzzle. 

PS I would recommend an alternative to rEFIt called rEFInd which has extended capabilities as well as an ongoing development unlike rEFIt, more on the site here: The rEFInd Boot Manager - Roderick Smith

0 Kudos
SterlingButters
Contributor
Contributor

Just realized your post is two years old, has the setup maintained?

0 Kudos