Thursday, May 28, 2009
Wubi: The Windows Ubuntu Installer
or are switching back to Linux after using Windows for a while,
Wubi is the perfect solution. It allows you to install Ubuntu
Linux as if it was a normal Windows program.
What Wubi Is
- An easy way to install Ubuntu
- A full dual-booting environment
- Partitioning-free (it stores it’s data into a virtual disk file)
- Officially supported by Canonical, the commercial sponsor behind Ubuntu
What Wubi Isn’t
- A method of running Linux programs in Windows (like Cygwin-ish)
- A method of running Linux programs at the same time as Windows programs (like CoLinux)
- A virtual machine which puts Ubuntu into a window (like VirtualBox)
Installing Wubi
Wubi is really easy to install:
- Go to the Wubi website, and click the big “Download Now” button. (Direct link)
- At the time of writing, the latest release was 9.04, “Jaunty Jackalope”
- Run the file you downloaded
- You will be presented with a screen like this:
-

Wubi Main Window
- Enter a new username and password, click Install, and that’s it!
- You’ll get a progress screen while it installs
-

Wubi Install Progress
-
- Reboot your computer when asked
-

Wubi Reboot Window
-
How Wubi Works
Getting the CD Image
Of course, you could have gathered all that from their website. The really interesting part is how it actually works.
Wubi requires an [K/X]Ubuntu Live CD to install. It searches like this:
- The current directory, for an ISO image
- The physical CD drives on your machine for a burnt copy, not an image
It needs:
- The correct version (in this case, 9.04),
- The correct architecture (ie, 32-bit on a 32-bit machine, 32- or 64-bit on a 64-bit machine)
- The correct edition (desktop LiveCD, not server or alternate)
- The correct distribution (ie, Ubuntu, Kubuntu or Xubuntu)
- The image to be of the CD version of Ubuntu
- As far as I am aware, the CD version burnt to a DVD should work
If it can’t find that, it’ll download the correct version from the Ubuntu servers.
It won’t burn it to CD or anything like that.
Actual Installation
Once it has the CD image, it doesn’t actually do that much. It does, first of all, make a directory on the root of the drive on which you chose to install it.
For example, if I chose “C:” as my installation drive, it would make a
“C:\ubuntu” folder.
The basic tree it would create is this:
ubuntu/
disks/
root.disk
install/
ubuntu-9.04-desktop-amd64.iso
wubildr
The file root.disk will contain all the Ubuntu data - the user data,
the configuration, the programs. At this stage it’s empty.
The method Wubi uses to actually create the virtual disk
is actually quite neat, and almost instant.
Next, it’ll add an entry to the Windows boot.ini or the
BCD menu file pointing to that “wubildr” file, which,
like “ntldr”, is responsible for starting off the boot process.
Finally, it’ll eject the Ubuntu CD (if present), and ask you to reboot the system.
Post-Reboot
Once you reboot the machine, you will get a menu like this:

Vista Boot Menu showing Ubuntu
When you select “Ubuntu”, the Jaunty loading screen will come up:

Jaunty "usplash" Booting Screen
Wait a couple of minutes, and a little window with
a progress bar will pop up. This is the actual install
procedure. It starts by mounting a few disks:
- Using Wubi’s homegrown “LVPM” tool,
- it mounts the real host drive - not the “root.disk”
- This makes it the riskiest bit of the install,
- so be careful not to switch of the power or anything like that
- As a side point, it mounts this under “/host”
- This makes it the riskiest bit of the install,
- It then mounts the Ubuntu ISO image from the install directory (”/host/ubuntu/install/ubuntu-9.04-desktop-amd64.iso”)
- with so-called loopback mounting built-in to Linux
- You can do this too! Open up a Linux shell, and type:
-
mount -t iso9660
-o loop,ro - This will mount the contents of iso_file to target_dir, just as if you ghad mounted a real CD-ROM there
- Wubi now uses another neat trick to create a filesystem on the drive.
- You can do that, as well! Type:
-
/sbin/mkfs.ext3
- You now have a full ext3 filesystem in the image
- The final disk mount is the newly-created ext3 image, which I think gets mounted at /
- To mount your disk image, use:
-
mount -t ext3
-o loop,rw
After that, it uses a similar technique to the live installer. Traditionally, Linux distributions with package managers created their blank file system, and executed their package managers with some flags to tell it where to install the packages to. It did this with every package. Now, LiveCD installers don’t do this†, they basically just ‘extract’ an image over to the hard disk.
†Technically, this is done when producing the Live CD, but anyway…
Finally, it reads the installation parameters and uses that to set up your user, time zone (obtained from the host), and any accessibility options specified on the Windows side.
Exploring The Wubi Source Tree
This is almost getting to short essay length! So I’ll split this off into a separate article, which should be here soon!
Subscribe to Posts [Atom]