Monday, August 24, 2015

A Linux VirtualBox for Steam

Over the course of this year, I've had to re-create a virtual machine running Linux with OpenGL support three separate times.  The first two times, it proved to be a minor nightmare of searching through forum posts trying to find the right combination and order or library installations to make it happen, and I wasn't confident enough in what I actually did to try to write it down as the canonical method.  But this third time, the whole process went smoothly, and so I'm going to record it for posterity (read: me in a year).

This process will get you a virtual machine running Ubuntu Linux 14.04 LTS 64-bit, with enough OpenGL support that Steam will correctly install and run games built in Unity.  It won't necessarily run them fast, but they will run.

  1. Download and install Oracle's VirtualBox.  At the time of this writing, I used version 5.0.2 on my Windows 7 machine and test build 5.0.3-102290 on my Windows 10 machine.
  2. Create a new virtual machine.  It should be set for Linux, Ubuntu 64-bit, and the following:
    • 16Gb virtual hard drive (or more)
    • 2Gb RAM (maybe more, maybe less, but this is ideal)
    • 128Mb video memory (the max VirtualBox supports)
    • 3D acceleration checked
  3. Get Ubuntu 14.04 LTS 64-bit.  Download the ISO image from the website.
  4. Start up the virtual machine.  When it asks you for a startup disk, point it at the Ubuntu ISO.
  5. Use the standard install options, and ideally download updates along with the installation.
  6. Once installed, update once again with the latest updates.
  7. Install OpenGL library dependencies.  This step is rather undocumented.
    • Open a command prompt/terminal.  Use Ubuntu's "Search your computer" icon at the top of its system bar and enter "terminal".
    • Run the following: sudo apt-get install libglapi-mesa libcheese7 libcheese-gtk23 libclutter-gst-2.0-0 libcogl15 libclutter-gtk-1.0-0 libclutter-1.0-0  xserver-xorg-input-all
    • Source
  8. Install the VirtualBox Guest Additions.  In the VirtualBox window, go to Devices -> Insert Guest Additions CD Image
    • Make sure to reboot after this installation
  9. Now you should be able to go to the display settings and set the window size to something better than 800x600.
  10. Install Steam.  Go to the website in the virtual machine, download and run the Linux installer.
    • The Steam package downloaded from the site will install an actual Steam installer.
    • Running that installer will prompt a terminal window to install further OpenGL dependencies.
    • After all of that is installed, the normal Steam client will install and update
At this point, Steam should be ready to log in, and you can proceed as normal.  Log in to your account, install the games you wish, and test.

Edit 2015/09/02: I changed the installation order slightly to install the extra OpenGL dependencies before installing the VirtualBox Guest Additions.  If you followed this guide before the order change, you may need to reinstall the VirtualBox Guest Additions.  Make sure the guest additions ISO is ejected, then reinsert it and follow the installation procedure again, the reboot.  Similarly, if you start up your VM and see the error "VirtualBox kernel service not running" (and/or your VM resolution is reduced down to 640x480 or 800x600), try reinstalling the guest additions and rebooting.