Tricking out your AppleTV running Linux

Upset that your old AppleTV is left in the dust following the release of the new $99 AppleTV? Get Linux installed on that thing, and make it useful again!

After getting Debian successfully installed on the AppleTV, I wondered exactly how many services can run on it without overloading it. So far, the following services are running:

  • Netatalk / avahi-daemon
  • Samba
  • GKrellMd
  • OpenVPN
  • Apache 2 + PHP5
  • Asterisk 1.6 + Cepstral TTS + Lobstertech VoiceChanger + PHPAGI
  • ircd-hybrid – IRC Server
  • Nagios 3 with ircd-hybrid integration

Netatalk / avahi-daemon

This allows the AppleTV to show up on the network as a Macintosh OS X shared drive. We could easily plug in a USB external drive and this extra drive would also be shared on the network. If you want more information on configuring Netatalk on Linux, check my earlier blog posts on the subject.


This allows the AppleTV to show up on the network as a Windows shared drive.


My favorite little monitoring app for Gnome, GKrellM allows you to monitor the server in real time from a little desktop widget.


A simple VPN server which allows you to tunnel home from work or coffee shops.

Apache 2 + PHP5

A standard Apache 2+PHP5 install is running on this machine. Here is a screenshot of the default page I created for it:

In order to conserve memory, decrease some Apache config values:

<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 5
MaxClients 50
MaxRequestsPerChild 0

WebDAV is enabled so I am able to quickly and easily edit this site using Coda.

Asterisk 1.6 + Cepstral TTS + Lobstertech VoiceChanger + PHPAGI

This AppleTV runs my VoIP phone server. Phone service is through Flowroute. If you call my phone number, it speaks out text to the caller using Cepstral TTS. Anyone placing calls using this phone system can spoof any outgoing number or change their voice with the help of the Lobstertech VoiceChanger module. Incoming spoofed CallerID numbers are “unmasked” and the true number is revealed. The main phone script is written with PHP code using PHPAGI. Surprisingly, the AppleTV CPU handles the Text to Speech very well and I don’t notice any CPU strain. Very flexible and fun phone system.

Here is a sample of what the code looks like:
function doMainMenu() {

global $debug;
global $fh;
global $agi;

$count = 0;

while ($count < 5) {
// Say Main Menu Script
$result = $agi->swift_get_data(‘Press 1 to ring the house phones or press 0 to leave a voice message.’);

// Capture which keys were pressed
$keys = $result[‘result’];
$key = $keys[0];
if ($debug) fwrite($fh, "Key Press:[". $keys[‘data’] . "]\n");

// Do something, based on which keys they pressed
if ($key == "1") doRingHousePhones();
elseif ($key == "0") doGoToVoicemail();
elseif ($key == "*") doLoginToVoicemail();
else {
$agi->swift("You didnt pick any options.");



The IRC server is used for Nagios 3 logging at the moment

Nagios 3 with ircd-hybrid integration

This is the newest addition, and a very sweet setup at that. Nagios 3 is an open source monitoring software. It monitors all of my equipment and servers and the services which are running on them. If CPU gets a little hot, or hard drive starts filling up, or website stops responding, it sends email/SMS notifications, and also sends a color coded notification to #nagios on the IRC server. Nagios uses Apache for the web front end.

General AppleTV tweaks

It turned out that the swap partition that I created was only 25MB or was only showing up as 25MB. This is a problem since this AppleTV only has 256MB of internal RAM. I ended up setting up a loopback swap file which basically allows you to have a ‘file’ on your main partition which will behave as a partition. This 512MB file is mounted as the swap for the system and is working perfectly.

dd if=/dev/zero of=swapfile bs=1k seek=512k count=1
mkswap swapfile
losetup -f
losetup /dev/loop0 swapfile
swapon /dev/loop0

You can verify that it worked with either of these:
cat /proc/meminfo | grep -i swap

Here is a screenshot of ‘top’ running on the AppleTV with all of these services running:

Check out the load average! This machine is simply kickin’ back!

If anyone is interested in more detail how any of these services are configured or if you have any suggestions on what other services should be added to this project, drop me a comment.


Running Debian on AppleTV

I decided to install the latest Debian to my old AppleTV in order to use it as a server in the house. It has 160GB hard drive, 256MB RAM and a 1GHz processor. I think it could work well for NAS and VPN.

I pulled the drive out of the AppleTV and hooked it up to my mac with a USB to IDE converter cable (All of this work is done on the Mac running Ubuntu under VMWare). It would be a little easier simply having a Linux machine handy. Then we wouldn’t have to deal with the virtual machine and host OS fighting for the USB devices. Anyway, you just need that AppleTV drive plugged into a Linux host to do these commands:

I used this method to prepare the drive:

Then booted up a Debian installer with VMWare, and installed Debian to partition #4 on the drive with partition #5 as swap. Do NOT install GRUB to the MBR, the recovery files that are placed in the two AppleTV partitions will search for menu.lst and boot that grub. You may need to install (create) menu.lst by hand, especially if your particular distro uses GRUB2 like the latest version of Debian does.

Here is a copy of the /boot/grub/menu.lst which I created by hand:
default 0
title DebianTV
root (hd0,3)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda4 ro quiet processor.max_cstate=2
initrd /boot/initrd.img-2.6.26-2-686

After the OS install is finished, I sync and remove the drive from my Linux machine. Put the drive back in the AppleTV and booted it up. The AppleTV should boot straight to linux.

Apple AppleTV

AppleTV 3.0.1 works well, so far

appletv30menuUpgraded to AppleTV 3.0.1 last night, installed the mods. Everything is going well so far! Have all features working such as AFP, SSH, full Codec support thanks to Perian, plus the new 3.0 menu system and iPhone Remote.


AppleTV 2.4 Black Screen when playing video

After upgrading to AppleTV 2.4 and installing Perian, I no longer can play Apple videos. The device just shows a black screen. Sometimes there is sound.

Edit: found a fix from westont on AwkwardTV:

Sure enough, looking in the /System/Library/QuickTime folder I found a ‘Disabled’ folder had been created. This folder contained the ‘QuickTimeH264.component’ file which had clearly been moved there by something. Moving this file back to the /System/Library/QuickTime folder and rebooting the ATV got everything working again.


Streaming a webcam in Linux with VLC

I wanted a simple way to make my Linux security camera server stream live video to my TV.

The server ususally runs “motion”. I disable motion, and launch this command on the server:

vlc v4l:/dev/video0:size=640×480:channel=1:norm=ntsc:fps=12 –sout ‘#transcode{vcodec=mp4v,vb=768,scale=1}:duplicate{dst=std{access=mmsh,mux=asfh,dst=:8080}}’ -v –noaudio

and this on a Linux client to test:


Then, once that is all working, I use VLC on the AppleTV to play the video to the TV. I used iScripts to get it launching.

The only problem I have right now is a 8 or so second delay.


AppleTV – Got System Prefs working!

Fixed System on Take 2:

You have to copy PreferencePanes.framework from your Tiger disks. Copy them to /System/Library/Frameworks/

This is going to lead the way to me getting the Ethernet port sharing Internet over to the XBOX. So I can get rid of the extra unneeded WiFi box under the TV.


XBMC and Boxee on AppleTV

XBMC on AppleTV is fantastic. It’s polished. It’s stable. It just works.
Boxee was a bit too Alpha quality at this time. The social aspect of it is a bit more scary than useful.
I’m not going to do a huge writeup on the features of each of these applications. I just want to say that XBMC is fantastic and it’s my new favorite app on AppleTV.


Weekend AppleTV Modding

These are the steps I take to mod the AppleTV. There are a ton of howtos out there and this is mainly a resource for myself to remember how to do it. I hope it helps someone else mod their AppleTV. Please send me anything I missed!

Apple AppleTV

More AppleTV Updates

Trying to get System Preferences working so I can bridge or route the Ethernet port on the back of the AppleTV to my XBox. I was not able to accomplish this yet, but in my journey, I accomplished the following:

Flash Installed (can watch Hulu)

Firefox Installed

VNC working