2011-03-07

Banshee Bundle on Linux : One file to run on them all

As you might know, Banshee is available for Mac OS X, as a single file, which is a self-contained bundle of the Banshee binaries, along with all the dependencies. You just have to download it somewhere on your system, and run it.
Back in late 2009, when working on the tools to create this OS X bundle, Aaron already had the idea to create a similar thing for Linux, calling it "an interesting hack".
I'm happy to report that it was indeed an interesting hack, and you can enjoy the result by clicking on this link : banshee-1.9.4.run.tgz (49 MB)
Download the file, uncompress it with your favorite tool and you'll get a banshee-1.9.4.run executable. Just run it !



What do I get in that big file ?

The bundle contains almost everything you need to run Banshee, except maybe an operating system : GLib 2.28.1, GTK+ 2.24.1, SQLite 3.7.5, WebKit 1.2.5, GStreamer 0.10.32, Mono 2.10.1, GTK# 2.12, etc. What is missing though are MP3 codecs, but you should be able to play ogg file and other formats.
So you should be able to run that file on pretty much any Linux system, provided it has an X server and supports fuse (more on that later).

How does it work ?

This bundle is built using two great tools :
  • Bockbuild by Aaron, which is a light-weight build/packaging/bundling system for OS X, Linux, and Windows and is used to produce the Banshee OS X bundle.
  • Glick by Alexander Larsson, which is set of tools to easily create application bundles, using a nice trick with /proc/self and file descriptors.
So that big file is just a regular 32-bit i386 ELF executable, with a small bootstrap code and an ext2 filesystem image in one of its data section. When you launch that executable, the bootstrap code will mount the filesystem image in a temporary directory and do it's trick so that /proc/self/fd/1023 point to the root of that filesystem. It will then run the "start" script that sets up a nice environement and launches Banshee from that filesystem.

I've tried to do everything so that there's no interference with any thing on the system, in particular with an existing Banshee installation : configuration files are stored under $HOME/.config-glick/ and Banshee uses its XML configuration backend instead of the usual GConf. But of course standard disclaimers apply !

I had to modify and slightly extend both Bockbuild and Glick, so you will find my changes in the following branches on GitHub :
That last branch also contains a README.linux-bundle file with what I hope are clear instructions on how to create a bundle with these tools.

Why ?

The idea here is not to replace the packages you get through your Linux distribution (we love our packagers !), but to cover the use cases that aren't covered yet :
  • Allow users to quickly and easily try out a new version of Banshee, without having to wait for the packages to be available for their distro.
  • Provide an easy to test experimental features, instead of asking people to compile from a git branch.
  • Run Banshee with the latest versions of its dependencies, without any risk of compromising system stability.
  • Provide a custom UI theme (aka skin), using GTK theming.
  • [Insert your idea here]

What's next ?

There are a few things missing and some things that could probably be improved :
  • The bundle doesn't contain any hardware backends, so you won't be able to see your media player in Banshee. It should be possible to make that work by adding the missing build dependency, and let everything work its magic at runtime.
  • Although the bundle contains Mono 2.10.1, the new SGen garbage collector is not enabled yet. I just wanted to play it extra-safe for now.
  • I've seen some weirdness with fonts on some systems, maybe we could just add a nice font in the bundle.
It would be really great if somebody with artistic talent could come up with a nice and elegant UI theme for Banshee. Right now the bundle contains the Shiki-Brave GTK theme, but I'd be happy to add others to the mix !
I'm also looking forward to hear about your experiences running Banshee from this bundle, good or bad. Bonus points for running on the craziest Linux systems out there !

16 comments:

NickG said...

Fantastic article and an interesting way to get awesome bleeding-edge software!

Now, if this could replace ppas as the way people distributed non-repositoried software we could blur the boundaries between debian/suse/ubuntu/fedora etc.

Will there be a team setup to furthering this a possible approach for a linux distro-agnostic setup?

jdm said...

Very nice idea, but unfortunately doesn't run on my work PC (which uses some variant of CentOS).

I get
./banshee-1.9.4.run: /lib/libc.so.6: version `GLIBC_2.7' not found (required by ./banshee-1.9.4.run)

Would be great to have a version compiled against an old glibc, since newer versions are backwards compatible.

Anonymous said...

GREAT!

The developer<->enduser roundtrip is quite crappy when it involves +6 months forced distribution update.

I guess the regular 'but security' will come, what about updating the bundled libs. But i'm sure it can be fixed with some clever fallbacks to system libs or self-update mechanism.

I guess some will scream, Oh no the binaries! But as you state. Being able to push the recent release matters. And the distro is a huge bump, since they only care about a centralized software channel.

Also, now we somebody just need to revive FatELF (sigh) ;).

Also, how does this solution compare to the zeroinstall?

Anonymous said...

Great, now we are finally on par with Windows - run software downloaded over an unsecured connection (http) from a random source (Dropbox) lacking features a normally packaged version would have (mp3, media player support) and ignoring my user settings (theme, fonts).

Gabriel Burt said...

Runs great for me on SLED 11 SP1 and openSUSE Factory/11.4. Nice work!

LogicMagic said...

I would love to insert my GTK# app into this build process and have it work on RHEL5 and RHEL6 since neither Red Hat nor Novell are supporting this.

Thanks,

Vlad

Bertrand said...

Thanks for the kind words everyone !

@NickG
Anyone is welcome to use the same method to provide a bundle for other applications. But I think this should be done by each project team: they are in the best position to create the right bundle for their own needs: testing, wider availability, etc.

@jdm
Good point, I built the bundle on a fairly recent distro. Which version of glibc do you have on your system ?

@Anonymous 1
Some kind of auto-update would be nice, maybe as part of the "start" script. I wonder what happens if you update the .run file while it's running and the filesystem image is mounted...
I had a quick look at zeroinstall. It seems has a much wider scope (shared downloads, etc.) and requires the zeroinstall-injector to be installed. I was looking for something simpler.

@Anonymous 2
I think we all agree running random binaries from the internet is not safe.

@LogicMagic
I think it's quite easy to add an application to bockbuild. See the existing apps in the profiles directory.

Anonymous said...

This sounds exactly like AppImage.

http://www.omgubuntu.co.uk/2010/07/distro-agnostic-packaging-making-appimages/

Anonymous said...

[Insert your idea here]

...

Skip Cacnonical's Banshee Amazon referral code override? :)

Anonymous said...

http://pastebin.com/bmTCnWq1

Can't start it, I am not on old distro but I don't have mono, gstreamer, any gnome lib, I have gtk+, glib etc.

I think this is good, I like to try apps from portablelinuxapps for example (but usually they not work, because it is not real bundle), to try something I do not wish to compile on old laptop...
I would prefer if it can follow somehow system theme, I think I saw some binaries did this somehow, but am not sure...

Anonymous said...

This is the way client software should be distributed. I loved the idea of bundles on OSX I think the idea works so well.

Hopefully this will get a second wind. Package management would also be a lot easier. Disk space is cheap time is not these days and this very much speaks to that.

nameless said...

It doesn't work on Arch Linux 64-bit with GNOME 2.32.1. I get this: http://pastebin.com/VbAMQ3NF

j said...

As a Linux dev, and big Mono fan, I am thoughoughly excited about this and all other solutions to the packagers' delemas. LZMA2ing the original file brings it down to ~29mb. Even taking the original size, which uses 0.0034% of my disk space, would be well worth it.

Bertrand said...

@zekopeko
Yes the technical approach seems similar, although I haven't been able to find much more details about AppImage. Has it become http://portablelinuxapps.org/ ?

@Anonymous and @nameless
Your two problems are the same, the GTK library doesn't load, probably because it can't find some of its dependencies. libgtk-x11-2.0.so has several dependencies which are outside of the bundle, mostly X libraries, so one of these might be the problem. Maybe you're missing the 32-bit versions of those X libraries ?
It would be great if you could get in touch with me on our IRC channel or by e-mail, I'd like to look into this further.

Buyongo said...

Hi Bertrand,

Please help me out here, where would one start in terms of tinkering with the ui? I installed mono develop but have no clue where to start with trying out some ideas.

Bertrand said...

@Buyo
This is not the right place to this that.
Please get in touch with our community on the mailing-list or on IRC :
http://banshee.fm/about/contact/