Getting XBMC Eden Standalone on Debian Wheezy

XBMC Eden and Debian Wheezy

Not my XBMC. But I like this skin.

First and foremost, serious props must go to Vincent Bernat, without whom my efforts to get XBMC running would be nowhere at all.

How it all began

A month ago, I had XBMC running on Debian Stable, automatically running at boot, on an old Dell mini-PC in my living room. A 2TB HDD and 23″ monitor completed a functional, if ugly, media centre setup.

My only concern was that it wouldn’t show series of films in chronological order, only alphabetically. Then I read that the next version of XBMC (“Eden”) was in the Debian testing distribution, and had exactly the film series feature I wanted. Win!

Breaking a few eggs

The first step was to switch the local Debian distribution from stable to testing. My knowledge of the packages system is (like most of my Linux knowledge) just enough to be dangerous.

By changing entries in /etc/apt/sources.list, and doing lots of reading around how apt works, I successfully got Debian merrily downloading packages from the testing repos.

After that, it was simply a case of

sudo apt-get install xbmc xbmc-standalone

And I thought I was pretty close to having a working system. WRONG.

I couldn’t remember how I previously got XBMC to automatically start at boot and nothing I tried seemed to do the trick. The init.d system is not one of my strong points. I could successfully launch it from the desktop, but this wasn’t really in the spirit of a media centre PC.

Then I stumbled upon the blog linked above: XBMC on Debian Wheezy. Perfect! Oh, except he’s used a new init daemon: systemd. Well, it’s in testing. Might as well jump in.

sudo apt-get install systemd

This conflicts with the old init daemon, sysvinit, which I removed. So far, success! In that I haven’t broken anything. The PC still booted to a GDM login.

Next step: try to get XBMC starting as a systemd service. Shouldn’t be too hard, copy the service definition from the blog, make sure it’s executable, add it to the systemd service entries. WRONG.

Nothing happened. Ah! But in the service entry there’s this line:

WantedBy = multi-user.target

Which corresponds roughly to runlevel 3. And systemd is currently loading the graphical target, which roughly corresponds to runlevel 5. So, I need to point systemd at multi-user.target, right? WRONG.

graphical.target includes multi-user.target. So that’s not the full answer. Ah, but Debian doesn’t make a distinction between runlevels 2-5! It loads a graphical login for each.

…then making the omelette

Ah! The graphical login! The PC’s still loading GDM, which requires X (at least, that’s my understanding). Could that be obscuring my XBMC process?

ps -e | grep xbmc

Yes! It’s running, but I can’t see it! Do I actually need GDM? No… I’m content with logging in through a text prompt and starting X manually if I need to.

So, can I remove GDM from the multi-user target? Apparently not. Even though it was wanted by the target, systemctl claimed that it couldn’t find the service to remove it. I eventually found the GDM service buried in /sys/fs/systemd, but it turned out to be  a folder, not a text file. Lots of things about cgroups (whatever that is) in it.

Various google results seemed to think that prefdm.service or display-manager.service might exist, but they certainly didn’t on my system.

At this point, posted on Vincent’s blog, and almost immediately got a response: “If this box is dedicated to XBMC, the easiest would be to uninstall GDM.” Of course! I don’t need GDM at all! I’m quite capable of logging into a text prompt and starting X myself if I want to do something in LXDE.

sudo apt-get remove gdm3

Did this work? YES. XBMC starts at boot! But wait… something’s wrong. Very slow and choppy going through the menus… even worse, can’t open any files! The library’s there though. Ah, of course, the external drive’s not mounted. Quick entry in /etc/fstab and that’s fixed.

But still no sound, and still very slow and choppy. Video playback is even worse!

Is the multi-user target loading any sound services? Yes, it’s bringing in PulseAudio. Hmm… in the back of my mind I’ve always been suspicious of this “xbmc” user the service file refers to. What’s he got permission to access? Ah. Not a member of any groups at all. So…

sudo usermod -a -G audio xbmc

Bingo! Sound! But everything’s still really slow and choppy. Video lags way behind the sound. Something to do with hardware acceleration maybe? Wait! Groups again? My normal   media PC user is a member of the “video” group…

sudo usermod -a -G video xbmc

Success! XBMC fully working at startup! With the added benefit of films appearing in chronological order. The Harry Potter series never looked right alphabetically.

A learning experience

So, has it been worth it? Well, the actual benefit gained for the media PC was marginal. But I learnt a lot about how Debian works under the hood, and it looks like this newfangled systemd thing might be the future. I’m tempted to try profiling the media PC boot sequence to shave some seconds off the process.

Mainly, I’m quite chuffed with myself that I managed to go from having no clue to having just what I wanted in just a few hours.

So chuffed, that I decided to blog about it.

Advertisements
This entry was posted in Computing and tagged , , . Bookmark the permalink.

3 Responses to Getting XBMC Eden Standalone on Debian Wheezy

  1. Galeups says:

    Hi!
    Xbmc does not start autologon. Install SYSTEMD, add script, activate:
    systemctl enable xbmc.service
    But, no effect, boot console. Please help me…

    system: Debian Wheezy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s