Rezaf Diary

I'll write about my daily life, as a PhD Student at the University of Illinois. I'll put some photos from my town, Urbana, and some music.

Sunday, December 23, 2012

More from AppleTV Linux Saga

In my last post I mentioned my adventure with installing linux on an Apple TV (1st gen). I spent another couple of hours on it, and got it to a good shape. Here I'd like to document the steps. For some more info, read the post right before this one.

Step 0. Get an AppleTV. Open it up and replace the hard drive with a new one. Well you can use the old one if you'd like.

Step 1. Create an ATV-Bootloader USB disk. Use the excellent GUI tool from here:

Step 2. Boot into ATV-Bootloader using the USB disk. Then, Partition the hard drive using: I ended up creating 5 partitions on my hard drive.

Step 3. Download a Linux live CD image and burn it on a USB disk with a command like like
dd if=/path/to/img of=/dev/sdb
. Now, I tried many combinations of Ubuntu. Eventually I settled on using 8.04 hardy. Technically no one on the internet has managed to boot AppleTV with Linux Kernel 3.x, so you're stuck with 2.6.x branch. On Ubuntu side, that is at most 11.04. I did try 12.04 or 12.10, but neither boots up. 11.04 installer didn't boot up completely, complaining about not finding a cdrom. I didn't try the ubuntu 10.x or 9.x branch either. Also ubuntu 9.10 and higher use grub2 bootloader that is incompatible with ATV-Bootloader. There is a download package on ATV-Bootloader website that supposedly fixes this, but I cannot verify it.
Long story short, save yourself some trouble and stick to 8.04. I didn't and wasted a lot of time on it. Anyway, the instructions on this page are very good for booting into the Linux installer:
I suggest alternative CD installers or ubuntu-servers, as the graphical installer uses too much memory, which will end up freezing the AppleTV.

Step 4. Go on with the installation.

step 5. In order to not need the USB disk to boot, you can install the ATV-Bootloader on the proper partitions you created in step 2.

Step 6. You can make the whole thing bootable by editing and changing "none" to "auto". By now, you should have a proper ubuntu 8.04 server installed on your AppleTV, and when you turn it on it should load up all the way to a command prompt login.
Now let's try installing a graphical interface.

step 7. Install X11. sudo apt-get install xserver-xorg-core xserver-xorg-dev xinit xfonts-base x11-xserver-utils xauth

step 8. Before rebooting, download the 304.x version of NVIDIA graphics driver from their website and install it.

step 9. Ok, now that we have X11 and a graphics driver, let's install a Desktop environment. Currently LXDE is known as the most efficient and usable desktop environment.

step 10. Let's reboot the machine. If you're lucky, you should boot into a working environment.

step 11. Install the wireless network driver:

step 12. Install the sound driver. Well I install it but I don't have HDMI audio, and haven't tried analog ones yet.

step 13. (from the same link as above) install atvclient, which stops the annoying LED blinking.

step 14. I suggest not updating your packages. I did, and it broke my openbox window manager, and no matter what I couldn't get it to work again. I eventually had to remove it, install lxde 'lite' session manager, and replace openbox with metacity (sudo pat-get metacity, and change a config file, google for it) to get it to work again.

step 15. Unfortunately installing LXDE this way is an underwhelming experience as it comes with no pre installed program, and still some of the programs that I install do not work (including firefox and opera, but midori works and is a decent browser).
Unfortunately the first ubuntu version which had lubuntu alternate installer CD (to escape from the graphical installer) is 11.10, which has a Linux kernel 3.2.x that in incomatible with ATV, and it's a no-no. I tried installing ubuntu-server 11.04 and planned to run "sudo apt-get install lubuntu", but as mentioned earlier the installer got stuck looking for a real cdrom.
In retrospect, I probably should have picked xubuntu instead of lubuntu (edit: LXDE works just fine, thank you!). Still, I have a decent setup as of now. Well, no audio yet and flash didn't work in midori. Latest version of firefox works fine and plays youtube flash videos full screen sized! (with about 100MB of memory usage). It's a full Linux box with decent GUI at the moment. The only thing that doesn't work yet is HDMI audio, and I haven't verified if analog audio is working (Apple TV uses RCA outputs, kind of non-standard) but the analog audio output works just fine. But Hulu videos are slightly choppy. Still watchable, but a but choppy. During a Hulu playback session in full screen, the flash plugin uses about 85% of CPU cycles and 52% of the 256 MB memory. The firefox process doesn't use much CPU cycles (0.7%), but uses another 15% of the physical memory. I credit the adobe flash player's use of the nvidia GPU capabilities. My guess is that the CPU is basically used for network and streaming workload, and the GPU takes care of the rest.
For now I'm going to call it a day and use it the way it is now. If I do more, I'll post it here.

Edit: I decided to set it up for now as a home server for remote ssh and possibly a web server. I could use it for squid too, but these services will come at a later point.

Why? Well I forgot to tell you that I removed the fan inside the Apple TV, and it is working just fine. The fan seems to be useless, it's not even installed on the CPU, It's just there. Anyway, without the fan, I have a noise-less machine at my home. Perfect for a 24/7 server.

Another piece of info about the memory usage. gnome-system-monitor reports that the current installation (with lxde and metacity) uses a grand total of 68MB of active, writable memory, and 188MB of free memory. That's a drastic change from when I had Mac OS 10.5.8 running on it, when the free memory would at best reach around 50~60MB. I'd say, mission accomplished!

Note: Click on the photos to enlarge them.

If you feel interested in any of them and want to get the original file, please don't hesitate to email me!


At 1:18 PM, Blogger Steve said...

I was able to get Kernel 3.2.0-40 installed with the Ubuntu Netboot installer.

I also took the fan out (more on that below) and have not noticed any heat issue.

I use my AppleTV as a CUPS Print Server and PHP Development box.

The biggest performance increase came from the use of an 44pin IDE to 7 + 15 pin SATA Adapter. I am using a 60GB SSD as the boot/data drive. The system became more than "tolerable" to use at that point.

In order to fit the Adapter + the SSD drive the fan must be removed. IDE to SATA Adapter


Post a Comment

<< Home