Media center setup – XBMC-XVBA

I finally got my nettop – AMD E-350 based barebones system. Installed 4G of RAM and the plan was to set it up with XBMCBuntu or XBMC-XvBA. Instead of installing the XBMC-XvBA version directly, I figured that I could start with XBMCBuntu, see how it does and then if necessary move to the XvBA enabled builds.

I don’t have a hard drive for the nettop – the plan was to have the system run off a 8Gig pen drive.

Basic Installation – XBMCBuntu

What you need

  1. The nettop with RAM installed.
  2. 2 USB pendrives – One for installation (2GB) and another which is going to act as your HDD (8G)


  1. Download UNetBootin for windows and the XBMCBuntu iso image
  2. Create a Live USB using UNetBootin: Once you have UNetBootin installed, stick in a flash drive in the usb, start UNetBootin and selec the XBMCBuntu iso image as the source distribution iso and the flash drive as the destination.
  3. Boot the nettop using the USB drive: You might have to play around with boot devices and priorities in the BIOS settings to get it to boot from the USB drive. To keep things simple, stick the pendrive into one of the USB2 ports (avoid the USB3)
  4. ON the UNetBootin boot menu, you can just try out XBMCBuntu live image. I did so and things seemed to work well enough for me to do the full install to another USB drive plugged into the system. Note that if you’re not able to find the target drive, then just reboot with both the USB drives plugged in – sometimes, newly inserted devices aren’t detected.
  5. Install, go through the menus and wait for it to complete.
  6. As you go through the menus, keep in mind to choose a custom partitioning scheme. In my case, I had 4G of RAM and there’s no sense in having a swap drive on the pen drive. If you plan on having hibernation support, then use a 2G swap partition (50% of RAM) – else you can skip the swap altogether.
  7. Once done, pull out the installation pen drive and reboot. You should be able to reboot off the USB pendrive that you installed into. The installation pendrive is pretty much done – you won’t need it any longer.


At this point, I had XBMCBuntu up and running however, there were a few problems:

  1. On idle, CPU utilization was very high (~ 60 – 70%) and the unit was running hot.
  2. Display resolution proved troublesome – my LCD’s native resolution is 1366×768 but that wasn’t available over HDMI.
  3. I was able to get 1360×768 on DVI/D-Sub – but that meant using a separate cable for audio out.

Of these, the high CPU utilization was the biggest worry – so there’s a few steps available to try

  1. Within XBMC – set sync to display refresh – always.
  2. Turn off RSS feeds
  3. Tweaks .xbmc/userdata/advancedsettings.xml:

    <loglevel hide="false">1</loglevel>
       <tvshowmatching append="yes">
        <!-- matches title 01/04 episode title and similar.-->
           <regexp>[s]?([0-9]+)[/._ ][e]?([0-9]+)</regexp>
      <gputempcommand>/usr/bin/aticonfig --od-gettemperature | grep Temperature | cut -f 2 -d "-" | cut -f 1 -d "." | sed -e "s, ,," | sed 's/$/ C/'</gputempcommand>

Did those and while they dropped the CPU utilization to about 25% which was quite good. However, during videos, the CPU was still high – and that’s because even though XBMCBuntu official uses hardware acceleration through VAAPI, it still is spotty.

Getting XvBA

I went over to the XBMC-XvBA installation thread and followed the directions in the first post to add the XBMC-XvBA ppas. The download took some time and XvBA build got installed. Started XBMC and things were much, much better.

    sudo apt-add-repository ppa:wsnipex/xbmc-xvba
    sudo apt-get update
    sudo apt-get install xbmc xbmc-bin

There are other tweaks that are listed on the XBMC-XvBA installation thread which I also went ahead and applied.

Other tweaks

Optimizing Linux for a flash/pen drive installation

Installing on a pen drive /usb flash drive has its pain points. My boot time was around painfully slow (~3.5 minutes). Opening Chromium took forever and even page loads were slow (it would be stuck with the status bar on ‘checking cache’…). Also, the incessant writing to disk is probably killing off my pen drive much much faster. I ended up doing the following:

  1. Use the noatime and nodiratime flags for the USB drive
        # /etc/fstab
        UUID=39f52ccf-363b-4b6e-abdd-927809618d83 /               ext4    noatime,nodiratime,errors=remount-ro 0       1
  2. Use tmpfs – In memory, reduces writes to disk and is faster. With 4G of RAM, this is a no-brainer.
        # /etc/fstab
        tmpfs /tmp tmpfs defaults,noatime,nodiratime,mode=1777 0 0
  3. Browsers – use profile-sync-daemon for Ubuntu from Arch Linux – will automatically move your browser profile directory from your home folder to /tmpfs
  4. Move .xbmc to NAS/External drive along with your media. Makes a lot more sense to keep your .xbmc folder with your media on a external hdd.
  5. Change to noop or deadline scheduler:
        # Assuming sda is your USB drive
        sudo echo noop &gt; /sys/block/sda/queue/scheduler
  6. Change system swappiness. We don’t want the OS to use swap drive at all.
        # /etc/sysctl.conf

Getting suspend/hibernate to work

I had greatest trouble here – but was able to get pm-utils working eventually. pm-utils is a framework of shell scripts around suspend/hibernation/wakeup that provides hooks to execute scripts before standby/hibernation and when the computer resumes from sleep/shutdown.
First test if basic suspend/hibernate works

    # check suspend methods supported
        cat /sys/power/state
    # S3
        sudo sh -c "echo mem &gt; /sys/power/state"

If your system goes into standby, then things are good. But its just a good start. In my case, system would go into standby only the first time after boot. After that, it would go into standby but then resume immediately. Its been asked enough times on Google and I’ve probably tried all the fixes. The first one is to update a kernel param acpi_enforce_resources=lax

    # /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_enforce_resources=lax"

After that, make sure to run

    sudo update-grub

In my case, the magic incantation above failed (your mileage might vary). Nothing bad happened so I kept it on. Anyway, so I rebooted, then suspended and resumed the first time (which works) and took a dump of dmesg > dmesg.1.log. After that again tried to suspend and when it came back immediately, I could get a dmesg output and scan the entries after the first run. Turned out that the log had entries related to xhci_hcd – so decided to unload it first and then try to suspend:

    sudo modprobe -r xhci_hcd
    sudo sh -c "echo mem &gt; /sys/power/state"

After this, the system was able to standby each and every time. Now it was time to get pm-utils working. Out of the box, pm-utils came with a config that had a bunch of things that I didn’t understand (and I doubt they applied to this machine). If standby was working directly, then it should have worked through pm-utils. However, it needed some amount of pushing around before that comes around to a functional state.

Getting pm-utils to play nice

So now that I had confirmed suspend working, it was time to see why pm-utils was being so bad. First off, time to clean up the default configuration. So copied /usr/lib/pm-utils/config to /etc/pm/config.d/config and then start editing it

    # These variables will be handled specially when we load files in
    # /etc/pm/config.d.
    # Multiple declarations of these environment variables will result in
    # their contents being concatenated instead of being overwritten.
    # If you need to unload any modules to suspend/resume, add them here.
    # If you want to keep hooks from running, add their names  here.
    HOOK_BLACKLIST="99_fglrx 99lirc-resume novatel_3g_suspend"

Waking up with the keyboard

if you’d like wake up with a usb device (usb keybd), then you need to find out the usb port where your device is connected. The easiest way might be to check dmesg output which would usually print this out. In my case, my wireless keyboard/trackball are connected on USB3

    echo USB3 &gt;  /sys/proc/acpi
    echo  enabled &gt; /sys/proc/devices/usb3/power/wakeup

After that, the HTPC could be woken up with a keypress. Now I haven’t been able to find a way to do the same thing with only the keyboard (so that the system doesn’t wake up anytime anyone picks up the keyboard – so for now, have turned this off). The above change won’t persist over a reboot – so to make it persistent, put the two lines above to /etc/rc.local before the exit 0

Fixing up fglrx annoyances (ATI binary driver)

Not much point of a HTPC if the video isn’t top quality. And there are a lot of variables involved there – your computer hardware, software, drivers, type of connection (HDMI/DVI) and the telly itself. Also, video driver support on Linux for ATI leaves quite a bit to be desired. One of the reasons of going with XBMCBuntu was knowing that there’ll be large community support available on ubuntuforums.

Right off the bat, things started at the mildly irritating level. Catalyst control center in root mode won’t start even though there’s a big fat menu item there. Quick google and it says that the easiest way out is to use gksu amdcccle in the run dialog (ALT-F2).

Full HD resolution

My telly (Panasonic 32″) came with a native resolution of 1360×768 – was pleasantly surprised when I found that with a HDMI connection it would let me go up to 1920×1080. Interestingly, even the telly on screen menu reports full HD resolution – so I’m not really sure if they did put a full HD panel and report it as 720p normally. In any case, I’m not complaining and Full HD videos do look better 🙂

So where does all this get us

After all this, it makes a sea change in the overall experience:

  1. XBMC idles at 15 – 20% cpu utilization. During video playback, stil stays at a comfy 40% – 50% while playing 720p/1080p videos
  2. Browsers (Chrome and FF) open near instantly; browsing experience is better than my desktop and page loads, tab switches etc feel much nimbler than on my desktop (AMD 6 core, 12G monster running Win 7×64)
  3. Total cost – USD 180

More to come

  1. Hibernation support
  2. Torrenting
  3. Scheduled wake up from shutdown/hibernate/suspend state


4 thoughts on “Media center setup – XBMC-XVBA

  1. Just Happened upon your post here…… Thankfully, so thanks for this.
    Just wanted to give you a run down of my setup since it seems the E350-1 mini ITX motherboard I have is very similar to the barebone system that you have.
    I am currently installing the XBMCBuntu beta 3 from Peter Anvin and then hopefully upgrading the XBMC to the XvBA install following your “apt-add-repository ppa:wsnipex/xbmc-xvba” etc. My system has a standard 1TB Sata HDD in it which I have partitioned +/- 800GB for a “secondary” and then I have a Swap file/partition (8GB) (I realize this might be over kill and completely unnecessary to be the size I have made it), A partition for “/” being around 30GB (Also over kill) and a “/Home” partition of 60GB. The reason I resorted to the massive size on all the partitions is because with it being around 8GB as before, it filled up at a speed unknown to even the likes of Linux. I can’t say why it did use all the space available on the /home partition due to the fact that I am what most people in the game would classify as a “Linux Idiot” :-). After it filled up for whatever reason to the capacity of the partition, it started becoming “anally slow” which I would assume is a natural thing, so I decided to re-do it with more space available just in case!!! Anyway, getting to the just of the matter, I was wondering, how, or what, if any tips you could bestow upon me in addition to the above tricks to get this box of mine running like everyone else on the XBMC forums seem to be obtaining. At present, I have only found a very few select ISO’s that actually make the box work, and I have tried far too many different installs combined with upgrading from a later distro to get a slightly newer version that is more stable than the previous version installed (Eg: I have in the past installed 10.1, and then done an upgrade to the beta3 Ubuntu disk to get the HDMI audio working, which worked quite well but only through HDMI, I have also done a beta3 install and then done a sudo apt-get install xbmc which landed me up with the latest and greatest XBMC for about 1 day and then it refused to log into the GUI once I rebooted it). All in all, I suppose practice does make perfect, but being the “Noob Of Noobs” in this regard, all I seem to land up doing on a monthly basis is managing to irritate myself because it doesn’t work like it is supposed to.

    Appologies for the lengthy “E-Book” here, but I thought it would be a good idea to actually “Ask For Directions”….. So to speak!!! 🙂

    Thanks again for the great post and hopefully I haven’t bored you to tears with the explanation.


  2. Follow Up:

    The Beta3 install and then upgrade to XvBA install does wonders for the 1080p and 720p files I have (All of which are in *.Mkv format), They all played like they were made for this install, however, all the other “Standard *.Avi” files are now dropping more frames than it is rendering. So I guess it’s back to the Fusion 10.0 install upgraded to Peter Anvin’s XBMCBuntu Beta3 until I can figure out why XvBA Is not playing the SD content 😦

  3. @Gadget – not sure why you’re having trouble with SD content… I don’t have any issues… maybe you can enumerate your video settings?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s