Page banner
 

Setting the AppleTV MTU

Problem:

  1. An Apple TV firmware update is available, according to ATV, but it will not download
  2. The movie trailer icons are not available and you get a ticket stub icons instead. However, the names of the movie trailers are available.
  3. YouTube shows the latest videos with descriptions and static image, but they will not play.
  4. You can synchronize with iTunes on your PC. Music and videos play fine. However, if the content is protected, it will refuse to play because authorization with the Apple Store fails.
You are using a DSL provider for your internet connection.

Examples - Attempting to view a YouTube video gives you the following:

AppleTV showing youtube listings

Despite being able to see the latest listings, selecting a video for viewing results in the screen below:

Youtube hung on AppleTV

This is the movie trailer listing. Note that you can see the movie title of the selected icon, so some data is making it back.

ATV cannot display trailer icons

After waiting a few minutes for the firmware to update, you get the following message "There is no update available. Apple TV can't check right now. Try again later.". If you were not connected to the local network, you would get this message immediately. However, with this problem, you don't get the screen until the system times out.

ATV fails to update

 

You can skip the following discussion and scroll down to the solution if you are not interested in the technical details.

Problem details:

MTU is “maximum transmission unit”. The default MTU of 1500 bytes is too high for DSL service providers that use PPPoE (PPP over Ethernet) when the operating system is unable to negotiate a proper MTU setting because the PPPoE protocol uses a few extra bytes for itself. While Windows XP and older versions of Debian Linux might work, Apple TV and newer linux releases have problems. If you have Linux you might find that ‘apt get’ works with some update sources but not others. You might also find that google.com displays properly in web browsers but yahoo.com is invisible or that half the internet seems to be randomly unavailable. Some web pages will return titles but not contents, etc.

When the MTU is too high for the path between you and the remote server, packets that get fragmented on the way back to you get discarded by routers creating a “black hole”.

The particular problem described here involved a DSL carrier connected to a D-Link DSL-2320B modem connected to an Apple Airport Extreme router. The AppleTV was connected wirelessly.

D-Link DSL modem 1

D-Link DSL modem 2

 

How to verify:

By default, if you log onto the ATV using a terminal like PuTTY (and your ATV has been patched with a product like patchstick to allow a secure shell and use use the IP address listed on the ATV network information screen), and type ifconfig, you will get output as follows:

patchstick.ca login to your AppleTV (pw:frontrow)
frontrow@10.0.1.14's password:
-bash-2.05b$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:24:36:ee:a6:71
media: autoselect (<unknown type>) status: inactive
supported media: autoselect 100baseTX <full-duplex> 100baseTX <full-duplex,flow-control> 100baseTX <hw-loopback> 100baseTX <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,flow-control> 10baseT/UTP <hw-loopback> 10baseT/UTP <half-duplex> none
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet6 fe80::223:12ff:fe27:afcb%en1 prefixlen 64 scopeid 0x5
inet 10.0.1.14 netmask 0xffffff00 broadcast 10.0.1.255
ether 00:23:12:27:af:cb
media: autoselect status: active
supported media: autoselect
wlt1: flags=41<UP,RUNNING> mtu 1500
-bash-2.05b$

 

In the example above, en1 is the Airport wireless interface of the AppleTV which in this example, is active. en0 is the wired Ethernet jack on the back of the Apple TV.  The mtu of both is 1500. This is the default.

To verify the problem, you can ping a source like yahoo.com as follows. The –D flag sets the “do not fragment” flag, while the –s flag sets the packet size. Normally ping packets are small so we force the packet size to be large to recreate the problem.

-bash-2.05b$ ping -D -s 1460 yahoo.com
PING yahoo.com (209.131.36.159): 1460 data bytes
1468 bytes from 209.131.36.159: icmp_seq=0 ttl=51 time=152.136 ms

Now we try the same thing with a 1500 byte packet and watch it fail:

-bash-2.05b$ ping -D -s 1500 yahoo.com
PING yahoo.com (209.131.36.159): 1500 data bytes
ping: sendto: Message too long

If you try the same thing under Microsoft Windows XP you will see (note the ping flags are different):
c:\test\>ping -f -l 1300 yahoo.com

Pinging yahoo.com [69.147.114.224] with 1300 bytes of data:
Reply from 69.147.114.224: bytes=1300 time=142ms TTL=54
Ping statistics for 69.147.114.224:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 65ms, Maximum = 142ms, Average = 84ms

c:\test>ping -f -l 1500 yahoo.com

Pinging yahoo.com [69.147.114.224] with 1500 bytes of data:
Packet needs to be fragmented but DF set.

Temporary Solution:

Type the following at the bash prompt on your AppleTV: (assuming a MTU of 1492 works on your service provider, and that the ATV is connected to the wireless interface en1):

-bash-2.05b$ sudo ifconfig en1 mtu 1492

Next, you need to take the wireless interface en1 down. Otherwise, the new settings will not be used. You can plug in a hardwired Ethernet cable for about 5 seconds and then unplug it, which will take down the wireless and bring it back up again, or create a script with an editor like nano as follows:

sudo ifconfig en1 mtu 1492
sudo ifconfig en1 down
sudo ifconfig en1 up

You have to type “chmod 777 scriptname” if you want to execute the script. You can’t type these commands directly because once you take the interface down you get disconnected and lose your terminal session. This script will bring it right back up again before your terminal (e.g. PuTTY) gives up on the connection. Below is the output of the script above. The password prompt is due to the use of sudo.

-bash-2.05b$ ./test1
Password:
-bash-2.05b$

At this point, your AppleTV should be able to play youtube videos.

So far so good, except that once you reboot, the settings are lost and unlike your Apple notebook or desktop machine, there is nowhere to change the Ethernet settings on an AppleTV.

Permanent Solution

The operating system used for this tutorial identifies itself as:

-bash-2.05b$ uname -a
Darwin AppleTV.local 8.8.2 Darwin Kernel Version 8.8.2: Mon Jan 29 18:57:29 PST 2007; root:xnu-792.94.18~1/RELEASE_I386 i386 i386
-bash-2.05b$

If you want to find other potential solutions for setting the MTU, try an internet search for the keywords Darwin and MTU. The startup scripts for Darwin and quite different from other distributions.

Create a new directory

-bash-2.05b$ sudo mkdir -p  /Library/StartupItems/MTU

Type the following to avoid having to keep entering the root password.

-bash-2.05b$ sudo –s

Paste the following at the bash prompt, or paste the contents into an editor like nano.

cat >/Library/StartupItems/MTU/MTU <<EOF
#! /bin/sh
. /etc/rc.common
StartService ()
{
        if [ "${MTU:=-NO-}" = "-YES-" ]
        then 
            ConsoleMessage "Network Configuration" 
            /sbin/ifconfig en0 mtu 1492
            ConsoleMessage -S
        fi
}
StopService ()
{
        return 0
}
 
RestartService ()
{
        return 0
}
 
RunService "$1"
EOF

 

cat  >/Library/StartupItems/MTU/StartupParameters.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
        <key>Description</key>
        <string>MTU</string>
        <key>Messages</key>
        <dict>
                <key>start</key>
                <string>Starting MTU</string>
                <key>stop</key>
                <string>Stopping MTU</string>
        </dict>
        <key>OrderPreference</key>
        <string>Late</string>
        <key>Provides</key>
        <array>
                <string>MTU</string>
        </array>
        <key>Requires</key>
        <array>
                <string>Network Configuration</string>
        </array>
</dict>
</plist>
 
EOF

 

chown root /Library/StartupItems/MTU/MTU
chown root /Library/StartupItems/MTU/StartupParameters.plist
chgrp admin /Library/StartupItems/MTU/MTU
chgrp admin /Library/StartupItems/MTU/StartupParameters.plist
chmod 755  /Library/StartupItems/MTU/MTU
chmod 644  /Library/StartupItems/MTU/StartupParameters.plist
 
echo "MTU=-YES-" >>/etc/hostconfig

 

You have to change the group that owns the MTU entries to “wheel” or else the command: sudo SystemStarter -vd start MTU will return the messages:

SystemStarter[255]: Found item: MTU
SystemStarter[255]: "/Library/StartupItems/MTU/StartupParameters.plist" failed security check: not owned by GID 0

Here are the commands to change the groups.

-bash-2.05b$ sudo chgrp wheel /Library/StartupItems/MTU
-bash-2.05b$ sudo chgrp wheel /Library/StartupItems/MTU/MTU
-bash-2.05b$ sudo chgrp wheel /Library/StartupItems/MTU/StartupParameters.plist
-bash-2.05b$

To verify, do this:

bash-2.05b# pwd
/Library/StartupItems/MTU
bash-2.05b# ls -al
total 16
drwxr-xr-x 4 root wheel 136 Dec 18 10:19 .
drwxr-xr-x 3 root wheel 102 Dec 18 10:17 ..
-rwxr-xr-x 1 root wheel 372 Dec 18 10:43 MTU
-rw-r--r-- 1 root wheel 744 Dec 18 10:42 StartupParameters.plist
bash-2.05b#

At this point you should be able to run SystemStarter as follows and have it launch the MTU script:

-bash-2.05b$ sudo SystemStarter -vd start MTU

The –vd flag is not a disease, but verbose diagnostics. Use ifconfig to verify the new MTU setting as follows:

Step 1:
-bash-2.05b$ ifconfig

Shows current MTU settings.

Step 2:
-bash-2.05b$ ifconfig en1 mtu 1500

This resets the MTU to 1500.

Step 3:
-bash-2.05b$ ifconfig

Verify that the MTU is back to 1500.

Step 4:
-bash-2.05b$ sudo SystemStarter -vd start MTU

-bash-2.05b$ ifconfig

The MTU should be back to whatever you set in the MTU startup script.

If all goes, well you can type sudo reboot and the system will restart with the new MTU settings.

Here is the trailer screen again, this time with movie miniatures.

AppleTV trailer images available

Note: Apple will not help you with MTU issues. Their first attempt at a solution is to update the firmware, which is impossible if the MTU is wrong or to send you out an identical new machine with the same firmware release, which is useless. Sending it back to experiment with a software update is not supported either. Their second solution is to offer you a refund. Even if you tell them exactly what is wrong, they can't help. You can report it to them, but they will refuse to pass the information along to the development group unless you are a registered developer. I ended up giving up on the impotent Apple support group. They may perhaps be good at supporting desktops, but are inadequate when it comes to AppleTV. After all, what can call center people do to troubleshoot a unix machine that has no shell or remote access other than apologize to the customer and offer a refund?

Apple does not allow shell access. You can get that from patchstick.ca

If I made any typos above, please send me a correction using the web feedback form on this site and I will fix it.

Update December 2009: Apple update 3.0 has the same issues and the solution above still works.

If you cannot update to version 3.0 via the AppleTV, try the following:

mkdir /Users/frontrow/Updates

I had used WinSCP to copy the dmg file from my Windows XP desktop to the AppleTV's root directory, so I moved it as follows:

cp *.dmg /Users/frontrow/Updates

The update program was found at: http://wiki.awkwardtv.org/wiki/OSupdate
Download: http://ericiii.net/sa/appletv/osupdate
Source: http://github.com/esteil/osupdate/tree/master

Next, copy the osupdate program to /Users/frontrow/Updates and make it executable as follows:
bash-2.05b# chmod +x osupdate

Next make root mountable

sudo mount -uw /

Then run the update program

sudo /Users/frontrow/Updates/osupdate

Lots of errors will be generated, the AppleTV will reboot a few times, and then you will be up to version 3.

After this, you will need to reapply the Patchstick. I used the latest version of the patchstick software just to be safe. Interestingly, the underlying unix kernel appears to be identical ...

bash-2.05b# uname -a
Darwin AppleTV.local 8.8.2 Darwin Kernel Version 8.8.2: Mon Jan 29 18:57:29 PST 2007;

root:xnu-792.94.18~1/RELEASE_I386 i386 i386
bash-2.05b#

[end]