Lubuntu on Windows Virtual PC

For my second Linux distro to try out in Windows 7 Virtual PC I wanted to try an X-Windows based desktop distro. I chose Lubuntu for two reasons, it is very lightweight and I am somewhat familiar with recent Ubuntu installations.

Searching around the web I found that many people never get X-Windows running at greater than 800×600 resolution. There also appears to have been a problem with using 24bit color on earlier versions of Virtual PC. Having done quick test installs for a few different distros I found that X installs on WVPC end up at 800x600x24 and run OK. For my usage 800×600 is just too small and 24 bit color is not needed (I don’t expect to watch video or view/edit images in a VM). So I’ve set a target of getting X to run at 1024x768x16 for all desktop client distros that I’ll use. The larger screen size makes it practical to use multiple windows for finding solutions on the web and copying text from the web browser to a terminal or text editor to save on typing.

Another common problem I see people having is getting the middle mouse button (X button 2) and scroll wheel (X buttons 4 & 5) to work. Scrolling with the wheel and opening new Firefox tabs with a middle button click have become essential to me so this is the other major target for all my VMs. Unless I can get the mouse wheel/button and 1024×768 working I won’t consider a distro to be functional for me in WVPC.

The final problem I’ve seen many web sites mention is the use of dynamic virtual disks. A dynamic disk saves space on your host PC by keeping the file small while still allowing it to grow as needed. Most sites say to only use the fixed disk type in VPC however these sites are working with older versions of VPC, not WVPC, and older distros. The first VM I documented using was created with a dynamic disk and all of the VMs I’ve created myself work fine using a dynamic disk. I suspect the problem no longer applies to recent distros/kernels and WVPC. I did find one case where a dynamic disk did not work, I tried to expand the size of the Q&D LAMP VM by creating a larger virtual disk and using Clonezilla to copy the old disk into the new one. Clonezilla said it worked but when I looked at the size of the new dynamic disk it was clear it hadn’t worked. In that situation I had to use a fixed size virtual disk to make the cloning work.

The rest of this post is primarily a description of the steps I took to get Lubuntu 13.10 running in Windows Virtual PC. If you don’t want to perform these steps yourself you can download an archive containing the virtual disk and settings files. Simply extract the files to your virtual machines folder (usually C:UsersxxxxxxAppDataLocalMicrosoftWindows Virtual PCVirtual Machines where xxxxxx is your user name) and then run the VM. The archive, Lubuntu_13_1_upd8.7z, contains Lubuntu_13_1_upd8.vmc (settings) and Lubuntu_13_1_upd8.vhd (virtual disk). For this pre-made VHD I used these settings for names and password:  Name: W7VPC, PC Name: w7vpc-Virtual-Machine, Username: w7vpc, Password: w7vpc2014, and set it to Log in automatically.

  1. Open Windows Virtual PC, click Create virtual machine, give it a name and click Next.
    Capture032
  2. Set the memory to 1024MB (1GB) and be sure that Use computer network connections is checked then click Next.
    Capture042
  3. Leave the defaults of a dynamic disk and Enable Undo Disks unchecked and click Create.
    Capture052
  4. Select the virtual machine and click Settings.
    Capture062
  5. Select DVD Drive.
    Capture071
  6. Select Open an ISO image, click Browse and select the Lubuntu ISO.
    Capture081
  7. Select Networking and verify that your NIC is selected then click OK.
    Capture09
    I have tried the Sharing network (NAT) and it worked but I don’t think it’s a good idea to add another level of NAT (network address translation) during the install.
  8. With the virtual machine selected click Open to run the VM.
    Capture10
  9. With your desired language selected, press Enter.
    Capture111
  10. Use the arrow keys to select Install Lubuntu.
    Capture12
  11. Press F6 and the Other Options list opens.
    Capture13
  12. Press Esc to close the list.
    Capture14
  13. Type:
    vga=788 noreplace-paravirt i8042.noloop clocksource=pit

    to add the kernel options to the end of the boot line, then press Enter to begin the installation.

    Capture15

  14. The dark blue progress screen displays after about 1 minute.
    Capture23
    The default wallpaper displays after about 3 minutes and the next screen comes up after about 4 minutes.
  15. You’ll see the Welcome screen, select your language then click Continue.
  16. Now the Preparing to install Lubuntu screen appears, make sure Download updates while installing and Install this third-party software are unchecked then click Continue.
  17. The Installation type screen is next leave it like this and click Install Now.
    Capture16
  18. On the Where are you? screen, enter your location.
  19. Next is the Keyboard layout screen, select the type and test your keyboard.
  20. The Who are you? screen is where you enter the names and password.
  21. The installation process now runs and shows the Welcome to Lubuntu 13.10 screens. After about 10 minutes the screen will go blank, move the mouse to turn it back on. The entire installation took between 15 and 25 minutes.
  22. When the Installation Complete screen comes up, click Restart Now
  23. The installer consistently hangs up at the following screen, press Enter one or more times to proceed with the re-boot.Capture17
    I could not get to a terminal window from here so I do not know why it hangs up. I tried many different key press sequences and the only consistent result was from pressing Enter.
  24. The VM reboots and after about 40 seconds the light blue progress gauge screen comes up. At about 55 seconds the screen changes to the black progress gauge screen and the 800x600x24 GUI is up after about a minute and a half.
  25. Now we need to add back a kernel boot option that the installer doesn’t transfer. Click the Application Menu button (lower left) then Accessories – LXTerminal and type:
    gksudo leafpad /etc/default/grub

    and press Enter. When prompted enter the password.  Then change:

    GRUB_CMDLINE_LINUX="noreplace-paravirt clocksource=pit"

    to:

    GRUB_CMDLINE_LINUX="noreplace-paravirt i8042.noloop clocksource=pit"

    Save the edited file by pressing Ctrl+S or selecting the File-Save menu item then close the Leafpad text editor. Next type:

    sudo update-grub

    and press Enter. You’ll see Generating grub.cfg …, wait for done and the command prompt to return then close the terminal.

  26. Click the Shutdown button (lower right) and select Reboot to make sure it starts up.
  27. Next click the Shutdown button (lower right) and select Shutdown.
  28. Going back to the VM settings you’ll see that Virtual hard disk file is around 3,000 MB (~3GB) in size and the DVD Drive is set back to your local drive.
    Capture18
  29. The next change is big so before we do it we’ll turn on the Undo feature of WVPC. Select Undo Disks, check Enable Undo Disks and click OK.
    Capture19
  30. Now we’re ready to enable 1024x768x16 video mode and turn off screen blanking. Run the VM and when the GUI is up, open LXTerminal and type:
    gksudo leafpad /etc/X11/xorg.conf

    and press Enter. When prompted enter the password. Then copy and paste the following into the file.

    # xorg.conf (xorg X Window System server configuration file)
    #
    # This file was generated by dexconf, the Debian X Configuration tool, using
    # values from the debconf database.
    #
    # Edit this file with caution, and see the xorg.conf manual page.
    # (Type "man xorg.conf" at the shell prompt.)
    #
    # This file is automatically updated on xserver-xorg package upgrades *only*
    # if it has not been modified since the last upgrade of the xserver-xorg
    # package.
    #
    # If you have edited this file but would like it to be automatically updated
    # again, run the following command:
    # sudo dpkg-reconfigure -phigh xserver-xorg
    
    # Modified by Paul Hutchinson for Lubuntu 13.1 running on Windows 7 Virtual PC
    # Jan 27, 2014
    
    Section "Files"
    EndSection
    
    Section "InputDevice"
        Identifier "Generic Keyboard"
        Driver "kbd"
        Option "CoreKeyboard"
        Option "XkbRules" "xorg"
        Option "XkbModel" "pc105"
        Option "XkbLayout" "us"
    EndSection
    
    Section "InputDevice"
        Identifier "Configured Mouse"
        Driver "mouse"
        Option "CorePointer"
        Option "Device" "/dev/input/mice"
        Option "Protocol" "ImPS/2"
        Option "ZAxisMapping" "4 5"
        Option "Emulate3Buttons" "true"
    EndSection
    
    Section "Device"
        Identifier "Generic Video Card"
        Driver "vesa"
        BusID "PCI:0:8:0"
    EndSection
    
    Section "Monitor"
        Identifier "Generic Monitor"
        Option "DPMS"
        HorizSync 30-70
        VertRefresh 50-160
    EndSection
    
    Section "Screen"
        Identifier "Default Screen"
        Device "Generic Video Card"
        Monitor "Generic Monitor"
        DefaultDepth 16
        SubSection "Display"
            Depth 16
            Modes "1024x768" "800x600"
        EndSubSection
    EndSection
    
    Section "ServerLayout"
        Identifier "Default Layout"
        Screen "Default Screen"
        InputDevice "Generic Keyboard"
        InputDevice "Configured Mouse"
        Option "BlankTime" "0"
        Option "StandbyTime" "0"
        Option "SuspendTime" "0"
        Option "OffTime" "0"
    EndSection

    Save the edited file then close the Leafpad text editor and the LXTerminal.

  31. Shutdown the Lubuntu VM then restart it and this time it will start up with a 1024×768 16bit color screen.
  32. Shutdown the Lubuntu VM and go to the Lubuntu VM Settings – Undo Disks.
    Capture201
    If the new configuration worked: Click Apply changes then OK. If the new configuration did not work: Click Discard changes then OK and try creating the Xorg.conf file again.
  33. Restart the Lubuntu VM. One of the many times I ran through these steps the VM did not startup after 2 minutes. If this happens to you, click the Windows close button or use the Action – Close menu, choose Turn off and discard changes then click OK. Try opening the VM again, it should work on the second try.
    Capture211
  34. Next we’ll enable mouse wheel scrolling and clicking, open LXTerminal and type:
    gksudo leafpad /etc/modprobe.d/mouse.conf

    and press Enter. When prompted enter the password then copy and paste the following into the file.

    options psmouse proto=imps

    Save the edited file then close the Leafpad text editor and the LXTerminal.

  35. Shutdown the Lubuntu VM.
  36. Restart the Lubuntu VM to test the mouse scroll and click of the wheel. Open Firefox by clicking the Internet button on the Application Launch Bar. Enter a term to search for on Google, then try scrolling the results with the wheel then click the wheel on a link to open it in a new tab.
  37. Shutdown the Lubuntu VM then go to the Lubuntu VM Settings – Undo Disks.If the new configuration worked: Click Apply changes then OK. If the new configuration did not work: Click Discard changes then OK and try creating the mouse.conf file again.
  38. With all the basic settings working it’s time to update Lubuntu, restart the Lubuntu VM and select System Tools – Software Updater.
    Capture22
    The update process takes 15 to 20 minutes, when prompted to reboot, do it.
  39. Shutdown the Lubuntu VM, then restart it to re-test the system updates.
  40. Shutdown the Lubuntu VM, go to the Lubuntu VM Settings – Undo Disks.If the system worked: Click Apply changes then OK.If the updated system did not work: Click Discard changes then OK and try doing the updates again.

This completes the installation, basic settings and system update just like in the pre-made VHD file.

These are the steps I used to prepare the virtual machine for distribution:

  1. Turn off the Undo Disks feature.
  2. Modify the VHD selecting the Compact virtual hard disk option.
  3. Put an Xpad ReadMe file on the desktop.
  4. Retest the VM by booting and shutting down a few times.
  5. Put Lubuntu_13_1_upd8.vhd and Lubuntu_13_1_upd8.vmc into a 7zip archive (Lubuntu_13_1_upd8.7z).

I hope this works for everyone, if you run into any problems leave a comment or send me an email and I’ll try to help you out.

References

Kernel boot options

Xorg.conf

Mouse wheel

Autostart an application (Xpad)