Thursday, January 10, 2008

Installing Ubuntu 7.10 on Microsoft Virtual PC 2007

I've had to setup (and re-setup) a few virtual machines lately, so I thought I'd document the steps I use to get an Ubuntu 7.10 Desktop installation set up on Microsoft Virtual PC 2007. I'll be using this particular one for an installation of the Pentaho BI suite. I like to separate unrelated software installations into virtual machines that would resemble the setup that clients would have on their servers.

Before I describe the installation process, I'd like to thank Robert C. Cain and Martin Woodward, who both posted similar articles at their blogs. My article is similar because we were attempting the same thing, but the process I followed differs slightly from theirs. I encourage you to read theirs as well if you would like additional perspectives on how to set up your virtual machine.

First, you'll need to download Virtual PC 2007 from Microsoft. There is a version for x86 and a version for x64. Note that even if you download and install the x64 version, you will still only be able to run x86 operating systems in Virtual PC.

Once you have downloaded the appropriate version for your PC, you'll need to create a new virtual machine. Click the New... button in the Virtual PC Console, and walk through the wizard.



I chose the name "Ubuntu Pentaho Virtual Machine", as I plan to install Ubuntu, and then the Pentaho BI Suite.


Select "Other" as the operating system. You will be able to adjust the memory and virtual disk size in the next screen in the wizard.


Adjust the RAM to the amount that you want the virtual machine to use. You will need to allocate at least 256MB in order to install Ubuntu Desktop.


Unless you already have an existing virtual hard disk created by Virtual PC 2007, you will need to create a new virtual hard disk, so select the appropriate option on the next screen of the wizard.


I chose to use the default size of virtual hard disk, as it will be enough for what I plan to do with this installation. I also kept the default location of the virtual hard disk file, but you can override this to fit your needs.


The final screen of the wizard allows you to verify the options you chose. Click Finish and the virtual machine will be created.


Your virtual machine is now created. Next, we'll alter one setting. Click on the Settings button.

Click on Hardware Virtualization in the list on the left side of the window. If hardware-assisted virtualization is available on your computer, you can enable hardware-assisted virtualization using the checkbox on the right side of the window. You can also alter any of the other settings to suit your needs; I didn't make any other changes to the default settings. Click on OK when you are finished your changes to the settings.


Click on the Start button on the Virtual PC Console. Before the boot process gets to far, use the CD menu to attach to either a physical CD/DVD drive or to an ISO disk image. I previously downloaded an ISO of Ubuntu 7.10, and chose the "Capture ISO Image..." option in the CD menu to attach to it. If the virtual machine was too far into the boot process to boot from the CD, you will need to reset the virtual machine using the command in the Action menu. Otherwise, you'll see a screen similar to this next:



Scroll down to "Start Ubuntu in safe graphics mode", and press F6 to enter other options. By default, the boot options will not allow Ubuntu to see the virtual mouse provided by Virtual PC. On the next screen, you will need to add "i8042.noloop" to the end of the boot options. There should be one space between "--" and "i8042.noloop". When you've added this option, hit Enter to proceed.


The system will boot into a "Live CD" environment that will allow you to install Ubuntu Desktop from the same GUI that you will use after Ubuntu Desktop is installed. On my system, the virtual machine window was only displaying the top left corner of the Ubuntu desktop, as shown in this image:


It's possible to cycle through the available resolutions using Ctrl-Alt-Numpad- and Ctrl-Alt-Numpad+. I used these to cycle through until the window displayed the entire desktop:


You'll notice that the network icon in the top right corner of the screen is indicating that there is no network connection. To ensure that the installer is able to access the Ubuntu apt sources, you can left-click on the icon and choose Wired Network, as shown in this image:


Double click on the Install icon, and an installation wizard will start. Walk through each step in the wizard; I selected the defaults in all of the screens shown. Note that unless you choose to manually partition the virtual hard disk, there will be no step 5 of 7 in the 7 step wizard.






The last screen of the wizard confirms the choices you've made on the previous screens of the wizard. Click Install to begin the installation process.


The installation process will take a few minutes, so feel free to take a break. If you did not enable networking as described earlier, you may receive an error message at some point in the installation process, otherwise the installation should proceed without errors.


When the installation is complete, you will be prompted to restart or continue using the live CD. Choose the latter, so that you can release the CD from the virtual machine. After you've released the CD, click on the orange power icon in the top right corner of the screen and shut down.



The shutdown process has occasionally frozen on my virtual machine, at a screen like this. If you encounter this, just choose Close from the Action menu and choose to turn off the virtual machine. If you are unable to move the mouse pointer to the action menu, press the right alt key on your keyboard to release the mouse from the virtual machine.


After the machine has shut down, start it up again. You will need to modify the Grub boot loader's settings so that Ubuntu will be able to use the mouse (similar to the modification that you made when booting from the CD). When you see the text "Grub Loading", press Escape to go to the Grub boot loader's menu. Note that you will only have a few seconds to hit escape before Grub will begin the boot process. If you hit Escape quickly enough, you will see a menu like the following.


With the first item in the menu highlighted, hit e to edit the command.


On the next menu, scroll down to the second item, and again hit e to edit. Modify the command to include the i8042.noloop option, as shown in the image below. When finished, press enter to accept the changes to the command, and then press b to boot.


After the system finished booting, you should see the Ubuntu login screen. Enter the username and password that you chose in the installation wizard.


Congratulations, you now have a functional Ubuntu 7.10 Desktop installed in a virtual machine!


Note that there are still a few issues to correct:

  1. The system is not configured to use the i8042.noloop option each time it boots. To avoid having to enter this option each time we boot, we'll configure the Grub loader to use this option from now on.
  2. The system is not using modules for the virtual network card and virtual sound card provided by Virtual PC. We'll configure this below.
  3. The system is not connected to the network, as indicated by the network icon in the top right corner. As described in installation, you can left click on the network icon and select the network adapter each time you use the system, but it's better to configure it once and for all to avoid this manual step in the future. We'll configure it below.
  4. The system is not up-to-date, as indicated by the icon and tooltip in the top right corner of the screen. We'll update it below.
To correct the Grub configuration, you will need to edit the file /boot/grub/menu.lst. I opened a terminal (Applications->Accessories->Terminal):


and then used the following command to edit the file:

sudo vi /boot/grub/menu.lst

You can substitute vi with another editor such as nano if you prefer.

Scroll to the end of the file, and edit the kernel options to include i8042.noloop and clock=pit as shown below. The clock=pit option is to prevent the virtual machine's clock from becoming out of synch with the PC's clock. More information about this problem is available in an article by Martin Woodward, and in a Microsoft Knowledge Base article.


Next, edit the /etc/modules file to include the tulip and snd-sb16 modules, as shown below:


Next, we'll configure the network so that you will automatically be connected, rather than needing to select the network adapter using the network icon in the top right corner of the screen.

Left-click on the network icon, and choose "Manual Configuration...". A dialog box similar to the one below will be shown. Note that the Wired connection is in roaming mode; we will disable this and configure the network adapter to use DHCP.


Click on the Wired connection, and then click on the Properties button. The following dialog box will be displayed. Uncheck the "Enable roaming mode" checkbox, and then choose "Automatic configuration (DHCP)" from the Configuration dropdown. Click on OK when the settings match those shown below.


In the Network Settings dialog, you should see "Address: dhcp" under the Wired connection. Check the checkbox next to the Wired connection; this will activate the interface. On my virtual machine, I needed to reboot to get network connectivity.


Now, we'll update the system to include the latest version of all installed packages from Ubuntu. Click on the orange notification icon in the top right corner of the screen to open the update manager.



Click on the Install Updates button. When the updates have completed, you'll see the following:


IMPORTANT: After the updates have completed, you will likely need to edit the /boot/grub/menu.lst file again to ensure that the i8042.noloop and clock=pit options are specified. Do this before you reboot your system to ensure that your mouse will continue to work after installing the updates.

Your system may need to be rebooted in order for all of the updates to be active (for example, if the kernel was updated). The update manager will notify you of this.

Congratulations, you now have a functioning Ubuntu 7.10 Desktop virtual machine with sound and network connectivity, ready to use as you wish!


Note that I have not managed to get the mousewheel working in Virtual PC 2007. According to the comments on this article, it's not possible to enable the mousewheel. I found other advice on a thread related to Ubuntu 6.10 on the Ubuntu forums, but I was not able to get the mousewheel working using any of the suggestions posted. I tried using xev to watch the events that occur when using the mouse; I see events related to button presses and moving the mouse, but no events related to moving the mousewheel. If anyone has any advice on how to use the mousewheel with Ubuntu 7.10 on Virtual PC 2007, please post it!

7 comments:

James Selvakumar said...

This is really a great article.
I was able to install ubuntu-7.10 on virtual pc 2007 by following the steps you mentioned.

However, i want to have the same screen resolution (1280 * 1024) for m windows xp and ubuntu inside virtual pc.

I checked the System->Preferences->Screen Resoultion option but couldn't find this resolution.

It would be great if you can offer some tips on this.

Thanks anyway for ur wonderful post.

codespin said...

Sorry James, I also haven't had any success getting Ubuntu to work in Virtual PC 2007 in resolutions other than the default. If you come across a solution, please let me know!

KC said...

I was wondering if you had any success changing your desktop theme. Every time I try to change my visual effects to normal I get an error reading: "Desktop effects could not be enabled". Have any ideas?

DougL said...

Thanks for the timely information, I have just been installing ubuntu-7.10 on VPC 2007. After a lot of fiddling I came up with a way to change the screen resolution to 1280x1024.

Use System->Administration->Screens and Graphics to select a different Screen with an appropriate resolution range. My installed default was Custom1 and I picked "LCD Panel 1280x1024". When you click OK you will be told that you need to log out before the change will take effect.

DON'T LOG OUT YET!

You need to edit the /etc/X11/xorg.conf to adjust the color depth settings. VPC can only handle 16-bit color, but the above change automatically sets it to 24-bit. In the section for Screen and Display, you change the DefaultDepth and Depth fields from 24 to 16. Those lines appear after the screen model is modified. Note that selecting a new screen automatically generates a backup copy of xorg.conf (xorg.conf.1).

A couple of places for additional information on ubuntu-7.10 video and VPC:

https://help.ubuntu.com/community/HowToConfigureUbuntuForMicrosoftVirtualPC2004

https://help.ubuntu.com/community/FixVideoResolutionHowto

James Selvakumar said...

Hi dougl,
I tried the suggestions offered by you. But after making those changes, ubuntu was unable to start in graphics mode. I then had to start the recovery mode and recover.
Any ideas..?
FYI, i'm using Dell Vostro 1400. Anything to do with graphics card settings..?

DougL said...

James,

What do you mean by "unable to start in graphics mode"? If you are getting the "smeared" screen then it is the 24-bit problem. Check out the link FixVideoResolution.

I am running it on a Dell Dimension E520.

Good Luck!

ming said...

the linux is too big what can i do
(i tried alt ctrl + and -