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

From Official Kodi Wiki
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, optimized for removable media, that once installed on a fixed disk drive is a pure Ubuntu-based system, although customized for set-top box experience.

An XBMC Live system will be exactly like the one that this procedure will generate, except that no build environment will be available by default. Instructions for installing a build environment are under "Optional Installs".

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. The result will be a customized media center allowing the user to add support for specific hardware or providing additional functionalities. Internet access is required during the installation.

Although this guide is not written for Linux neophytes, it is easily followed by anyone who can complete a Linux install.

This guide assumes you are using the latest non-desktop version of Ubuntu. As of this writing, Ubuntu Server 9.10 Karmic Koala. A window manager is not required for running XBMC.

If your processor supports 64-bit, it is recommended you use that version of Ubuntu. Otherwise, use the 32-bit version.

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.

  • The ISO can either be burned to CD (seems like a waste for 10 MB); alternatively, I used UNetbootin to make a bootable USB drive from ISO.


After starting the computer with either the CD or the USB drive, 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.

  • Note: You must add the 'universe' repository during the installation, otherwise main xbmc installation will fail.

BasicUbuntu.png


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

From now on, if you installed OpenSSH, you can SSH from a computer to simplify the rest of the install.

Initial system configuration

On Ubuntu 9.10 or higher, run the following commands:

sudo apt-get install python-software-properties pkg-config
sudo add-apt-repository ppa:team-xbmc

Update your apt database:

sudo apt-get update

On Ubuntu 9.04, run the following commands:
Create a sources list file.

sudo nano /etc/apt/sources.list.d/xbmc.org.list
deb http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu/ jaunty main
deb-src http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu/ jaunty main

then import the TeamXBMC key:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 9F10E6AE 9317790E

and then

sudo apt-get update

Install XBMC

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

sudo apt-get install xbmc xinit x11-xserver-utils

This will take a considerable amount of time since lots of packages are due to be installed.

Install "restricted drivers" if you have an NVIDIA or ATI/AMD GPU

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.

Install envyng:

sudo apt-get install envyng envyng-core

If you are installing the drivers for NVIDIA and you want the newest drivers, then add the proper repository (see below).

After installing envyng and if desired adding the NVIDIA repository, run:

sudo envyng -t

Restart the computer when prompted.

If using NVIDIA: install NVIDIA restricted drivers

Method 1: use NVIDIA-VDPAU repository

For NVIDIA versions > 185 use this method.

sudo add-apt-repository ppa:nvidia-vdpau/ppa

Update your apt database:

sudo apt-get update

Search available releases:

apt-cache search nvidia | grep source

Install your desired version:

sudo apt-get install nvidia-190-kernel-source nvidia-glx-190 nvidia-settings mesa-utils libvdpau-dev

Method 2: 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:

apt-cache search nvidia | grep ^nvidia

Currently, version 190.53 Beta 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 195 if you desire a different version:

sudo apt-get install nvidia-195-kernel-source nvidia-glx-195 nvidia-settings mesa-utils libvdpau-dev

Method 3: Manual Installation

First, download the open source NVIDIA nForce drivers from here.

Latest version available to download is 195.35.24 for both 32-bit and 64-bit platform. This version is okay for audio over HDMI.

The driver can be downloaded directly using 'wget' (you may have to install wget, if not installed yet).

Linux AMD64/EM64T (64-bit version):

wget http://us.download.nvidia.com/XFree86/Linux-x86_64/195.36.24/NVIDIA-Linux-x86_64-195.36.24-pkg2.run
chmod 755 NVIDIA-Linux-x86_64-195.36.24-pkg2.run

Linux IA32 (32-bit version):

wget http://us.download.nvidia.com/XFree86/Linux-x86/195.36.24/NVIDIA-Linux-x86-195.36.24-pkg1.run
chmod 755 NVIDIA-Linux-x86-195.36.24-pkg1.run

binutils and gcc must be installed for nVidia package installer to run/compile. The installer will stop running if those packages are not found on the system.

sudo apt-get install binutils gcc

Chances are there that you will end up with this error message during the installation process:

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most
      frequently when this kernel module was built against the wrong or
      improperly configured kernel sources, with a version of gcc that differs
      from the one used to build the target kernel, or if a driver such as
      rivafb/nvidiafb is present and prevents the NVIDIA kernel module from
      obtaining ownership of the NVIDIA graphics device(s), or NVIDIA GPU
      installed in this system is not supported by this NVIDIA Linux graphics
      driver release.

If you are one of those unlucky one (like me) follow the steps below.

sudo vi /etc/modprobe.d/blacklist.conf

(use your choice of editor) and add these lines at end of the file:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

IMPORTANT: You must leave a blank line after the very last line. Otherwise it's never gonna work.

Uninstall any previously installed Nvidia drivers (to be in the safe side) and reboot:

sudo apt-get --purge remove nvidia-*
sudo shutdown -r now

Login and change (cd) to the directory where you saved the nVidia package installer file and run the script:

sudo ./NVIDIA-Linux-x86_64-195.36.24-pkg2.run

If everything goes right, you should see the driver being installed on the screen. For further reading on this, look here

Generate an xorg.conf file

You need a proper xorg.conf file; you can generate a new one automatically by using:

sudo nvidia-xconfig -s --no-logo --force-generate --output-xconfig=/etc/X11/xorg.conf

Alternately, here is a preconfigured xorg.conf for NVidia with some required settings.

Judder free playback (NVidia Only)

For a judder free playback at 23.97/59.94 Hz follow this guide.

Load the NVIDIA kernel module

The NVIDIA module can now either be loaded:

sudo modprobe nvidia

Or you can reboot and it will be automatically loaded:

sudo reboot

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.

Install XBMC-live and Test XBMC

You do not need a window manager to run XBMC. In fact, your system will be much more lightweight without one. Instead, install the XBMC-live startup script.

The xbmc-live package requires the "xbmc" account, but does not create one. Create one before you install it:

sudo adduser xbmc --gecos XBMC

Set the password to whatever you wish.

Add the xmbc user to the required groups:

sudo usermod --group audio,video,fuse,cdrom,plugdev xbmc

Install XBMC-live for Automated startup:

sudo apt-get install xbmc-live

Now to test, logout of your administrative user and log back in as "xbmc". Then run:

xinit xbmc-standalone

If everything has been setup correctly, you should be greeted by the XBMC interface. If not, a likely culprit is your X setup. Check the logfile /var/log/Xorg.0.log. A quick way to find fatal errors is with the command:

grep EE /var/log/Xorg.0.log

If you find problems, try reinstalling your drivers and editing your /etc/X11/xorg.conf file.

Safe Mode

If you want to boot to a console for repair without starting XBMC, hold down the shift key when booting and "grub" will give you a choice of "(recovery mode)". Select this and the system will boot to a console. Alternately, you can attach a keyboard and switch out of XBMC to a text console by pressing CTRL-ALT-F1 through CTRL-ALT-F6, you can switch back to XBMC with CTRL-ALT-F7.

Install ALSA

sudo apt-get install linux-sound-base alsa-base alsa-utils

The sound level will be set to zero, to change the volumes we need to enter the sound mixer.

sudo alsamixer

Adjust the channels you are interested in. Press ESC to exit out of the mixer.

Save the volumes of Alsamixer.

sudo alsactl store 0

Updating ALSA

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

By using this guide.

WARNING : the script on that guide installs a MASSIVE number of huge packages that will render your heretofore nice and clean minimal ubuntu install a BLOATED PIG.

Credits for the script: Soundcheck on Ubuntu forums

This should download and update your ALSA to the latest version (1.0.22.1 when writing this)

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

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

alsamixer

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

sudo alsactl store 0

Alternative: By following this guide you can update alsa with a ppa.

HDMI audio on NVidia GeForce G2xx

By following this guide you can setup HDMI audio for NVidia GT2xx

Audio over HDMI for NVidia GeForce/nForce

Writing in progress!!

  • Note: This method was tested on ASUS P5N7A-VM motherboard [GeForce 9300 / nForce 730i]

First, check which ALSA playback devices you have, you can use this command:

aplay -l

You should see something like this:

xbmc@htpc:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

The device is specified as hw:(card),(device). The sample above shows device 3 is labeled "NVIDIA HDMI"; we are gonna use that and it would be called hw:0,3.

Create a file "asound.conf" in /etc

sudo cat <<EOF>>/etc/asound.conf
pcm.!hdmi-remap {
  type asym
  playback.pcm {
    type plug
    slave.pcm "remap-surround71"
  }
}

pcm.!remap-surround71 {
  type route
  slave.pcm "hw:0,3"
  ttable {
    0.0= 1
    1.1= 1
    2.4= 1
    3.5= 1
    4.2= 1
    5.3= 1
    6.6= 1
    7.7= 1
  }
}
EOF

Optional Installs

Custom Boot Splash

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)
  • usplash-theme-xbmc-spinner-black-silver XBMC Usplash theme for Ubuntu (XBMC Live 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:

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

Suspend/Wake

See the page on Ubuntu Suspend / Wake

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:

sudo apt-get install lirc

For the original XBOX DVD Dongle remote, configuration here

Resume from Sleep with Remote

Refer to the "Remote Suspend & Wake" section of "Ubuntu Suspend / Wake".

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:

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

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:

sudo apt-get install subversion
sudo apt-get build-dep xbmc

Known Issues

Overscan

When connecting the PC to the TV using HDMI, the 4 sides of the screen may be cut off. The recommended fix is to set 1:1 pixel mapping on your display. On the Panasonic TC-P54V10, go to the "Picture" menu to access "Advanced picture" and then set "HD Size" to "Size 2". Most modern displays have this as an option for the input.

Sound Delay Issue

When using HDMI to connect the the audio of the PC to a TV, there appears to be a 2-3 second delay after the video playback is resumed before sound plays. The issues does not occur when the the analog audio out is used. More information on this issue is available at: this thread and this thread.

Unlock the DVD/CD drive for eject

The eject function in XBMC may not work unless you do the following.

sudo bash -c "echo dev.cdrom.lock=0 >>/etc/sysctl.conf"
sudo sysctl dev.cdrom.lock=0

Poor Playback of H.264 Files

When playing H.264 files (e.g MKVs), if the playback is uneven and the sound unsynced or non-present, VDAPU is likely not being used for decoding. This can be verified by checking the playback statistics. The decoder should show "dc:ffh264vdpau." If it does not, VDAPU is not being used for decoding even if it is selected from the playback menu. The solution is to run "sudo aptitude install mplayer-nogui". Credit to: gradinaruvasile

Multi-channel PCM over HDMI is broken

Due to a bug in the nvidia drivers version > 185, multi-channel audio (in non-passthrough mode) will be sent as regular stereo. These are the consequences:

  • Multi-channel audio (typically AAC which XBMC needs to decode) will come through as a normal stereo signal
  • Voices are muted - they are supposed to come over the center channel, which has been discarded as consequence of the stereo signal

Possible workarounds:

  1. Use nvidia driver version 185 with ALSA 1.0.21 or later, or
  2. Use any nvidia driver version, but enable downsampling in the audio settings - you will lose surround, but at least everything can be heard.

Follow the discussion here: [1].

External Links