CS46A/B Virtual Machine

Updated May 4, 2018

Why a Virtual Machine

Contents

A virtual machine with

Requirements

Installation

Download http://www.cs.sjsu.edu/faculty/horstman/LubuntuFall2015.zip (Windows; warning: huge file, 2188189575 bytes) or http://www.cs.sjsu.edu/faculty/horstman/LubuntuFall2015.tar.gz (Mac OS X or Linux; warning: huge file, 2188183766 bytes). Uncompress, yielding a file Lubuntu.vdi with 4715446272 bytes. Move into your cs46a directory. You can discard the zip file afterwards.

You would think that downloading and unzipping a file is a straightforward process, but unfortunately some operating syatems make this surprisingly complex. In Windows, when you click on a zip file, the file is not automatically unzipped. Instead, you get a “virtual folder” that shows you what is in the zip file, without revealing the contents to applications. In order to unzip the file in a useful way, pay attention to two details.
  1. In the browser, be sure to save the link target. Do not left-click. Instead, right-click on the link and select an option labeled “Save target” or similar.
  2. After you have saved the file, use the Explorer (on Windows) or the Finder (on the Mac) to navigate to the Download directory and locate the icon for the file you have just downloaded. Then click on the file icon. If you see a button for extracting the contents, go ahead and use it. Otherwise, right-click on the file icon and select the option for extracting the contents.

After having downladed and extracted the virtual machine image, follow these steps:

  1. On a convenient location (such as your desktop), make a folder named SharedWithLubuntu
  2. Run VirtualBox
  3. Click the "New" button
  4. In the new dialog, enter/select the following options:

    Name: Lubuntu

    Type: Linux

    Version: Ubuntu (choose 64-bit if available, otherwise 32-bit)

  5. Select "Next" (Windows) or "Continue" (Mac)
  6. On the "Memory" panel select "Next" (Windows) or "Continue" (Mac)
  7. On the "Hard Disk" panel select "Use an existing virtual hard disk file". Then select this icon: orange folder with green up arrow
  8. In the file selection dialog, navigate to where you unzipped the LubuntuFall2015.zip file and select the "Lubuntu.vdi" file.

    You would think that selecting a file is a straightforward process, but unfortunately some operating syatems make this surprisingly complex. In Windows, the unzipper makes a directory LubuntuFall2015 and places the file Lubuntu.vdi inside it. How can you tell which is which? Evil laughter—you can’t. Because Windows also hides the file extension .vdi because someone had thought that file extensions are “confusing”. You’ll just have to click your way through all the way to a LubuntuFall2015 that has an icon that isn't a folder icon.

  9. For Windows: Click "Next", then click "Finished"

    For Mac: Click "Create"

  10. The virtual machine is now created, but we have to configure one more thing. Click the "Settings" button.
  11. In the new dialog, select the Shared Folders tab. Click on this icon: blue folder with green plus (Add new shared folder) on the right and add the path to the SharedWithLubuntu directory that you made in the first step. Select "Auto-mount". (Be sure to do this step. It will make your life easier later)

Your virtual machine is configured. Click on the "Start" button on the VirtualBox toolbar to start it.

Troubleshooting

I can’t access the host through the shared folder.

Check that your user account is in the vboxsf group. Click on the bird icon, select Users and Groups → Manage Groups → vboxsf → Properties. Your user account should have a checkmark next to it. Check it if it is unchecked. When prompted for a password, enter secret.

I can’t copy and paste between the host and guest OS.

Right-click on the VM tab in the VirtualBox opening screen. Settings → General → Advanced. Make sure the Shared Clipboard is set to Bidirectional.

FAQ

Q: Why can’t I see the start menu?

A: Maybe your screen is too small? The image runs in 1024x768. Either use the scroll bars or select the full screen option.

Q: Why Lubuntu?

A: It’s just like Ubuntu, but it’s faster and has a more familiar user interface

Q: How do I see files from my host operating system?

A: Look inside the /media folder. There is a folder that points to the shared directory that you set up during installation.

Q: Can I run the virtual machine off a flash drive?

A: Only if you reformat the Flash drive to use a file system other than FAT32 (whose maximum file size is 4GB).

Q: What if I run Windows XP?

A: It might work, but it’s not supported. You are completely on your own.

Q: What if I run Windows 10?

A: It might work, but it’s not yet supported. You are completely on your own.

Q: Can I run Cygwin instead?

A: It might work, but it’s not supported. You are completely on your own.

Q: I tried unzipping the zip file on the Mac, and it didn’t work. Now what?

A: Some versions of Mac OS don’t know how to unzip files > 4GB. Use the .tar.gz file instead.

Q: How can I fix the error message “Failed to load VMMR0.r0 (VERR_SUPLIB_OWNER_NOT_ROOT)” when trying to load the VM image on a Mac?

A: Try the suggestions in this article or this discussion.

Q: How can I fix the error message “Failed to load VMMR0.r0 (VERR_SUPLIB_WRITE_NON_SYS_GROUP)” when trying to load the VM image on a Mac?

A: Try the suggestion in this blog post comment.

Q: How can I fix the error message “Failed to load VMMR0.r0 (VERR_VMM_SMAP_BUT_AC_CLEAR)” when trying to load the VM image on a Mac?

A: Try the suggestion in this bug report.

Q: How can I make such a VM myself?

A: Follow these steps:

  1. Download the 32 bit (x86) disk image from the Lubuntu site.
  2. Start VirtualBox. New -> Name: Lubuntu, Version: Ubuntu (32 bit), then follow the wizard with all defaults
  3. Settings -> Storage -> Click on the first + at IDE controller (with tooltip Add CD/DVD drive) -> Choose disk -> Choose the downloaded ISO file -> Ok
  4. Start your new VM
  5. Install Lubuntu. Accept all defaults, except (a) Your name: user (b) Password: secret (c) Log in automatically
  6. Restart when installation is complete.
  7. Open a terminal (Ctrl+Alt+T). Type these commands:
    sudo apt-get update (password is secret)
    sudo apt-get upgrade
    sudo apt-get install virtualbox-guest-dkms emacs git gitk
    sudo shutdown -r now
  8. After the restart, install Java from Oracle (not the Ubuntu repos). Download the Linux x86 (not x64) version of the JDK (not the JRE). Choose .tar.gz (not .rpm). After download, open a terminal and type
    tar xvfz Downloads/jdk-*-linux-i586.tar.gz
    ls -d jdk*
    emacs .bashrc
    Note the . in .bashrc!
    When Emacs has launched, select Options -> C/x C/c C/v Cut and Paste (CUA) and Options -> Save Options.
    Then add the following line to the bottom of the .bashrc file:
    export PATH=~/jdk1.8.0_51/bin:$PATH
    Here, the jdk1.8.0_51 matches the output of ls -d jdk* above. If you have a different version of Java, match it. Save the file. Close Emacs. Close the terminal.
  9. If you want Eclipse, download the Eclipse IDE for Java Developers (not Java EE). Open a terminal and run
    tar xvf Downloads/eclipse*.tar.gz
    Later, to run Eclipse, open a terminal window and type
    eclipse/eclipse
  10. If you want BlueJ, download the version for all other systems, not the Debian/Ubuntu version. Open a terminal and run
    java -jar Downloads/bluej*.jar
    Later, to run BlueJ, open a terminal window and type
    bluej/bluej

Q: Why would I want to build my own VM?

A: That way, you only need to download a 700K ISO file instead of a huge VM image. And you'll gain confidence installing a Linux system, which will come in handy sooner than you think.