Ubuntu – How to enable booting multiple Ubuntu Wubi


I want to use both Ubuntu Wubi 11.04 and Ubuntu Wubi 12.04 so that the boot menu will displays 3 options: Windows, Ubuntu 11.04 & Ubuntu 12.04. My current approach is to only use either of them, and disable the other. Is there anyway to do it?

Best Answer

You can't do it via the Windows boot manager. You can only do it with the manual switching (as you are apparently doing) or via a custom grub entry.

Step by step:

  1. install first release (either 11.10 or 12.04)
  2. copy \ubuntu directory to \ubuntufirst (or to be quicker, rename to \ubuntufirst, and then create a new \ubuntu directory with uninstall-ubuntu.exe, which is required to uninstall the first release)
  3. install the second release
  4. boot Ubuntu and add a custom grub entry to boot the first release. You would edit /etc/grub.d/40_custom and then run sudo update-grub. You can copy the entry from the /boot/grub/grub.cfg on the install you want to boot. An example of the entry would be something like the following:

    menuentry 'Ubuntu, Other Wubi' --class ubuntu --class gnu-linux --class gnu --class os {
            set gfxpayload=$linux_gfx_mode
            insmod part_msdos
            insmod ntfs
            set root='(hd0,msdos3)'
            search --no-floppy --fs-uuid --set=root YOUR-UUID-HERE
            loopback loop1 /ubuntufirst/disks/root.disk
            set root=(loop1)
            linux    /vmlinuz root=UUID=YOUR-UUID-HERE loop=/ubuntufirst/disks/root.disk ro   quiet splash vt.handoff=7
            initrd    /initrd.img

A couple things to note... you change loop0 to loop1 because loop0 will be in use already (with your original install). Also, use /vmlinuz instead of /boot/vmlinuz-3.x.x-x-generic because then you don't have to keep updating it (/vmlinuz points to the latest). The same applies to /initrd.img

Here's my working example (in this case the copy is in the same \ubuntu\disks folder):

exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

    menuentry 'Ubuntu - backup precisenew.disk' --class ubuntu --class gnu-linux --class gnu --class os {
            set gfxpayload=$linux_gfx_mode
            insmod part_msdos
            insmod ntfs
            set root='(hd0,msdos3)'
            search --no-floppy --fs-uuid --set=root 18B4B7BBB4B799A8
            loopback loop1 /ubuntu/disks/precisenew.disk
            set root=(loop1)
            linux   /vmlinuz root=UUID=18B4B7BBB4B799A8 loop=/ubuntu/disks/precisenew.disk ro   quiet splash vt.handoff=7
            initrd  /initrd.img

This is what it looks like when booted

bcbc@arcturus:~$ mount | grep ' / '
/dev/loop0 on / type ext4 (rw,errors=remount-ro)
bcbc@arcturus:~$ sudo losetup /dev/loop0
/dev/loop0: [0803]:34470 (/host/ubuntu/disks/precisenew.disk)

If you use this technique you probably should update /etc/fstab to reflect the updated locations. It won't affect / but if you have a separate /home or you want to use the correct swap.disk.

In my opinion, this isn't a useful solution for most people. Wubi is designed to be simple for beginners. But if you are using it to test different releases, there aren't many options for booting into them, other than renaming the \ubuntu directory and updating C:\wubildr each time.

NOTE: When Grub is updated on a Wubi install, it will rebuild the /wubildr file and this will point to whatever the current virtual disk is. In the above example, it will point at precisenew.disk. This is likely undesirable as it's simpler to have a master install. To avoid this happening you can either keep backups of your C:\wubildr file, or edit /usr/share/lupin-support/grub-mkimage on the secondary install (not your main one):

--- /mnt/usr/share/lupin-support/grub-mkimage 2011-09-20 03:44:44.000000000 -0700
+++ /usr/share/lupin-support/grub-mkimage 2012-10-29 22:02:55.784517389 -0700
@@ -112,7 +112,7 @@
         exit 1
+exit 0 # for non-primary install, bypass creation of wubildr

 if [ ! -f "$target" ] && [ -z "$wubildr_partitions" ]; then
Related Question