Fixing iPhone Mail Crashes (2.0 Firmware)

Saturday, July 19th, 2008

Sometimes your iPhone mail client just doesn’t go. You open mail, and it closes again. You can’t even delete the account from the Setup application. I’m not 100% positive, but I think this usually happens when you’ve restored your settings from a pre-2.0 phone (again, unsure whether it matters if the phone was pwned or not).

You could wait for Apple to fix this bug, but with the new jailbreak tool available for 2.0 firmware, help is at hand. Jailbreaking your phone is fairly trivial, but beyond the scope of this post.

Update: Now I see there is a “Mobile Terminal” app available on Cydia. If you’re desperate you can install that, run it, enter “su” to elevate yourself to root (you’ll need the “alpine” password) then skip down to the cd /var/mobile/Library bit.
Update 2: Even easier, the BossPrefs application (available via Cydia) has an option to “Fix User Dir Permissions” (accessed via the “More” button). This does exactly the same thing as my fix below, but is heaps easier if you don’t understand Unix terminal commands.

Read on for the full details

So let’s run through what you need:

  • One iPhone with 2.0 firmware, jailbroken and diced finely.
  • One tablespoon of OpenSSH, installed using the Cydia installer on your iPhone.
  • The IP address of your iPhone when connected via Wifi (sorry USB won’t work).

To grab the IP address, head into the Wifi settings, and tap the blue “more” arrow on the connected network:

Ok, now we need to connect to that IP address using SSH. I use the Terminal app on my Mac, but you could just as easily use PuTTy on your PC. In PuTTy you’ll need to just type in the IP address to connect to. On the Mac you want to type ssh root@xxx.xxx.xxx.xxx into Terminal (where xxx.etc. is the IP address of the iPhone).

The first time you do this, you will get a long (as in 60+ seconds) delay as the iPhone computes some cryptography stuff (a key pair I think), then it will ask you if you want to accept the key pair. Obviously you do. Type “yes” on the Mac or just click “OK” if you are using PuTTy.

Next we log in with the ubuquitous iPhone root password: alpine. You should get something like this:

Now we have an interactive shell with the iPhone. Hopefully everyone knows some basic Unix shell commands, because they teach those at primary school nowadays right? Right?! Anyway… your mail is stored at /var/mobile/Library/Mail. Let’s take a look at that directory on an iPhone with “broken” mail by typing:

cd /var/mobile/Library
ls -la

See that bit that says “root mobile” on the line tha ends in “Mail/”? That means the Mail directory is owned by user “root” and group “mobile”. This is a Bad Thing(TM). We want it to be owned by user “mobile”, which is the user under which all iPhone apps run. This is an easy fix using the chown command with “-R” (for recurse directories):

chown -R mobile:mobile /var/mobile/Library/Mail

Type that command, hit enter, and we’re done. Take another look at that directory listing now:

All fixed. Now go and run your iPhone mail app and whoop with delight. That’s an order.

And I can’t leave without my standard nag: I OWN this piece of hardware. It’s mine. I shouldn’t have to hack it to fix it. Grrr.

Tags: , ,

64 Responses to “Fixing iPhone Mail Crashes (2.0 Firmware)”

  1. Ludwigw says:

    Awesome, thanks for helping me fix my mail :)

  2. aptmunich says:

    Fixed my mail as well!
    For the record I did restore from my backup, so it looks as though that could be it.

  3. Joe says:

    dear god, awesome. Thank you so much.

  4. Benjip says:

    Awesome stuff, thanks Ben (from another Ben).

  5. Chocolate says:

    Geniussssssss. Many thanks for providing those guidelines and explnantions, all perfectly working now!

  6. Daniel says:

    Did the trick!

  7. Enrico says:

    Thanks!!

  8. steev says:

    THANK YOU SOOO MUCH!! I was noodling on this all night. I tried every way I could to do it through Mail.app settings and the iPhone Settings > Mail. None of them worked.

    The directory listing didn’t change right away on mine, but everything still worked.

  9. raph1992 says:

    Thanks!

  10. Sick of the Whiners says:

    Works perfectly using mobile terminal on my phone. Thanks!

  11. metime says:

    Didn’t work for me using mobile terminal – and now the Apps from the app store don’t work either. Borked.

  12. beng says:

    Wow, it sounds like you’ve typed in a command incorrectly? All my app store
    apps are fine. Without knowing what you’ve done, the simplest way to revert
    the settings would be to re-restore your ipsw file. I’ll have a quick play
    to see if I can break my Apps to see what you might have done.

  13. beng says:

    Hmm strange. I can’t seem to get my apps to break even if I trample (chown mobile:mobile) all over the /var/mobile/Applications directory.

  14. Dave says:

    Hi there, thanks for the instructions. im having trouble connecting to the iphone over WiFi (Connection Refused) and through the mobile terminal (Operation not permitted)

    Any help would be much appreciated!
    thanks again

  15. Dave says:

    ok my bad, i got mobile terminal working. for the other noobs like me:
    type “login root” then use “alpine” as password before using the chown command
    YAY mail!!!

  16. Kira says:

    I am a Noob with no competence in terminal, unfortunately they do not teach Unix at school :/ , so i was wondering if yu could provide a line by line direction of what i need to type into mobile terminal? i’m sure that some may say that youhave provided adiquet directions in this post but I do not understand it. It would be a grate help if you could do very basic directions for what i need to typ in and what should come up n mobile terminal.

    Thank you so much and i am glad i am not the only one with this issue.

  17. marcus says:

    thanks for the details,
    but i seem to have a problem. im using mobile terminal on 2.0 firmware and
    i get this error when i use chown -R
    chown :changing ownership of ‘var/mobile/Library/Mail/Account.plist’ : operation not permitted
    chown :changing ownership of ‘var/mobile/Library/Mail’ : operation not permitted

    do you know why i cant change the owner ?

  18. beng says:

    Ah yeah I realise now that mobile terminal logs you in as “mobile”. You
    need to type “su” then enter the root password “alpine” to elevate yourself
    to root before typing the commands.

  19. Lost iPhone says:

    Wish I’d found this and the jailbreak before I lost my iPhone! About to go get a 3G one, I’m on the beta for iRedHanded, so hopefully next time I will be able to see the thief on the map and go bust em! :) I wish we didn’t have to fiddle with our phones just to get them to do what they should do too!

  20. marcus says:

    works fine. thanks heaps

  21. martin says:

    guys, i have a slightly diferent problem witm mail.app … whenever i wish to send new email it doesnt do anything, no network activity, nothing, just the bar at trhe bottow, saying “sending” but its not “growing” :/ do you have any idea how to resolve this one????

  22. Nick-T says:

    Thank you Ben worked like a charm. Does beg the question should we be changing the root password (or indeed the mobile one) to something else, and if so.. how?

  23. Nick-T says:

    Hi Martin
    I had Mail running but stuck on “Checking for Mail” forever, Ben’s fix resolved the issue.

  24. ddub says:

    finally.. THANKS..

  25. beng says:

    I would think the unix passwd command would work for changing the password, but I don’t know what it would break. You can always uninstall OpenSSH and Mobile Terminal if you are paranoid about remote access.

  26. crush says:

    Hey

    I was not able to access my iPhone from the Laptop (port 22: Connection refused). But with the Terminal on my iPhone it worked.

  27. Gurvin says:

    Ben Firstly, i never have the patience to comment, post on forums etc etc, kinda selfish I know. But I had to post here to thank you.
    So what did I mostly use my iPhone for? Mails… But a restore rendered that app useless. I thought the cause was the brilliant app Bossprefs, but just today i came across ur post. Did what you wrote and voila, MY MAIL APP IS WORKING. Thanks a LOT man!!!!

    P.S. Beng has posted a way to use “mobile terminal” to use your method. That was NECESSARY for me because I dont have wifi so thanks to Beng too.

  28. Rune Jacobsen says:

    thanks alot.. finaly got it to work when i found out u had to use the capital letters… :-)

  29. thesharpster says:

    You are a F***king Legend. Thankyou so, so much

  30. Omer says:

    You are the man.
    Thanks a mil for the easy fix.
    Rgs

  31. Excellent stuff! I thought it was probably a permissions problem, but didn’t know where.

    I believe it explains my current inability to save photos to my Camera Roll. I worked around that one by using SwapCameraRoll, but that isn’t fully satisfying as I want to know where that stuff is in the filesystem!

    Thanks for your help with this one!

  32. quentro says:

    i like your style

  33. thanks says:

    worked fine …thanks for your post !!!…
    Agustin from Mexico

  34. ROBERTO says:

    THANK YOU, YOU ARE A STAR!!

  35. DaddyDoxxx says:

    Thank you very much! I’ve managed to do it in the mobile terminal.app using mobile Safari.app to read the commands.
    Yeah, awesome, thanks again. Btw, they don’t really teach Unix in Czech Republic;)

  36. Ram0nG says:

    Thanks, works great!

  37. WOJ says:

    Dude you ROCK!!!!
    Thanks!!!

  38. Matt says:

    Worked like a charm. Thanks so much!

  39. spants says:

    thanks for your help!

  40. Ben says:

    Hex ho!

    Thx for this fantastic post from germany. Im sitting at the airport after updating to 2.0, wanting to check my mails and was quite frustrated, since im Going to Mexico without a laptop.

    You saved my day!

    Cheers

    Ben

  41. Dr. Gonzo says:

    Cheers dude :-) fixed it! anyone who has problems with installing openssh (like me) the servers seem to be very slow and down a lot of times, so i couldnt download it for some time. had to try 20 times…

  42. Dr. Gonzo says:

    One more tip: Download Bossprefs and go on: “More” – then click on “Fix User Dir Permissions” – that should do the trick as well without using the terminal! My mail did work after the terminal fix but it didnt show any messages, so i did this and voila it works now…

    Have fun…

  43. Jon Wise says:

    Thanks! This helped a lot!

  44. Marc says:

    I used bossprefs too but without this post I never would have known to do so. Thanks and woo-boo as ordered!

  45. Lanny says:

    Thank you. I dared translating ot (with full credit) fpr those Czechs who do not read English-

  46. beng says:

    Good one. Do you have a link that I can add to the article? Perhaps with “If you want a Czech version then click here” in Czech?

  47. Kapil Gupta says:

    Ben,

    ANy fixes for outgoing mail issue on pwned 2.0 with an exchange account using activesync.

    I am unable to send mails using my home wifi. Can do so with EDGE or office wifi!!

    Any help or direction would be greatly appreciated

    Thanks,

  48. beng says:

    That sounds a lot like a firewall issue. Definitely not a permissions
    issue. Surprising that it works over EDGE though. Sure you don’t have any
    outbound firewalling going on with your home network?

  49. Tom Stockton says:

    That works a treat ….. Thanks very much for finding this out !!!

  50. Han says:

    Dude, I love you. THANKS!

  1. Pingback from: Pwnage Tool 2.0 - Verzameltopic - Pagina 29 - iPhone Forum - alles over de Apple iPhone en iPhone 3G
  2. Pingback from: katun.ch blog » Blog Archive » mobileMail funktioniert nicht nach dem Update auf 2.0
  3. Pingback from: Ben.geek.nz » Why Open Systems Rock and Suck in Equal Measure
  4. Pingback from: n00.be » Minor iPhone 2.0 issues resolved
  5. Pingback from: S? du vill uppgradera till 2.0? | iFonkoll.se
  6. Pingback from: iPhone brick update at Ben Cooper’s Weblog
Logo
Post thumbnail Video: LASERS!
Who doesn’t love lasers? Favourite tool of the James Bond villian, and weapon of choice [...]
Post thumbnail Video: Smartphone Roundup
With the recent launch of Apple’s iPhone 4, it’s time to do a once-over of [...]
Post thumbnail Video: Gadgets for Grandparents
Grandparents and gadgets don’t really go together, but this week on TVNZ Breakfast I took [...]
Post thumbnail Review: Kick Ass
I don’t usually review movies, but after giving two copies of Kick Ass away [...]
Post thumbnail Video: LASERS!
Who doesn’t love lasers? Favourite tool of the James Bond villian, and weapon of choice [...]
Post thumbnail State of the Android NZ Nation
Despite the bagging, I really do think Android is pretty damn awesome. I’ve spent the [...]

Enter your email address:


Delivered by FeedBurner

More in Gadgets (5 of 5 articles)