10

AppleTV: How to force a Factory Restore via SSH

Posted February 27th, 2010 in Tech and tagged by Scott Forbes

Allegedly it’s now super easy to install Boxee on your AppleTV — I say “allegedly” because I spent a couple of hours yesterday recovering from a failed install, which left my AppleTV with no video, no menus, and no Boxee. The box just looped through displaying the Apple logo, followed by a blank screen, followed by “No Signal,” followed by a blank screen, indefinitely.

I tried holding down Menu and Minus on the remote, to reboot the AppleTV and bring up the diagnostic menu, to no avail: Nothing would come up on the screen. (I also tried blindly pressing “Down, Down, OK” on the remote, in the hopes that I just couldn’t see the diagnostic menu, but that didn’t work either.) I could SSH into the AppleTV, so at least that part of the Boxee install succeeded — and the AppleTV was showing up and syncing in iTunes, so I wasn’t stuck in a loop of rebooting over and over.

I wasted a lot of time Googling for solutions — which, to be fair, provided some useful information about the AppleTV’s disk partitions, how it does a Factory Restore, etc., but also provided a lot of outdated info. Several pages began with “first, download this disk image from mesu.apple.com” and then linked to an image that’s no longer there; others provided useful instructions on how to backup your AppleTV disk, which would have been good advice to follow before trying to install Boxee, but didn’t help with recovery.

So, for posterity, here’s how I forced my AppleTV to re-load its factory settings when all I had was the ability to SSH into the box. (I should emphasize here: There are much, much easier ways to restore factory defaults on an AppleTV if you can navigate the menus, or if holding down Menu and Minus on the remote successfully reboots the box into diagnostic mode. What I’m about to describe here is a process for deliberately breaking the operating system on the AppleTV’s OSBoot partition, which forces the box into recovery mode; this is not for the faint of heart, I’m not responsible for what happens to your AppleTV if you try it, and heaven help you if you run these commands on your Mac.)

The AppleTV’s hard drive is partitioned into four volumes: EFI, Recovery, OSBoot and Media. The AppleTV boots to the EFI partition first, which in turn tries to mount OSBoot and launch the operating system. In my scenario OSBoot is mounting and booting successfully, but something has corrupted the AppleTV Finder (or some other mission-critical app) and so we can’t get to the menus.

The solution here is to render the OSBoot partition unbootable, which causes the EFI partition to go into recovery mode and offer up the Factory Restore option from its own menus. While there are many exciting ways to render an operating system unbootable, I went with a simple one: Renaming mach.sym (and, for good measure, mach_kernel.prelink) so the OS couldn’t find its kernel.

So, here’s what I did to achieve a factory restore of my AppleTV from the Terminal prompt. Text that I typed is in italics.

YourMac:~ you$ ssh frontrow@appletv.local
frontrow@appletv.local's password: frontrow
Last login: Fri Feb 26 22:55:22 2010
-bash-2.05b$ sudo mv /mach.sym /bad.mach.sym
Password: frontrow
-bash-2.05b$ sudo mv /mach_kernel.prelink /bad.mach_kernel.prelink
-bash-2.05b$ sudo shutdown -r now

The shutdown command reboots the AppleTV and logs you out; when the box comes back up you won’t be able to SSH into it anymore, but (at least in my case) it came up with the “select your language” menu, followed by a menu that contained the factory restore option. (For what it’s worth, I also had to unplug and re-plug the HDMI cable to get my AppleTV fully working again.) After the factory restore I had to do the usual steps to get the AppleTV back on my wireless network, connected to iTunes, etc., but once all was said and done my AppleTV is back to normal.

I might have another run at installing Boxee, but I think I’ll give it a week or two; honestly, if Viacom got their act together and allowed me to subscribe to Comedy Central via iTunes — or even just allowed me to buy a season of The Daily Show for less than the cost of basic cable — I wouldn’t bother. Anyhow, if I do try again I’ll at least have these last-ditch instructions for doing a factory restore written down.

10 Responses so far.

  1. tardis101 says:

    Scott, you are the best! My ATV got “hung” and after searching the internet for 3 hours, I thought my only option was to reinstall via a complex and lengthy process. Still don’t know how I stumbled upon your blog but it was just what I needed to do a ATV restore. Thanks for posting this.

  2. refreshedit says:

    I followed your steps and found myself at the “Enter Your Language” screen. Problem now is that the remote will not respond to the menu selections. I am hung there. Frozen.

    Any suggestions?

  3. refreshedit says:

    Problem is – How do you pair a remote with an ATV that is waiting to be set up? There are no pairing options yet….

  4. refreshedit says:

    I tried this, the system light turned off after 6 seconds… then nothing.. No change. DAMN, now I can’t even SSH in…. :-( Has this process bricked my unit?

    • Scott Forbes says:

      It didn’t brick my unit (more the opposite, in fact), but we entered the Land of Voided Warranties a long time ago. :-/ I might try pulling the battery from the remote, unplugging the AppleTV, and letting them both sit for an hour; or, better yet, if you’ve got another Apple remote I might break that out and see whether it makes any difference.

      http://support.apple.com/kb/ht1551

      Beyond that, if you can’t get the remote working, I suspect your next-best options are (a) crack open the AppleTV, pull the hard drive, find a disk image from an intact AppleTV, and try to restore… or (b) go to the Apple Store. This really sounds like an issue with pairing and un-pairing the remote, though, or at least all the other troubleshooting pages I’ve found give the same advice in this situation.

  5. tommpl says:

    Hey thanks for the info it worked and now my wife wont kill me braking her apple tv. I was going crazy trying everything! ha

  6. abeere says:

    I thought I had finally found the grail, I was experiencing the exact same problems! But unfortunately now my atv is showing the Apple logo with a flashing question mark and atv, which I think means it can no longer find any boot drive…

    If you can think of any fix for this it would be much appreciated as most people are saying it is dead. :(

    • Scott Forbes says:

      It’s possible that your AppleTV still has an intact Recovery partition, but it sounds like yours is earnestly trying (and failing) to boot from a partition that’s no longer bootable. The only “next steps” I can suggest are to (a) crack open the AppleTV, pull its hard drive, attach the drive to another Mac, and erase the OSBoot partition entirely (or, if possible, find a disk image from a working AppleTV and copy it over), or (b) spend $99 on a second-generation AppleTV, because it’ll cost more than that to have your first-generation model repaired.

  7. Parris says:

    I am currently trying to coax a Gen 1 Apple TV back to life. It has a graphics / logic glitch (white specks all over the screen, fails to boot 90% of the time and if it does boot it displays a very old firmware menu then as I try to move the cursor down the menus it crashes and gets stuck).

    The first thing I would suggest to anyone is to get a back-up of their internal HDD. You can use a free software app called “Carbon Copy” (Google) which makes a bootable ‘ghost’ image of the hard drive. This does mean opening the unit up, which of course voids any warranty you might have (should you have taken out Apple Care that still covers the unit).

    Note, the internal HDD is the older PATA and not the new SATA connection.

    I then used Fire Core aTVFlash to jailbreak the Apple TV. Despite nothing else running on the box, for some reason this application forces itself onto the system, presumably that is how it is designed.

    I can then access the Apple TV via Terminal as described above and attempt recovery.

    Sadly, thus far I have been unsuccessful as I can’t get the unit to fully boot and / or remain functional long enough to update the Ethernet / Wifi connectivity for a firmware update, or even scroll down the menu to select the correct option to update firmware.

    It’s clearly a logic board issue. The board is functional, but needs a firmware flash.

    Does anyone know of any other way to force a firmware update on these units? I suspect it would come back to life.

    HELP!

Leave a Reply

You must be logged in to post a comment.