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

From Official Kodi Wiki
Revision as of 10:58, 30 January 2009 by >Olympia (→‎Fixes, tricks, tips)
Jump to navigation Jump to search

Introduction

After my XBMC Live guide, I decided to put together a guide for installing XBMC on Ubuntu Intrepid Minimal CD version as well.

Please note:

  • I only tested this with nvidia, so I have no experience with ATI
  • The guide is for using XBMC on a dedicated HTPC, so there is not any window manager installed
  • You need minimum 4GB size flash drive or hard disk to go

This guide walks you through how to install every needed components and XBMC itself, but try to leave to footprint as small as it can.

You will get:

  • A dedicated HTPC autoboot to XBMC
  • Latest XBMC SVN version
  • Upgraded ALSA driver
  • Upgraded NVIDIA driver
  • Lirc (I have MS MCE Remote which works out of the box, so everybody with other remotes and LCD displays are in his/ her own to solve the individual Lirc issues)
  • Suspend/ resume (works perfectly on ASUS P5N7A-VM)

So, let’s start:


Preparation

FIRST STEP
Download, burn and install Ubuntu Intrepid mini.iso from here: https://help.ubuntu.com/community/Installation/MinimalCD

Apparently there seems to be an issue with Intrepid installer. If you are using flash drive, it's not installing GRUB for some reason.

You have to options:

  1. Either install Hardy(Ubuntu 8.04) mini.iso first, which is install GRUB, then right after that, install Intrepid mini.iso over the same flash drive. It will reformat the drive, but GRUB will stay alive on the drive.
  2. Second option is that right after Intrepid mini installation, boot up Intrepid mini.iso from the CD again, choose rescue mode, and there you will find an "install GRUB" option.

During the installation, please set „xbmc” as username and password at the account creation.

At the end, when you have to choose from the optional components, check only „OpenSSH” to be able to access your HTPC remotely via SSH.

After you’re done, boot it up, then use an SSH application (e.g. putty) to log in remotely from your desktop, using the above created username and password. This way, you will be able to copy/ paste all the steps below. Alternatively you can use your console, but then you will have a hard time type in everything.

So once you logged in:

First of all, update the repos, and install all prerequisites:

NEXT STEP

# sudo apt-get update

NEXT STEP

# sudo apt-get install –y localepurge subversion make g++ gcc gawk pmount libtool nasm automake cmake gperf unzip bison libsdl1.2-dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libsdl-sound1.2-dev libsdl-stretch-dev libfribidi-dev liblzo-dev libfreetype6-dev libsqlite3-dev libogg-dev libasound-dev python-sqlite libglew-dev libcurl4-gnutls-dev x11proto-xinerama-dev libxinerama-dev libxrandr-dev libxrender-dev libmad0-dev libtre-dev libogg-dev libvorbis-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libfaac-dev libenca-dev libxt-dev libxmu-dev libpng-dev libjpeg-dev wget build-essential linux-headers-`uname -r` xorg pm-utils mingetty


During the installation of the packages, there will be a popup window to choose your locale languages to let "localepurge" know which locales not to remove in further installations. I would suggest to keep all en_us (3 all together) and your own country locales (again should be 3) as well. Localepurge will save you some space with removing unneccessary languages.

Please note: this guide is for dedicated HTPC, so we need passthrough most of the cases, so I choose NOT to install the libs for Pulseaudio and compile XBMC later without Pulseaudio support.

Upgrading ALSA (sound driver) to the latest version

I have modified the ALSA upgrade script (available at Ubuntuforums), and now it is working with only “-di” option in our case here (Also on ASUS P5N7A-VM).

To download and use the script:

NEXT STEP

# wget http://217.20.138.65/AlsaUpgrade-1.0.x-rev-1.15-Ben.sh

NEXT STEP

# chmod 777 AlsaUpgrade-1.0.x-rev-1.15-Ben.sh


NEXT STEP

# sudo ./AlsaUpgrade-1.0.x-rev-1.15-Ben.sh -di

This mini version of Intrepid has a bug (or maybe a feature): the user created at installation is not added to the „audio” group. We need the correct this:

NEXT STEP

# sudo usermod -a -G audio xbmc

or replace „xbmc” with username you installed with

reboot the computer:

NEXT STEP

# sudo reboot

For some reason, the driver snapshot for ALSA 1.0.19 is not always downloading properly; in this case you have to run the script again. To check whether the driver upgraded or not:

NEXT STEP

# more /proc/asound/version

If you see driver version 1.0.19 here, you can continue, but if there is 1.0.17 as driver version, then you have to repeat the last 3 step (upgrade, reboot, check).

If it’s OK, then you can delete the just downloaded ALSA source to free up some disk space:

NEXT STEP

# sudo rm -r /usr/src/Alsa-1.0.19/

Now run alsamixer:

NEXT STEP

# alsamixer

Navigate right with cursor keys until IEC958 and unmute all three of them (IEC958) with „M” key. You should see in case of all three IEC958 a „00” in green background. Press „ESC” to quit from alsamixer.

Now, you have to edit the following file, using nano for example:

NEXT STEP

# sudo nano /etc/modprobe.d/alsa-base

and add this line to the end:

options snd-hda-intel model=6stack-dig


Update Video driver

NVIDIA

(For Ati owners: #ATI)

NEXT STEP

# wget http://us.download.nvidia.com/XFree86/Linux-x86/180.22/NVIDIA-Linux-x86-180.22-pkg1.run

NEXT STEP

# sudo sh NVIDIA-Linux-x86-180.22-pkg1.run

In the nvidia installer: accept the License agreement, choose „YES” for „No precompiled kernel interface...”, choose „OK” for „No matching precompiled kernel interface...”, than choose „YES” to update X configuration file, than finally „OK” again at the end.

Now you can delete NVIDIA installer

NEXT STEP

# rm NVIDIA-Linux-x86-180.22-pkg1.run

(To continue click on: #Download, compile, and install XBMC from source (skip ATI section))

ATI

NEXT STEP

# sudo apt-get install -y cdbs fakeroot dh-make debhelper debconf libstdc++5 dkms

NEXT STEP

# wget http://www2.ati.com/drivers/linux/ati-driver-installer-8-12-x86.x86_64.run

NEXT STEP

# sudo sh ati-driver-installer-8-12-x86.x86_64.run --buildpkg Ubuntu/intrepid

NEXT STEP

# sudo dpkg -i xorg-driver-fglrx_8.561-0ubuntu1_i386.deb fglrx-kernel-source_8.561-0ubuntu1_i386.deb fglrx-amdcccle_8.561-0ubuntu1_i386.deb

NEXT STEP

# rm ati-driver-installer-8-12-x86.x86_64.run  *.deb

Download, compile, and install XBMC from source

NEXT STEP

# svn checkout https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC

Wait for downloading XBMC source files, might takes long time, depend on your Internet connection. After it downloaded:

NEXT STEP

# cd XBMC

OPTIONAL STEP
If you experience problems with Intrepid ffmpeg performance (most probably you will) which is under discussion here: http://forum.xbmc.org/showthread.php?t=43075, you may want to try aron's patch (thank you aron, for this).

Please be aware, that this is not supported and not recommended by team-XBMC. If you don't want to install this patch, just skip all the optional steps and jump to the closest "NEXT STEP".

OPTIONAL STEP2

# wget http://trac.xbmc.org/raw-attachment/ticket/5680/xbmc_ffmpeg_mt.patch

OPTIONAL STEP3

# patch -p0 < xbmc_ffmpeg_mt.patch

Then configure/compile/install XBMC:

NEXT STEP

# ./configure --prefix=/usr --disable-pulse

NEXT STEP

# make -j2 (Please note: use only „make”, if you don’t have a dualcore CPU)

This is again, can take quite some time, depending on your CPU speed.

NEXT STEP

# sudo make install


Autoboot and autostart XBMC

NEXT STEP

# cd $home

NEXT STEP

# wget http://217.20.138.65/.xsession

NEXT STEP

# sudo nano /etc/event.d/tty2

In here comment out the last line (with #) and add the following line. The end of the file should look like this:

respawn

#exec /sbin/getty 38400 tty2
exec /sbin/mingetty --autologin xbmc tty2

Or replace "xbmc" with the username you installed Ubuntu Mini.

NEXT STEP

# sudo nano .bash_profile

Copy the following text, then save the file:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty2 ]; then

startx -- -br

fi


Install Lirc

I've found MS MCE Remotes, lsited here: http://www.mythtv.org/wiki/MCE_Remote, are plug & plays, working out of the box. I also found, that there're remotes out there, which instalation are a real pain. The choise is yours. If you have one of the above mentioned MS MCE remotes, the installation is that simple:

NEXT STEP

# sudo apt-get install –y lirc

And follow the wizard.

Power Management

To be able to control power management (suspend, shutdown, reboot) from within XBMC, you have to modify PolicyKit.conf to grant privilegies to your user for power management. There is a preprepared PolicyKit.conf for this, you can get it by:

NEXT STEP

# sudo wget -P/etc/PolicyKit http://217.20.138.65/PolicyKit.conf

Please note: if you installed your system with username other than "xbmc" at the begining, you have to modify that in the file.


If you wish to enable CPU scaling, install the required packages as the following, but don’t forget to enable it in the BIOS as well.

NEXT STEP

# sudo apt-get powernowd

Configure xorg.conf for proper modes to benefit from auto refresh

This is not an easy part and can differ from display to display. For myself, I include 3 custom modelines to my xorg.conf for my FullHD plazma screen.

If you have a FullHD display, and want to play with my xorg.conf you can replace your xorg.conf with mine:

NEXT STEP

# sudo cp /etc/X11.xorg.conf /etc/X11.xorg.conf.backup

NEXT STEP

# sudo wget -P/etc/X11 http://217.20.138.65/xorg.conf


Install Splash

NEXT STEP

# sudo apt-get –y install usplash libusplash-dev

NEXT STEP - CHOICE 1 - Downloading spinner-blue

# wget http://download244.mediafire.com/cdznzwztejbg/wmbwqzo2ggq/spinner-blue.zip

NEXT STEP - CHOICE 2 - Downloading pulsating-logo

# wget http://download101.mediafire.com/mzyxltj3vslg/tt32ymnvkjt/pulsating-logo.zip

NEXT STEP

# unzip spinner-blue.zip (or pulsating-logo)

NEXT STEP

# cd spinner-blue (or pulsating-logo)

NEXT STEP

# make -j2 (Please note: use only „make”, if you don’t have a dualcore CPU)

NEXT STEP

# sudo cp xbmc-splash.so /usr/lib/usplash/usplash-theme-ubuntu.so

NEXT STEP

# sudo nano /etc/usplash.conf

and set your desired splash resolution, so inserting the following to here:

xres=1920
yres=1080

NEXT STEP

# sudo update-initramfs -u


Fixes, tricks, tips

Enable the eject button on your ODD

# sudo nano /etc/sysctl.conf

and uncomment (by deleting # from the begining of the line) the last line, so it will look like this:

dev.cdrom.lock=0

Fasten the boot by reduce GRUB waiting

# sudo nano /boot/grub/menu.lst

Find the timeout (currently set to 3) and change this to 0


  1. remove a few tty. By default there are F1 through F7, we do not need all seven: in folder /etc/event.d/ comment out all entries in tty4 tty5 files. Three vts should be enough.
  2. Profile your boot.

When you have the Grub menu to start your system, hit the “e” for edit the kernel line you normally start with. Then move to the end of the Kernel line and edit quiet splash to quiet splash profile. Don’t save this line just let it boot up “b” once with this profile parameter. This boot will go very slow because it is profiling (read putting all read disk blocks behind each other) the normal boot to optimize performance. All subsequent boots will then go faster. If all boots go very slow afterwards make sure that the profile parameter was not saved as a boot option.

6 seconds save!) Enable concurrent booting allows Ubuntu to take full advantage of dual-core processors, as well as processors that hyperthread or multithread. NOTE: this doesn’t seem to work for me. It messes up GNOME loading, probably due to an unsolved race condition. However, if you manage to have it notably improves your boot loading time.These settings are located in your /etc/init.d/rc file. sudo gedit /etc/init.d/rc Look for CONCURRENCY=none and change it to: CONCURRENCY=shell

sudo apt-get install sysv-rc-conf sudo sysv-rc-conf

vi /etc/inittab then comment out tty4,tty5, and tty6. Just leave tty1, tty2, and tty3. Three vts should be enough for a laptop or desktop user. Save the file.

2. ok, open your eyes and look very carefully for those SERVICES THAT DO NOT HAVE A "X" ON ANY RUNLEVELS (Any runlevel means 1,2,3,4,5,6, and S), write them down one by one. Don't make mistakes here. Double check after you've done. Thanks ice60 for wording recommendation! 3. quit sysv-rc-conf. 4. Code:

cd /etc/rc0.d

- This is for the system shutdown process. 5. ok, now, Code:

ls K*

will list all links starting from UPPERCASE letter "K". Compare with your list, change each of the filename containing the service name in your list to start from a lowercase "k". For example, in your list, you have ppp service (which means ppp is turned off at all runlevels), then you can do like: Code:

sudo mv K00ppp k00ppp

. You just change the UPPERCASE K to lowercase k, keep the rest the same. Do this on all of the services in your list. 6. Code:

cd ../rc6.d

- This is for the system reboot process. 7. ok, you should see similar things here too. So do the same thing here as you did on rc0.d. 8. Now, you reboot and shutdown process should be cleaned up and faster.

The explanation for what you did is pretty simple. The /etc/rc and /etc/rcS scripts run start on each link on each runlevel by scaning if it is starting with a UPPERCASE "S" and run stop on each by scaning if it is starting with a UPPERCASE "K". So for reboot and shutdown runlevels, the most thing we care is the "K" links cause for those services not running on all runlevels, its just not needed to stop them. They are not runing at all. If some day you want to turn some of the services back on, just change the lowercase "k" to UPPERCASE "K". That's all.

Anyway, it is not intend to work on servers, but I did try on one of my servers has 2.7G P4 and 1.5G mem. It brought the boot process down to 31 secs. I calc'ed it with my watch. Besides, this is with my ftp server and nfs server started on boot time.

    • Note**

For all of those that having HAL failure problem, try this: 1. change acpi-support from S to 2,3,4,5 2. change acpid from S to 2,3,4,5 3. change dbus from S to 2,3,4,5 4. Reboot. Go to the console and do Code:

ps -aef|grep hald

. If hald service is up, then your dbus subsystem is running fine now. Try it.

Sound configuration in XBMC

After booted into XBMC switch to „digital” audio output, than choose the AC3 and DTS capabilities according to your receiver. For SPDIF: leave audio output device: default and passthrough on IEC958 For HDMI: change both audio output device and passthrough to hdmi (you will loose analog sound eg. navigation sound in case of hdmi)