2

I installed Ubuntu 12.04 via Wubi a couple of weeks ago, and today used the script on https://help.ubuntu.com/community/MigrateWubi to move it to a new partition. Now I'm having a bit of confusion about how to clean up the original Wubi install.

Here's the setup: two hard drives, /dev/sda contains my Windows 7 install, and /dev/sdb is a secondary drive with a large partition for data. I had Wubi installed on /dev/sdb1, and have now created two new partitions sdb2 and sdb3 for the installation and swap respectively.

On booting, the computer starts the Windows boot manager with two options, Windows and Ubuntu (this is the behaviour I want, as I use Windows the majority of the time and don't want to accidentally boot to Ubuntu while Windows is hibernated); but now the grub loader on choosing the Ubuntu option has suddenly become rather crowded. It seems that Wubi has been left intact at the top of the list, with the migrated version (on /dev/sdb2) pushed lower down on the list.

This has left me with two questions:

  1. How do I remove the Wubi installation from the grub list?
  2. Is it safe now to uninstall Wubi from within Windows while still allowing its boot manager to direct to Grub on the second drive?

Cheers.

EDIT: I've tried using the Ubuntu-Tweak program as advised below, and it raised rather an interesting question. There were a couple of old kernel versions which were also being shown in the grub list, and that I'd removed. Trying to run any of those gives an error along the lines of "You need to load the kernel first". sudo update-grub didn't take them off the list, and in fact according to the status output it should have also added Windows to grub (which it hadn't). Rebooted into Windows and ran bcdedit, and it looks like it's using Wubi's version of grub with the new version added (hence why update-grub isn't helping at all). This is the relevant section from the bcdedit output:

Real-mode Boot Sector
---------------------
identifier              {816916df-c233-11e0-a9e6-883a7e390b89}
device                  partition=G:
path                    \ubuntu\winboot\wubildr.mbr
description             Ubuntu

where "G:\ubuntu" was the original install folder for Wubi.

When I ran the migration script in the first place it said that it was installing Grub to /dev/sdb - but this on its own isn't a partition. Is there somewhere particular where the migration script could have installed Grub, i.e. somewhere I can point the bootloader so that it will use the correct version of Grub? (After that I'm pretty sure the question about uninstalling Wubi is a moot point)

Jez W
  • 2,090
  • I've separated your questions from the main body of text for clarity. I can't say anything for the second one, but you might want to check this out for help with the first http://askubuntu.com/questions/2793/how-do-i-to-remove-or-hide-old-kernel-versions-to-clean-up-the-boot-menu/15325#15325 –  Mar 05 '13 at 16:57
  • @ChrisWilson Thanks for the link, I'll add my response as an edit as I think it'll be too long to fit here. – Jez W Mar 05 '13 at 17:51
  • I am doing something similar HERE!!! http://askubuntu.com/questions/366001/ubuntu-13-10-grub-2-0 – Etienne Lawlor Oct 26 '13 at 05:29
  • Using BCDedit, were you able to insert the Boot record into windows for Ubuntu to load the EFI from grub2? I think it is amdx64.efi or shimx64.efi ??? Anyway, Now I have to copy/create a new boot for windows, and point it to the correct path to boot Ubuntu. (If my idea is wrong, please tell me.) – WLC Mar 11 '16 at 15:37
  • @WLC I don't remember doing anything with EFIs (this was a long time ago now) but I highly recommend using EasyBCD over BCDEdit.exe for ease of use. My current setup is that it loads the Windows bootloader with two options: the first boots Windows directly, the second starts Grub (from which I can then load up Ubuntu) - I used the automatic settings from EasyBCD to set up how this loads (it is based on a .MBR file that's stored on my main drive) – Jez W Mar 14 '16 at 14:12

1 Answers1

1

The Wubi migration will only ever install the Grub bootloader on the drive you are migrating to. In this case /dev/sdb. It does this to make things simpler (and I believe it's the safest option). So the easiest way to boot the migrated install is to set /dev/sdb to boot first in the BIOS options.

The way Wubi boots - and the way you are booting right now - is from the Windows Boot Manager (BCD store), wubildr.mbr (in the \ubuntu\winboot directory), then wubildr (C:\wubildr), then the grub.cfg from inside the Wubi install (the root.disk). This is where you are booting your migrated install from. If you uninstall Wubi ALL these things will be removed (not the Windows Boot Manager but it won't show, because the Wubi entry is deleted).

So you cannot boot the migrated install with the Wubi boot method after getting rid of Wubi. You can instead install grub to the migrated partition and use easyBCD to do it. But personally I wouldn't recommend this. If you have to boot from the drive containing windows (in your case /dev/sda) instead do this:

  1. Boot the migrated install
  2. Install grub to the MBR. Assuming the drive you boot from is /dev/sda you would run: sudo grub-install /dev/sda
  3. Change the boot order so Windows is first.

Code:

sudo mv /etc/grub.d/30_os-prober /etc/grub.d/09_os-prober
sudo update-grub

These last commands just change the order in which Grub generates the menu entries, placing the Windows entry (generated out of 30_os-prober) first.

PS. since you have already tweaked your grub menu on the migrated install, you probably just have to install Grub to /dev/sda to get things to work right and can leave the grub scripts alone.

bcbc
  • 6,026
  • Aye, thought as much on the uninstalling Wubi front, was holding off until I was sure it'd work otherwise. Were it only so simple as your "PPS" option - alas, this laptop's BIOS doesn't allow me to choose which HDD to use, just the order of CD/HDD/USB/etc. Then again this machine (an HP DV7) has a list of weird behaviours as long as my arm so not all that surprised. Thanks for pointing me in the right direction - I went with easyBCD in the end - as mentioned I prefer to load the Windows manager first, then if there's a hibernated session it'll boot automatically so I don't lose it. – Jez W Mar 05 '13 at 20:47
  • Glad that worked out okay. I've used easyBCD before and it's good. But I'm pretty sure that Ubuntu won't mount a hibernated Windows partition (it requires you to force mount it). And unless you have the partition mounted automatically in /etc/fstab it shouldn't mess with it at all. In fact, I booted my 12.04 install today, and then rebooted back into my hibernated Windows 8 install with no issues at all (of course I didn't try to mount the C:\ partition but it would just refuse if I did). – bcbc Mar 05 '13 at 20:54