Archive:HOW-TO:Install XBMC on Ubuntu/HOW-TO 3

From Official Kodi Wiki
Revision as of 19:36, 9 December 2009 by >Pashdown (add the standard accepted method for installing nvidia drivers and reorder from good to worse)
Jump to navigation Jump to search

Template:GoToParent

Introduction

Most of XBMC users are aware that XBMC Live is being released regularly by TeamXBMC, allowing a set-top box experience both running from a CD, a flash disk or fixed disk drive.

XBMC Live is a streamlined Ubuntu-based system, optimised for removable media, that once installed on a fixed disk drive is a pure ubuntu-based system, although customized for set-top box experience.

  • Note: such a system will be exactly like the one that this procedure will generate, except that no build environment will be available by default (you will need to apply the last two steps only if interested).

However, more and more XBMC users are urging to build their own customized systems for their media centers, adding support for specific hardware or providing additional functionalities.


This guide describes how to build an Ubuntu-based system with the minimal set of features that are part of XBMC Live, from which an expert user could start to create his/her perfect setup. Internet access is required during the installation. All the following screens and instructions are related to Ubuntu Jaunty.


This guide is not destined to Linux neophytes, since some knowledge of the Linux/Unix systems is needed to perform some steps. For a simpler approach pls follow the procedure describe here.

Install miminal Ubuntu

The Ubuntu community provides a handy "Minimal CD image", a tiny bootable CD (<10 MB) to be used to perform a custom installation with a text-based installer. Get the most recent Karmic ISO image from here.


Select "Install" at boot prompt, then when prompted provide info about your location, language, keyboard layout, time zone. Disk partitioning will be basic, the full disk will be deleted and used.

  • Note: If you want more control on the install options you can opt for the "Expert install" at boot prompt, that provides you more flexible disk selection and partitioning options.


When prompted, create an username for your account. Note that XBMC will run on its own account "xbmc" that will be created later in the install process.


During the installation select "Basic Ubuntu server" as the only option, or optionally "OpenSSH server" if you want to have (secure) remote connections facilities.

BasicUbuntu.jpg


The installer will then download all the required packages and finally the system will reboot.

From now on you can ssh from a computer to simplify the rest of the install.

Initial system configuration

If Ubuntu 9.10 or higher is installed run the following commands: <xml>sudo apt-get install python-software-properties sudo add-apt-repository ppa:team-xbmc </xml>

If using Ubuntu 9.04 or lower, create the file /etc/apt/sources.list.d/xbmc.org.list with the following content:

deb http://ppa.launchpad.net/team-xbmc/karmic-ppa/ubuntu/ karmic main
deb-src http://ppa.launchpad.net/team-xbmc/karmic-ppa/ubuntu/ karmic main

then import the TeamXBMC key:

<xml>sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 91E7EE5E 318C7509 </xml>

Finally, no matter what version of Ubuntu you are running, do:

<xml>sudo apt-get update </xml>

Install custom boot splash (optional)

If you want to replace the standard Ubuntu boot screen with a custom, XBMC related one TeamXBMC provides the following in its repository:

  • usplash-theme-xbmc-pulsating-logo XBMC Usplash theme for Ubuntu (Pulsating Logo edition)
  • usplash-theme-xbmc-spinner-black XBMC Usplash theme for Ubuntu (Black edition)
  • usplash-theme-xbmc-spinner-blue XBMC Usplash theme for Ubuntu (Blue edition)


All of them are courtesy of user Duduke, see his blog for information and screenshots.

First you need to edit /etc/usplash.conf to look like this (or the resolution you want)

# Usplash configuration file for 720p
xres=1366
yres=720
# Usplash configuration file for 1080p
xres=1920
yres=1080

To install the pulsating logo, as an example, type the following:

<xml>sudo apt-get install usplash-theme-xbmc-* sudo update-alternatives --config usplash-artwork.so sudo update-initramfs -u </xml>

Install XBMC

The core XBMC application and its related dependencies can be installed by typing:

<xml>sudo apt-get install xbmc xinit x11-xserver-utils </xml> This will take a considerable amount of time since lots of packages are due to be installed.

Install "restricted drivers" for NVIDIA or ATI/AMD video cards (optional)

XBMC requires a 3D GPU (Graphics Processing Unit) that at least supports Shader Model 3.0 and OpenGL 2.0 (that features 24bpp or 32bpp for 3D hardware-acceleration support). As of writing, only Intel, ATI/AMD and NVIDIA have compatible products. However, while Intel drivers are included by default in the standard Ubuntu kernel, NVIDIA and ATI/AMD are not and require additional steps for installation.

Envy Next Generation (NVIDIA or ATI drivers)

After following method 2 for NVIDIA (listed below), whenever I ran startx, the NVIDIA driver would report "no screens found." Instead, I used envyng (which supports installing both NVIDIA and ATI drivers). It will offer multiple version of each driver to chose from.

<xml>sudo aptitude install envyng envyng-core</xml> <xml>sudo envyng -t</xml>

Restart the computer when prompted.

There is also a GUI version which has some autodetect feature (install envyng-gtk and run envyng -g). You need a window manager to do this. You can run one by changing the driver in the XOrg file from 'nvidia' to 'vesa'.

After following these instructions, I was able to run 'startx' (after installing one of the window mangers listed below).

If using NVIDIA: install NVIDIA restricted drivers

Method 1: use Ubuntu's repository

Using this method will make upgrading your NVIDIA kernel modules much cleaner and safer.

Ubuntu has official packages for NVIDIA drivers in their repository. You can see these by: <xml>apt-cache search nvidia | grep ^nvidia</xml> Currently, version 185.18 is the highest available version to Ubuntu 9.10. This is perfect if you are using audio over HDMI, as later versions introduce a change which prevents the ALSA driver from handling this properly.

Looking at the listed versions from the command above enter the following command substituting 185 if you desire a different version: <xml>sudo apt-get install nvidia-glx-185 nvidia-settings</xml>

Method 2: use NVIDIA's installer

Install a proper kernel module build environment:

<xml>sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 wget dkms linux-headers-$(uname -r) </xml>


Download the latest installer from NVIDIA website using wget:

Example (at the time of writing 190.42): <xml>wget http://uk.download.nvidia.com/XFree86/Linux-x86/190.42/NVIDIA-Linux-x86-190.42-pkg1.run </xml>

Make it executable:

<xml>sudo chmod +x NVIDIA-Linux-x86-190.42-pkg1.run</xml>

and run it:

<xml>sudo ./NVIDIA-Linux-x86-190.42-pkg1.run</xml>

The installer should take care of installing drivers, libraries and building the proprietary kernel module (via dkpg).

Method 3: use third-party repositories

This is not the recommended method since it relies on binaries built by non-certified third parties, but it is very convenient for those with limited Linux skills.

You can find plenty of instructions around by searching for "avenard" or "thefirstm".


In all ways, you need a proper xorg.conf file; you can generate a new one automatically by using:

<xml>sudo nvidia-xconfig -s --no-logo --force-generate</xml>

If using ATI/AMD; install ATI/AMD restricted drivers

Follow one of the two methods described in the "Unofficial ATI Linux Driver wiki". Manual install is very likely to give the best results, but YMMV.

Test basic installation of XBMC

At this stage you should have a fully configured standard minimal Ubuntu setup. The system boots to console logon, and XBMC does not start automatically. You may want to test if all the above steps were successful by starting a graphical X session and run XBMC manually. For this you need a window manager, the most simple and compact being fluxbox or blackbox:

<xml>sudo apt-get install fluxbox xterm</xml>

or

<xml>sudo apt-get install blackbox xterm</xml>

and then

<xml>startx</xml>

Start an xterm with the default fluxbox menu and type "xbmc" on the xterm. If XBMC opens you are good to proceed, otherwhise something could have been gone wrong.

Install xbmc helpers

Once a basic standard system is fully working you can start customizing the startup sequence in order to achieve the set-top box experience that is desired for a real media center.

A package has been prepared for that in TeamXBMC repository, install it with

<xml>sudo apt-get install xbmc-live python-apt</xml>


Finally, there is a manual modification to be applied to the file /boot/grub/menu.lst: you have to add

<xml>xbmc=nodiskmount,noredir loglevel=0</xml>

to the default kernel cmdline (entry 0).

GRUB 2

If you can't find /boot/grub/menu.lst, the nchances are you are running GRUB2. In which case follow step 7 from this post

Safe Mode

If you want to have a "SAFE MODE" option (boot to console prompt without XBMC starting automatically), copy all the lines of the default block (lines starting with title, uuid, kernel, initrd, quit) and create a new one, modifying the title and removing "quiet splash" from the kernel parameters. As an example the original entries for Jaunty are:

<xml>

title		Ubuntu 9.04, kernel 2.6.28-11-generic
uuid		b2730ec6-2352-49b0-a7c5-69f947380fac
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=b2730ec6-2352-49b0-a7c5-69f947380fac ro splash quiet xbmc=noredir,nodiskmount loglevel=0
initrd		/boot/initrd.img-2.6.28-11-generic
quiet
#
title		Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid		b2730ec6-2352-49b0-a7c5-69f947380fac
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=b2730ec6-2352-49b0-a7c5-69f947380fac ro  single
initrd		/boot/initrd.img-2.6.28-11-generic
#
title		Ubuntu 9.04, memtest86+
uuid		b2730ec6-2352-49b0-a7c5-69f947380fac
kernel		/boot/memtest86+.bin
quiet

</xml> and you can create a SAFE MODE entry like this:

<xml>

title		Ubuntu 9.04, kernel 2.6.28-11-generic (SAFE MODE)
uuid		b2730ec6-2352-49b0-a7c5-69f947380fac
kernel		/boot/vmlinuz-2.6.28-11-generic root=UUID=b2730ec6-2352-49b0-a7c5-69f947380fac ro xbmc=noredir,nodiskmount loglevel=0
initrd		/boot/initrd.img-2.6.28-11-generic
quiet

</xml>

Updating alsa

There are a few issues with the current alsa package shipped with Ubuntu, therefor it might be a good idea to upgrade.

<xml>sudo apt-get install wget wget http://xbmc.org/wp-content/uploads/alsaup.sh chmod +x alsaup.sh sudo ./alsaup.sh -di</xml>

This should download and update your alsa to the latest version (1.0.20 when writing this)

Reboot the computer and check that alsa is updated, start alsamixer and look in the caption, the version should show there.

Credits for the script: soundcheck on Ubuntu forums

Additional settings and packages

By default the sound card will have several channels muted, others with low volumes. You have to find your setup by running

<xml>alsamixer</xml>

and adjust the channels you are interested in. Once done, save the sound volumes permanently with

<xml>sudo alsactl store</xml>

Optional: Install support for a remote

If you prefer to navigate in XBMC with a remote check if your remote is supported by "lirc" on their website, and if it is you can install and configure it with

<xml>sudo apt-get install lirc</xml>

After installing in order to be able to allow the remote to trigger resume from suspend, you must run

<xml>sudo sh -c 'echo "USB0" > /proc/acpi/wakeup'</xml>

USB0 might need to be changed to USBX, depending on your system. This setting gets cleared on reboot, so I added a file to my /etc/init/ directory (I am using Upstart) to make the change on system start:

/etc/init/set_wakup.conf: <xml>start on startup

script

       echo "USB0" > /proc/acpi/wakeup

end script</xml>


For the original XBOX DVD Dongle remote, configuration here

Optional: Setup privileges for XBMC user to allow suspend

<xml>sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.suspend sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.hibernate sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.reboot-multiple-sessions sudo polkit-auth --user xbmc --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions </xml>

Refer to Enable_Wake-On-Device to enable resuming using your remote control instead of pushing the power button.

Optional: Install build environment

If not already installed in previous steps, you may want to have a build environment in your system in order to allow the compilation of both custom applications and updated version of kernel modules and packages that are not available in Ubuntu repositories.

The basic packages needed are installed by the following command:

<xml>sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++5 dkms linux-headers-$(uname -r)</xml>

Optional: Install XBMC build environment and SVN tools

If you want to walk on the bleeding edge and follow daily development of XBMC you have to install subversion and all XBMC build dependencies:

<xml>sudo apt-get install subversion sudo apt-get build-dep xbmc </xml>