Monday, April 15, 2013

How to install Raspbian and Autostart XBMC in Raspeberry Pi

Some weeks before, I bought a Raspberry Pi to make it, a media center with XBMC. As a Fedoda Fan the first OS which i try to install was ARM Fedora Edition. It was easy to install it, but XBMC did not supported. The second OS which i tried to install was OpenELEC. OpenELEC was what I wanted, because XBMC stareted in boot and I could manage the OS through ssh, but there was a problem with official XBMC addons, which I couldn't install them neither from XMBC repository, nor from zip files.

Finally, I tried to install Raspbian and install XBMC in Rapsbian, and it was a successful try.

This is what I did to Install and set Rapsbian and XBMC.

First you have to download the latest version of Raspbian from here.

Second you need a n SD card (mine is 8GB) formated with a single FAT32 (MS-DOS or Windows formatted) partition.

Copy the installer files from this zip file onto the top level directory.

On a Raspberry Pi with an attached monitor and keyboard boot with the SD card to start the installer software. The partition and files on this card will be overwritten during the installation process.

Now you can configure your Rasbian before instillation start. Change the password of "pi" user if you want (default password is raspberry), enable ssh server or whatever you want to set. It is very important to expand the FS to whole SD card. Press finish, reboot and Rasbian is now installed to your Raspberry Pi.

Now use sudo apt-get update  to update repositories.

Now you have to update the firmware of Rapsberry. This is very easy. if you follow this guide.

Now you have to install XBMC. To install it follow the instructions below:

Open /etc/apt/sources.list.d/raspi.list :

sudo vi /etc/apt/sources.list.d/raspi.list

and put this line in the end:

deb http://archive.mene.za.net/raspbian wheezy contrib

and import the archive signing key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5243CDED

Then update the package lists:

sudo apt-get update

You can then install it as you would with any other package, for example, with apt-get:

sudo apt-get install xbmc

The user which you're going to run XBMC as needs to be a member of the following groups:

audio video input dialout plugdev 

If the input group doesn't exist, you need to create it:

addgroup --system input

and setup some udev rules to grant it ownership of input devices (otherwise the keyboard won't work in XBMC), by placing the following in /etc/udev/rules.d/99-input.rules:

SUBSYSTEM=="input", GROUP="input", MODE="0660"

Running

To run XBMC, run:

xbmc-standalone 

from a VT (i.e. not under X). XBMC accesses the display directly and not via Xorg.

If you want XBMC to automatically start when the system boots, edit /etc/default/xbmc and change ENABLED to 1:

ENABLED=1

You also need to set the user which XBMC should run as (the xbmc user is not automatically created at the moment). Run:

sudo service xbmc start 

to test this.

7 comments:

  1. Hey,
    Thank you for the tutorial. It worked as far as firing the xbmc up. However, when it loads, the xbmc doesnt seem to be centered on the screen display, the corners are all cut out. When I try to navigate through the system would start to glitch and i would lose control over the mouse eventually. Did you experience any of these problems?

    ReplyDelete
  2. You can fix the problem from:
    Settings->System->Video output->Video Calibration.

    You can adjust the corners in your screen.

    ReplyDelete
  3. QUESTION:
    To run XBMC, run:
    xbmc-standalone
    from a VT (i.e. not under X). XBMC accesses the display directly and not via Xorg.

    I run Chrome in Kiosk mode most of the time. How to close all of it from command line including X, then running xbmc-standalone? There is a problem when exiting XBMC (black screen etc) so I would also like to do auto reboot on pi when XBMC exits.

    ReplyDelete
    Replies
    1. I don't know if you can reboot the system on XBMC's quit from XBMC configuration, but maybe you can make it with a script. For example, you can check if XBMC is running and then reboot the system.

      Delete
  4. I'm having a bit of a problem... I followed your instructions, made sure to add my user to the groups you mentioned, but I still can't get it to work. XBMC starts up just fine, but then as soon as I try to click on one of the menu items the screen freezes and stays that way. I can hear sound effects when I hit the arrow keys, but that's it. I didn't know what you meant by setting the user that XBMC runs as, maybe that has something to do with my problem? Thanks a lot for your help and for the awesome tutorial!

    ReplyDelete
    Replies
    1. Are you sure that you are member in the groups mentioned in the tutorial?
      Make sure that you are member in these groups by executing the command:

      awk -F':' '/group_name/{print $4}' /etc/group

      If you are not member add the user to the groups mentioned above by executing the command:

      useradd -G group-name username

      Delete
  5. This comment has been removed by the author.

    ReplyDelete