How to install Linux on Virtualbox on OSX Leopard with a pre made Ubuntu image

published Jan 01, 2009 11:08   by admin ( last modified Jan 01, 2009 11:08 )

First you need to download and install VirtualBox. That is the easy part. I used 2.10, which is the one available at the time of this writing.

 

Secondly, you need a premade Ubuntu image. You can find one here (I cannot vouch for the quality or integrity of these), specifically I used the Ubuntu 8.10 from here.

You need to unpack the image from its 7zip format.

Unpack the image. You now have two files inside a folder tree, a .vdi file and a .xml file. The .xml file contains the settings for your new virtual machine, such as amount of RAM and other stuff. The .vdi file is an image of the hard disk, with all the linux stuff pre-installed. These two files are all you need to create a VirtualBox virtual machine. We need to place these file where VirtualBox can find them and we need to edit the .xml file, because it does not work in its downloaded configuration.

The xml file that the Ubuntu 8.10 virtual machine image linked to above, does not work ( at least not on my machine, and not at the time of this writing) . I think it may have been made for an older version of VirtualBox, but I really don't know. We can make it work though. We do this by letting VirtualBox make a new Virtual Machine of its own (let's call this the bogus machine), and we use the files created by that one to guide us on how to make the downloaded machine work.

Start VirtualBox and pretend that you are going to make a new Ubuntu virtual Machine from scratch, just so we get a skeleton to work with.

Select Ubuntu, and some sane settings for memory and other stuff. Exit VirtualBox after you have created a virtual machine and its accompanying storage.

You will now have two .vdi files, one that was created by VirtualBox for your bogus Virtual Machine, and one that we downloaded. The downloaded .vdi file is correct and just needs to be placed somewhere where VirtualBox can find it. But the XML file needs to be edited.

Delete everything from the downloaded xml file except the beginning and the end:

<?xml version="1.0" ?><!-- Sun xVM VirtualBox Machine Configuration -->
<VirtualBox version="1.5-macosx" xmlns="http://www.innotek.de/VirtualBox-settings">
  <Machine OSType="Ubuntu" currentStateModified="false"
lastStateChange="2008-11-01T12:55:48Z" name="ubuntu-8.10-x86" uuid="{c7f76231-b24b-462e-815c-967a054c0120}">

In the above XML I changed the OSType value from "ubuntu" to "Ubuntu". If you do not do this change, VirtualBox will choke on it and say that it is not among the valid OS types. Strangely enough it lists the allowed values as part of the error message and "Ubuntu" is not part of them, however Ubuntu works and is indeed generated by VirtualBox itself when it created our bogus machine.

 

and the end:

    <HardDiskAttachments>
      <HardDiskAttachment bus="IDE" channel="0" device="0" hardDisk="{58a58064-e589-47c0-baba-de38fa621c80}"/>
    </HardDiskAttachments>
  </Machine>
</VirtualBox>

Paste in the corresponding parts from your Bogus machine in between. You may get away with editing the file in a more fine grained way, but I have not tried that. Place the .xml file in the same directory as the bogus xml file is already in.

 

You must now move the downloaded vdi file to a location where VirtualBox can find it, and tell VirtualBox that it exists.

Edit the VirtualBox.xml file, and add the following sub element inside the <HardDisks> element

 

 <HardDisk uuid="{58a58064-e589-47c0-baba-de38fa621c80}" location="VDI/ubuntu-8.10-x86.vdi" format="VDI" type="Normal"/>

I moved the .vdi file to the VDI sub directory of VirtualBox to make the above XML declaration to be correct.

The username and password needed to login is not documented. it is 'ubuntu' and 'reverse'  respectively (without the quotes).

Once Ubuntu is booted you will want to install the guest extensions. Select this from the menu. It will mount a virtual CD for you and try to auto run it, which will fail. Run the appropriate script from the command line instead.

Each time you update the kernel, it seems like you need to reinstall the guest extensions.

I then ran Ubuntu in rootless mode under Mac OSX, and I can mingle windows from OSX and Ubuntu. I tried Kate and it works including sftp with kioslaves. I have now returned the Mac due to a mechanical problem, and hence can give you no screen shots but everything worked fine!

Well I actually I made screenshots, but I (duh!) stored them on the Mac's hard drive...

 

(Sorry about not being specific in all places in the instructions, this is of course due to my not having the Mac anymore. Maybe I also edited the Virtualbox.xml file to indicate the new virtual machine. Please check if the bogus machine is registered there, and if so, register the other one accordingly.)