Posts Tagged ‘Linux’

Turning your Asus eeeBox B202 into a XBMC

June 28th, 2009

I recently became owner and custodian of one of these cheap puppies

asus_eeebox_eb1006_01
Image by nDevilTV via Flickr

It’s a cute bit of hardware. Not sporting a powerful CPU, not boasting a kachunga of RAM and not carrying a large HDD, but for $360 what can you expect? The original intention behind this purchase was to use it as a cheap replacement for a Linux based web-server, but it seemed like such a shame to let what little spare power it has go wasted – turning it into a miniature media centre was an easy decision. The nice thing about XBMC is that there’s a version for Linux running on Ubuntu. This brief notation is my experience setting it up to run on my TV. It assumes you know Ubuntu reasonably well and are comfortable hacking at it.

Tools Required

Preparation

The eeeBox doesn’t come with a native CD/DVD-ROM, but you can easily jig something together by using an external EIDE HDD enclosure and a DVD-drive from any old PC. Just connect the cables together and you have yourself a working USB DVD-ROM.

Install Ubuntu

Firstly make sure you run a network cable into the eeeBox. Even though the wifi works fine, you’ll be downloading a stack of updates and doing that over 100MBps is better than 54MBps.

So pop in the Ubuntu desktop live CD and go through the standard installation. This might take a while depending on your setup, but just install the plain operating system and reboot. The installation has good defaults for partitioning when you let it decide what to do with the whole disk – just roll with it, unless you know what you’re doing. The nice thing about the desktop edition of Ubuntu as opposed to (say) the server edition is that it comes pre-packaged with all the necessary drivers:

  • Video: Intel Mobile 945GME Express Integrated Graphics Controller
  • Audio: Intel 82801G High Definition Audio Controller
  • WiFi: RaLink RT2860
  • Ethernet: Realtek RTL8111 Gigabit Ethernet controller

Additionally, it installs things like a working x-server and ALSA so that you don’t have to. It’s (by far), easier to start with desktop edition and cut-back, than to start with server and build up.

After reboot and login, the system will take you directly to your Gnome desktop. The autoconf would have detected the network connection and (assuming you have a local router/DHCP server) you’ll be on the network in seconds. Update Manager will then run a check for updates. You want to download and install these updates! In particular, Jaunty had graphics performace issues with the Intel GME 950 in its original release. I’ve found that an out-of-the-box installation doesn’t exhibit this problem anymore but its still a good idea to run the update first.

The desktop edition of Ubuntu doesn’t come with ssh natively installed. you can rectify this with:

$> sudo apt-get install ssh

There’s a good chance you’ll need to restart again after the updates.

Install XBMC

Once re-booted, we want to install XBMC from the package archive for your version of the system (again, assuming Jaunty). Using your fresh ssh install, you can PuTTY into the box (my personal favourite) and add the two following lines to your /etc/apt/sources.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 you need to add the signed public key to the apt key register:

$> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9317790E

The most important step of all:

$> sudo apt-get install xbmc-standalone

Why standalone? The standalone version of XBMC contains “certain functions that are not available in normal XBMC for Linux, (or XBMC for Mac, or for Windows), these functions include Power Management, and Network Management.“. The power management alone is worth it.

At this point I recommend testing the installation. Load XBMC from the Applications menu and set your resolution + other options. Setting the resolution is quite important here because (as i found out later) you’ll need them if you decide to run a seamless boot sequence into XBMC

Configuring A Seamless Boot Sequence

By this, what I mean is that when your system boots, it will automatically log in as you and boot into XBMC and you wont incur the unnecessary overhead of running Gnome in the background as you might otherwise have. You can fall-back to Gnome if need be, but the default desktop environment will be set to XBMC.

In Gnome, click System > Administrator > Login window. In the dialog, make sure you set your password and for the default session choose XBMC. I’d also suggest the auto-login feature. It gives you a chance to break into Gnome or a failsafe terminal should you need it.

Restart your box in preparation!

At this point, if you should be unlucky (like me) and your resolution settings are lost after changing the default session, you’ll need to copy them from the original settings we set earlier. Fortunately this should be easy. Log onto the box as you and enter the following:

$> cd ~/.xbmc
$> mv userdata userdata_backup
$> cp /usr/share/xbmc/userdata . -r
$> killall xbmc

If you set up Gnome correctly, you should go back to the login screen and be able to log back into XBMC with full res.

Wireless Configuration

The last piece of the puzzle is getting the wireless to work. This should be too easy. Just edit the /etc/network/interfaces file and add the entry for the RaLink RT2860 wireless device (ra0). In my setup, i’m using WEP so it looks like this:

iface ra0 inet dhcp
  wireless-essid <SSID>
  wireless-key s:<PASSPHRASE GOES HERE>
auto ra0

Reboot one last time just to make sure it all works and you’re done!

What this doesn’t cover is how to configure an IrDA device for truly integrated experience. The B202 doesn’t have IR built-in but once i find a suitable device, you can bet i’ll be writing about it.

:)

Reblog this post [with Zemanta]

Mass Reverse-DNS Lookup

September 4th, 2008

I needed to quickly browse through some web-server logs and pull out the hostnames which were accessing the web-server (to see where people were originating from).

The following single linux command will pull the IP address out of the apache log (for a particular date) and do the reverse DNS lookup for me:

cat access.log | grep ’1/Sep’ | awk ‘{print $1}’ | sort | uniq | xargs -n1 host | grep -v ‘not found’

just in case i ever need it again….

Tunnel World of Warcraft Through SSH

July 21st, 2008

On Saturday I had to take the wife to UTS library so that she could do some research for her masters thesis. With petrol prices being the way they are, and just generally the amount of time it was going to take to go home and come back, I’d decided i was going to pop into the office with my laptop, and play WoW for 2-3 hours while I waited for her. Flawless plan, really. The last time i took my personal laptop to the office, everything worked no problems and I was actually able to log onto WoW.

Well not so lucky this time :| . The IT admins had obviously blocked the WoW ports through the firewall. So after a bit of Googling and reading, I came across this article which clearly explains How To Tunnel WoW Through an SSH VPN Using Only Linux and PuTTY.

It was so awesome, it worked straight off the bat, no extra tweaking, I just had to blog about it. My only gripe would be that the latency was too high for me to do any instancing (i had about 800ms latency at best, and 3000 at worst). But that’s a combination of the fact that my company doesn’t want to pay for a fast internet connection, and my Linux server runs over wireless.

Mounting NAS drive under Ubuntu

June 9th, 2008

I’ve been battling this one for a long time….Finally got it solved…..(sort of)……

Last year, I bought a cheap $70 NAS external drive case to use as network storage…The poor man’s SAN, if you will.

Since I bought it, however, i have been unable to mount the drive under the linux console so that i can access it’s contents in bash script. Accessing the drive from Gnome file browser, works fine, however.

I tried and exhausted all options:

  1. Using smbmount (although deprecated) would mount the drive, but the contents of any subsequent directory listing would be garbled and look like corrupt text

    ———- 1 root 16 114P 1940-10-24 12:26 ?
    ———- 1 root 16 114P 1940-10-24 12:26 ?~?????
    ———- 1 686040 32 115P 1940-10-24 12:26 9.jpgj
    ———- 1 root 16 114P 1940-10-24 12:26 and star cityg

  2. Using mount.cifs would not even get that far – it would just mount error out with:

    mount error 20 = Not a directory

And then i stumbled across a newsgroup post which had the answer:

modprobe cifs
echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled
mount /mountPoint

According to this link apparently the NAS drive doesn’t support the smb extensions supported by my client’s kernel, so disabling them allows me to mount the drive successfully…

i don’t know what the Linux extensions actually are, but i’m guessing that they have something to do with codepages and the interpretation of content, because now when i try and browse the mounted directory under Gnome’s file browser, it comes out all garbled…no problem….i can still browse the network share directly through gnome so no need to browse the share….

Just another day in front my computer…..

EDIT:
On the upside, i’m now able to mount the network drive on my linux server, and share the network mount using samba on the server. This is a long and nasty workaround to the problem that Vista can’t access the NAS server without patching the NAS device itself.