Friday, April 24, 2009

HOWTO Clean Ubuntu and remove not needed stuf


sudo apt-get clean
sudo apt-get autoremove

sudo apt-get install localepurge

Thursday, April 23, 2009

Easy Ubuntu XBMC Setup (v.05)

I have tried to switch to Linux earlier and one problem I had was that it was very hard to find information in a format that I could digest. Everyone that knows how to fix the problem insist on explaining how to download, compile and config from terminal when all you want to know is what button to press.

The other problem is that it is very hard to find a howto from start to end, you are often expected to know a lot of "basic" stuff that takes another day to figure out. I will try to explain all the steps. Please ask if I leave something out. The bad news is that already after two weeks I am shifting to do stuff in the terminal.

E.g. "sudo apt-get install" in terminal means install package and can be done graphically in the synaptic package manager found in /system/administration/ menu. Sudo means do as super user. ~/ means home directory. (possibly /home/xbmc/)

Install Ubuntu

I will actually assume that you can handle this. It is very easy. I used the Ubuntu 8.04 standard desktop .iso. (8.04 is LTS Long Term Support)

I will try to use XUbuntu to create my final setup.

The only thing I did was to do the partitioning manually since I need to keep one of the old partitions. I created a /swap, a / (root) and a /home. I created the /home so that I can re-install without losing my notes on how to do the installation again. I used ext3.

I named the user created during installation "xbmc" and I am using it to run XBMC. It is probably better to create an admin user and later manually create the xbmc user with just enough rights.

Critical post install configuration

1)Install all updates. I do this in GUI. Do not know howto in terminal
2)install ubuntu restricted stuff. In terminal:
sudo apt-get install ubuntu-restricted-extras
3=If needed enable the restricted driver for you graphical card and wireless.

Install XBMC 

Edited: 20090510
Together with reply from topfs2 (reply #10)

1) Install the key from
(As described in the web page above)

a)Put the key in a text file "xbmcHardykey"
b)Go to menu /system/administration/Software sources
tab "Authentication"
Import key – browse to the keyfile created above.

2)Add source
Go to menu /system/administration/Software sources
Tab Third-Party software ADD :
deb hardy main
deb hardy main

3) Install XBMC (in terminal enter:)
sudo apt-get update
sudo apt-get install xbmc

sudo apt-get install xbmc-eventclients*
sudo apt-get install xbmc-scripts*
sudo apt-get install xbmc-skin*

4) Make sure visual effects is set to "none" in menu /System/Preferences/Appearance

5) It should now be possible to start xbmc from /applications/ menu
or by entering xbmc in terminal. If you have not setup LIRC, use keyboard to control the menus.

6) I used the resolution setting in the XBMC/ settings/appearance/ menu to get a full screen. There is also a –fs (full screen) and a –standalone switch that I need to look into. I have only used the internal settings so far.

7) Connect an usb drive with a movie on or use "add source" to add a location with media.
-Play movie.

8) If the movie is played in the upper right corner you need to:
open a new file from terminal
gedit ~/.xbmc/userdata/advancedsettings.xml

add glrectanglehack xml.
Download here.
(right click and save file, it will not display correctly in browser)

or google "glrectanglehack xbmc"
9) You can enable auto login in /system/administration/login window – security

10) Quickest way to get autostart on login is to open /system/preferences/sessions/ and add “/usr/bin/xbmc” as the command in a new session called “startXBMC”
I need to find another way though, this seem to be connected to gnome(?) and I want to use a more lightweight window manager, maybe twm.

11) If problem with screen saver, open existing file xorg.conf
sudo gedit /etc/X11/xorg.conf
add at the end:
Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"

download here.
(right click and save file)

This should more or less by my basic setup version v0.5.

You probably want to enable vnc, ssh and maybe XMDCP. I can get back to that.

I have also installed remastersys and created my own installation/liveCD. Maybe I will upload itwhen I get closer to a v1.0 setup.

Tuesday, April 21, 2009

Monday, April 20, 2009

HOWTO mount tmp to ramdisk

Recommended if installing Linux to USB /Flash to avoid wearing down the disk.

sudo gedit /etc/fstab

none /tmp tmpfs defaults,size=424m 0 0

none /tmp tmpfs defaults 0 0

Then reboot

Howto re-run LIRC config

This will be useful. I have had to re-install LIRC to this.

sudo dpkg-reconfigure lirc

HOWTO Create LIve/installation CD from running system


add source 
sudo nano  /etc/apt/sources.list
deb ubuntu/

sudo apt-get update
sudo apt-get install remastersys

Problem with USB persistence.
Still does not work with version 8.04 at least not when creating with Ubuntu usb boot creator. Skip persistence and it works fine,

also see guide

Sunday, April 19, 2009



1) Converting live CD => USB boot with Ubuntu 8.10 tool
2) Install Ubuntu direct to USB
If used as permanent solution the tmp should be mapped to ram disk & no swap
3) Create a live CD from running system and convert to USB boot

Thin Client Media Center

I tested to run XBMC via XDMCP. The very loud test laptop becomes almost completly silent.

I have no sound and no remote. Sound is fixable from what I understand. USB / Remote could be a problem.

I would like to do some work on this.
Possible solutions:

Both supports sound and USB port mapping(?). 

Another solution with be to use network booting. However, I think the problem is CPU heat not HD.
The first step would be to isolate HD heat/noise from CPU by boot from USB. 

Select which media center application to use

What HTPC /MCE / Media Center should you chose?

I was already using Vista and xp MCE and I use that as reference.

Can do almost everything including TV time-shift & recording
Takes no time at all to setup if you know ms win. Works with remote and everything out of the box.
You have to do some advanced tweaking to enable multiple rdp sessions. Crazy.
It takes a lot of power. Vista is heavy by it self and if you start MCE it is very slow. You need a modern computer. (3GHz + 2-3G RAM)
You need to pay. You shall not steal? I if you do, it is extra work anyway. 

The most known system. Very advanced, has a frontend/backend setup which I like.
It support PVR and all kinds of TV functionality.
I tried the Mythbuntu installation CD. It worked ok out of the box, but I did not like it much. E.g. you have to type paths, no browse available. If you are going to test it you should probably know that Mythbuntu does not read media files directly from disk by default, it relay on the library. Change this setting unless you want to figure out how to load the library before you know if you have sound & picture. I could not get it to delete files from disk. I was intending to test a manual installation to learn more but moved on.
I never tried the TV functionality. 

I have not tested it. It has PVR / TV functionality.
Of course the name is from Tivo.

Gave it a quick test run only. It is a native gnome application and I think it could be very light weight. It is not finished yet and I could not get it to do much. Very easy to install since it is included in Ubuntu  default sw sources.
Could be the way to go in the future at least if you are running on a desktop computer and do some tasks with keyboard mouse. I mean library maintenance etc.

XBMC is now ported to linux and ready for use. Pre-compiled runtime is available for ubuntu which is a pre-req for me for the moment.

It looks and works great! It is working better better than Vista. E.g. in Vista you cannot delete a folder, no problem in xbmc.
It does not have PVR / TV functionality though. I understand it is possible to integrate with mythtv, this is not a prio for me right now. 

Compared to other applications it is working much better out of the box. However, you do not get the full package out of the box. Lirc has to be installed which is pretty easy if you know what you are doing but to get it to interact correctly with the OS takes some more work.

XBMC features not found in Vista
Delete folders
Resume video from where you stopped viewing
If playing video from a shared folder it works much better than in win. The player is buffering the file much better. On a good day it even works ok on wifi.

It is possibly a bit heavy on the HW but much less than Vista MCE and also a bit less than playing a video directly in the Vista desktop.  It does get the fan going though. I think it rates somewhere between XP & vista (ubuntu gnome + XBMC compared to win without MCE)

Popcorn is the most popular pre-built consumer media center. I have not tested it, but maybe I should?
I am not sure that using a PC as media center is the best way to go. It is loud and uses a lot of power. It is also expensive and to get it silent is more expensive.

Moving from win=>linux Media Center / HTPC

I have been using Vista Media Center for a while but I am now switching to a linux based system. I'm happy with Vista after some tweaks. (enable multiple rdp sessions etc). The problem is that if you for some reason do not want to pay, it requires some extra work and there is always the risk that the tweaks will contain virus. 

I was also using winxp MCE on an old laptop but xp stopped working after Christmas. The laptop cannot not handle vista media center and barely vista by it self.
This prompted me to finally make the move to Linux.

The problem is that I do not know Linux. I used unix back at the university but only learned ls, cd and a few other commands. Luckily I know other computer stuff  and I decided to give it a try.

I can tell you in advance it takes a LOOT of time if you are not an Linux expert. Yes, you can get Ubuntu to run in a hour, but to get to the level of vista mce out of the box takes a lot of work.

The good news is that the sw is great and I prefer it to vista when finally set up correctly.  

Saturday, April 18, 2009

Howto setup Remote for Ubuntu 8.04 XBMC with MS Remote

It is pretty straight forward to setup basic functionality but finding information is a nightmare.
The biggest problem was to get the shutdown to work with auto started irexec.

1) Remote control XBMC and other applications.
2) Start stop & kill XBMC with remote
3) Shutdown computer
4) Autostart irexec

Basic setup

The first step is to install and configure LIRC.

sudo apt-get install -y lirc
Select windows media center remotes (New version)
IR Transmitter: Select “none”

run irw in terminal and press any button on the remote, the name of device and button should show on screen.

This is pretty much it if you have a standard remote. I have had no problem with MS MCE Remote. You should now be able to control XBMC.

To control other applications you have to create your own button => function mappings.
This is stored in the .lircrc file in ~/.

This is best done by using the lirc generator from the mythbuntu team.

sudo apt-get -y install mythbuntu-lirc-generator
and you will get the lircrc files for the most common applications.

Totem is the standard player in Ubuntu 8.04, it is supported by this setup but first you need to enable the remote plugin from within the player.

Advanced setup
Download files & scripts here.

Setup start stop & shutdown
Most of this is from Some changes was necessary though.

We need irexec to do this and for good measure we setup irxevent as well. The latter is used to send keyboard commands. (ctrl-s etc)

install irxevent
sudo apt-get -y install lirc-x

create file named irexec in ~/.lircrc

# Start XBMC
prog = irexec
button = Home
config = ~/scripts/ &

# Kill XBMC
prog = irexec
button = Red
config = ~/scripts/ &

prog = irexec
button = Power
config = ~/scripts/ &

The '&' is necessary at least in my setup, otherwise the startXBMC will loop in the background and when I exit XBMC it is restarted several times.
I found the solution here

Create an empty file named irxevent in ~/.lircrc
It will contain the mappings for irxevent. I am not using it for the moment. I wanted to send ctrl-alt-Delete, but could not get it to work.

include ~/.lirc/irexec
include ~/.lirc/irxevent
to the ~.lircrc file

echo  "include ~/.lirc/irexec" >>  ~/.lircrc
echo  "include ~/.lirc/irxevent" >>  ~/.lircrc

The next step is to create the script files.
Pick them up at
Worked fine for me, I replaced /home/youruser/ with ~/ when possible. I think the remaining hardcoded usernames can be removed by following the comments further down in the thread (pidof?). I guess killall would also do the trick.

To autostart the irexec (and irxevent) add
to system/preferences/sessions. NB: ~/scripts does not work here.

First test to start manually from terminal

Run it twice and you should see that the script kills the old processes before the new is started.
ps -C irexec
should show one irexec process after two runs.

Now you should be able to start and kill XBMC. Kill should only be used when XMBC cannot be closed down the normal way I think.
Please note that I have mapped Power button to shutdown, when shutdown is finally working it will make it impossible to use the Power button to exit XBMC without shutting down the computer. The mapping can be changed in the irxec file. I think it can also be fixed by using mode in the lirc files to separate the applications.

Now to the shutdown..
I use
sudo /sbin/shutdown -h now
in the shutdown script. We can't have the script asking for password and this is fixed by editing the /etc/sudoers file. It is edited with this command:
sudo visudo.

First make backup
cp /etc/sudoers /etc/

This is where we hit the wall. The correct way(?) to do this is to add the line
youruser ALL=NOPASSWD: /sbin/shutdown
at the end of the sudoers file.

It worksfine if you start irexec manually from the terminal.
But after reboot and autostart shutdown does not work, everything else works fine.

I finally found a solution/ workaround.
%admin ALL=NOPASSWD: /sbin/shutdown

I am aware this is not a good setup, but it will have to do for a while. Can anyone help?

If you find this guide helpful let me know. I would be willing to re-write it with some quality if anyone needs it.