пятница, 22 июля 2011 г.

We've Just Revolutionized Alpha Testing

Think back to the last time you wanted to look at a newer, unstable release of some app. Was it easy to do? Or was it a compilation from source full of mystical errors, booting a newer OS release from a live CD while fighting black-screen-on-boot bugs, or a terribly slow and awkward virtual machine installation (which still didn’t make much sense because you couldn’t try it with your real data)? I’ll guess it was closer to the latter.

Now, imagine you can try the absolutely latest version of any app, on your real data, safely, side-by-side with the stable version, without manual compilation, rebooting, virtualization and whatever else, in a few clicks. Sounds good? Sounds awesome to me. And now, it’s real.

Meet Glimpse

Yes, this dream is finally real, and it’s called Glimpse. The only thing that you will need is an ISO of Ubuntu Oneiric, but it can download or update one automatically. Then, after a one-time setup, viola! You can test any unstable apps, fully integrated into your desktop, not interfering with the stable versions of themselves. Safely sandboxed, and working with your real data. Wait, WHAT?!

Are you kidding?

No. But it’s really funny to look at people who hear this for the first time! The trick is, the sandboxed apps are allowed to read your real data, but when they write to it or modify it in any other way, all the changes stay within their sandbox. Your real files on your system are left intact. And if you break some files in the sandbox, you can simply purge the modifications made in it and start over.

For example, imagine you’re testing an unstable version of a cool music player...

Without Glimpse: First, you spend lots of time on setting up the build environment (again?! how do those guys manage to change it so quickly?!), including unstable version of compiler that breaks all other builds in the system. Then, when you finally manage to try the player for 10 minutes, you realize that the “improved writing metadata to files” has just broken half of your music library. You’re out of luck or have to restore a manual backup (if one exists).

With Glimpse: You open Glimpse, click “Update sandbox”, and the latest version of the player arrives in a few minutes, not hours. And if you find that all the music files in the sandbox are broken, you think “thanks to Glimpse, my files are safe,” click the “Purge sandbox files” button, and your original music is available in the sandbox again.

How on Jupiter did you do that?!

You’ll laugh, but all the technology was already there, all I had to do is to “connect the dots.”
It’s enough to say that Glimpse is written entirely in BASH. For the real work it relies on:
  1. zsync to download only those parts of ISO that have changed instead of pulling the whole 700Mb monster every time
  2. chroot for creating an isolated environment (instead of virtualization)
  3. Ubuntu Customization Kit and its awesome library to avoid reinventing the wheel
  4. Launchpad Recipes to get the absolutely latest code built, packaged and gift-wrapped
  5. AuFS to be able write to home directory and keep the real files intact
  6. Gaffel and Zenity to have a simple GTK2/GTK3 user interface
Most of these technologies (except Gaffel, which was written just now with Glimpse in mind, and recipes, that left beta several months ago) have been available for a few years already. It’s strange that I’m inventing Glimpse, and nobody did this before me. The only explanation I can make up is “others got stuck in polishing chroot”, but it doesn’t sound very convincing.

Limitations

Everything has them, and you’d better know them before you meet them.
  1. Glimpse is not yet accepted as an official elementary app because of its poor GUI. So you probably will not get any support from elementary developers.
  2. Whatever you run in Glimpse, it uses the host’s (your system’s) kernel. By design.
  3. Some system directories are not really sandboxed - they’re mounted as is. In most cases it doesn’t matter, but if you’re aiming for mass destruction, be warned that these directories are not sandboxed:
  • /dev/shm
  • /proc
  • /sys
  • /dev/pts
  • /var/run
  • /tmp
  1. Exploits targeted to breaking chroot jail can break Glimpse sandboxing too. It will never happen on a desktop system, but if you’re going to test the cutting-edge server exploits, do it in a virtual machine.
  2. An encrypted home folder can not be accessed from the sandbox. Any help on fixing this is appreciated.
  3. The elementary project provides daily builds for most of its apps “out of the box,” but other apps will be at their versions from the current unstable Ubuntu. You’ll have to add a daily build PPA for each app you want to be at bleeding-edge version.
  4. One has to write a separate profile for each new OS one wants to sandbox. Complexity may vary. Running Fedora or openSUSE would require quite some tweaks, but it’s not that hard when there are two working examples already.
  5. Sandboxed apps try to use host’s theme settings, but they don’t have access to host’s theme files. Switch your host system’s theme to elementary in advance (unless you like that old Windows 95-style interface!).

Try it yourself

The user interface is rather ambiguous, but usable, and the underlying technology is rather stable by now (I use it all the time). Glimpse runs on Ubuntu Maverick and up. elementary OS Jupiter is also supported, so now you can finally get Marlin, BeatBox, Pantheon Shell and whatnot in Jupiter. At the moment of writing this the package containing Ubuntu profile hasn’t built yet due to a Launchpad lag, and Gaffel doesn’t show OS logos, but it should be fixed in a few hours.
Glimpse is not an official elementary project yet, which means that you probably won’t get any support from elementary developers. If you still wish to install Glimpse, run:
sudo add-apt-repository ppa:glimpse-hackers/stable
sudo apt-get update
sudo apt-get install glimpse glimpse-profile-elementary glimpse-profile-ubuntu
Then find it in Applications > System and enjoy!

Hacking

All code is stored in Launchpad: https://code.launchpad.net/glimpse
The core is very minimal, less than 50 lines of BASH. The real work is done by plugins. And, you know, having a Fedora plugin would be cool ;)
Please report any bugs you encounter.
Fixing existing bugs is a good idea too.
The current UI supports translations, but I won’t upload the translation files anywhere because it was deemed unsatisfactory and I don’t want people to waste time on useless work.

May the chroot be with you.
Happy testing!

Bonus section: screenshots

Sandbox chooser and app launcher
Sandbox first run dialog
Marlin with GTK3 theming and overlay scrollbars out-of-the-box

6 коммент.:

  1. Didn't work on Natty: http://paste.pocoo.org/show/444234/

    ОтветитьУдалить
  2. @Oxwivi: thanks for pointing me to Arkose!
    The technology is basically the same; the difference is that Arkose is designed to sandbox a single binary, and Glimpse is designed to sandbox entire distros.

    For example, in Natty you can sandbox and test an app that has daily builds for Natty using Arkose. But you can't do it with Arkose if the app requires newer libraries than Natty has, and that's the case with many elementary applications - Wingpanel and Marlin, just to name a few.

    ОтветитьУдалить
  3. @Vadim Peretokin: Yes, it says that package "glimpse-profile-ubuntu" cannot be found. Remove it from the apt line or wait a bit till it lands to PPA (Launchpad says it'll be ready in 45 minutes).

    ОтветитьУдалить
  4. When I try to launch application, the sandbox window closes, and then reopens immediately. I never get to the app launcher window. I wanted to check if I was doing something wrong before I filed a bug report. Any tips?

    ОтветитьУдалить
  5. I've got the same problem here. I'm running Linux Mint 11 Katya, Gnome-edition.
    Linux jarl-(*removed*) 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

    ОтветитьУдалить