Network error on factory reset OUYAs

My own OUYA API server has been running since november last year. The game data files have been worked on: Previously missing games were added, wrong developer UUIDs fixed. Many of the games got product data, so that purchases can be restored now and games stuck in demo mode unlock to the full version now.

All went nicely until end of january, people with factory reset OUYAs came into the chat and asked for help because they could not get past the network configuration screen. All they got were the following error messages:

Unable to connect

Please check your Internet connection and try again.

and

Cannot establish a connection with the OUYA Servers. To turn on Wi-Fi, unplug your Ethernet cable and proceed. To retry ethernet, please check your connection and then unplug and re-plug your cable.

Unabe to connect Cannot establish a connection with the OUYA Servers.

The culprit

Luckily I own two OUYAs, so I did a factory reset on the development machine and tried the setup myself: It failed with the same error messages as reported.

The initial setup is managed by OUYAOOBE.apk, the Out Of the Box Experience application. I read the decompiled sources and soon found the culprit, ConnectivityChecker.java:

public Void doInBackground(Void... params) {
    Socket socket = null;
    boolean reachable = false;
    try {
        Socket socket2 = new Socket("devs.ouya.tv", 80);
        reachable = true;
        if (socket2 != null) {
            try {
                socket2.close();
                Socket socket3 = socket2;
            } catch (IOException e) {
                Socket socket4 = socket2;
            }
        }
    } catch (UnknownHostException, IOException e2) {
        // error handling
    }
    setResult(reachable);
    return null;
}

So OUYA's setup application has a hard-coded check to devs.ouya.tv, which was the name of the API server - and it does not use the ouya config override file ouya_config.properties. The DNS record still exists:

$ dig devs.ouya.tv
devs.ouya.tv.		60	IN	CNAME	tokyo-6663.herokussl.com.

But the host that the domain was aliased to does not exist anymore:

$ dig +short tokyo-6663.herokussl.com
$

Apparently Razer's Heroku contract was cancelled or not renewed, and the box that served the redirect from devs.ouya.tv to razer.com was shutdown forever.

The solution

It is possible to get past the network selection screen by letting the OUYA think that devs.ouya.tv still exists, and let it point to some IP address that has a HTTP and HTTPS server running.

DNS mapping in your router

Some routers allow you to add own domain-name-to-IP-mappings. If your router is one of them, add a mapping for hostname devs.ouya.tv to the IP of my server: 83.169.45.222.

Modify OUYA's /etc/hosts file

Each computer has a file /etc/hosts that allows you to define DNS mappings. On Android, that file is located at /system/etc/hosts.

This method will surely work, but takes the most steps. You need to have the "Android Debug Bridge" (adb) command line tool installed on your PC. Have a look at Cyanogen Mod CM11 and the Ouya, it has installation instructions for adb on windows.

  1. On your PC, run adb shell
  2. Type su to become the root user
  3. Make the system partition writable:
    mount -o rw,remount -t ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
  4. Open the hosts file:
    vi /system/etc/hosts
  5. Press the down arrow key until your are at the end
  6. Press i to get into “insert mode”
  7. paste/write that line:
    83.169.45.222 devs.ouya.tv status.ouya.tv
  8. Press Return to add a final newline
  9. Press Esc
  10. Type :wq (commmand, write, quit)
  11. Press Return to exit the vi editor

The connectivity check should work now without rebooting.

Written by Christian Weiske.

Comments? Please send an e-mail.