Anyone who met me probably knows that I like to run everything in containers.
A couple of weeks ago, I was attending the Ubuntu Developer Summit in Copenhagen, DK where I demoed how to run OpenGL code from within an LXC container. At that same UDS, all attendees also received a beta key for Steam on Linux.
Yesterday I finally received said key by e-mail and I’ve been experimenting with Steam a bit. Now, my laptop is running the development version of Ubuntu 13.04 and only has 64bit binaries. Steam is 32bit-only and Valve recommends running it on Ubuntu 12.04 LTS.
So I just spent a couple of hours writing a tool called steam-lxc which uses LXC’s new python API and a bunch more python magic to generate an Ubuntu 12.04 LTS 32bit container, install everything that’s needed to run Steam, then install Steam itself and configures some tricks to get direct GPU access and access to pulseaudio for sound.
All in all, it only takes 3 minutes for the script to setup everything I need to run Steam and then start it.
Here’s a (pretty boring) screencast of the script in action:
This script has only been tested with Intel hardware on Ubuntu 13.04 64bit at this point, but the PPA contains builds for Ubuntu 12.04 and Ubuntu 12.10 too.
To get it on your machine just do:
- sudo apt-add-repository ppa:ubuntu-lxc/stable
- sudo apt-get update
- sudo apt-get install steam-lxc
- sudo mkdir -p /var/lib/lxc /var/cache/lxc
Then once that’s all installed, set it up with sudo steam-lxc create. This can take somewhere from 5 minutes to an hour depending on your internet connection.
And once the environment is all setup, you can start steam with sudo steam-lxc run.
The code can be found at: https://code.launchpad.net/~ubuntu-lxc/lxc/steam-lxc
You can leave your feedback as comment here and if you want to improve the script, merge proposals are more than welcome.
I don’t have any hardware requiring proprietary drivers but I’d expect steam to fail on such hardware as the drivers won’t get properly installed in the container. Adding code to deal with those is pretty easy and I’d love to get some patches for that!
Have fun!