Home > Gadgets > Fixing iPhone Mail Crashes (2.0 Firmware)

Fixing iPhone Mail Crashes (2.0 Firmware)

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.

Popularity: 60% [?]

Author: Ben Categories: Gadgets Tags: , ,
  1. Ludwigw
    July 20th, 2008 at 00:35 | #1

    Awesome, thanks for helping me fix my mail :)

  2. July 20th, 2008 at 04:36 | #2

    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
    July 20th, 2008 at 04:42 | #3

    dear god, awesome. Thank you so much.

  4. Benjip
    July 20th, 2008 at 05:05 | #4

    Awesome stuff, thanks Ben (from another Ben).

  5. Chocolate
    July 20th, 2008 at 09:36 | #5

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

  6. Daniel
    July 20th, 2008 at 13:18 | #6

    Did the trick!

  7. Enrico
    July 20th, 2008 at 13:53 | #7

    Thanks!!

  8. steev
    July 20th, 2008 at 14:52 | #8

    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
    July 20th, 2008 at 16:22 | #9

    Thanks!

  10. Sick of the Whiners
    July 20th, 2008 at 18:12 | #10

    Works perfectly using mobile terminal on my phone. Thanks!

  11. July 20th, 2008 at 23:10 | #11

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

  12. July 20th, 2008 at 23:16 | #12

    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. July 20th, 2008 at 23:24 | #13

    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
    July 21st, 2008 at 03:10 | #14

    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
    July 21st, 2008 at 03:31 | #15

    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. July 21st, 2008 at 04:27 | #16

    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
    July 21st, 2008 at 05:43 | #17

    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. July 21st, 2008 at 06:05 | #18

    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. July 21st, 2008 at 06:18 | #19

    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
    July 21st, 2008 at 06:34 | #20

    works fine. thanks heaps

  21. martin
    July 21st, 2008 at 19:31 | #21

    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
    July 21st, 2008 at 21:05 | #22

    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
    July 21st, 2008 at 21:06 | #23

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

  24. ddub
    July 21st, 2008 at 22:35 | #24

    finally.. THANKS..

  25. July 21st, 2008 at 22:55 | #25

    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
    July 22nd, 2008 at 11:22 | #26

    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
    July 26th, 2008 at 00:45 | #27

    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
    July 26th, 2008 at 11:09 | #28

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

  29. thesharpster
    July 29th, 2008 at 20:30 | #29

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

  30. Omer
    July 30th, 2008 at 06:59 | #30

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

  31. July 30th, 2008 at 11:12 | #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. July 30th, 2008 at 13:43 | #32

    i like your style

  33. July 31st, 2008 at 00:01 | #33

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

  34. ROBERTO
    July 31st, 2008 at 13:05 | #34

    THANK YOU, YOU ARE A STAR!!

  35. DaddyDoxxx
    July 31st, 2008 at 19:02 | #35

    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
    August 1st, 2008 at 01:23 | #36

    Thanks, works great!

  37. WOJ
    August 1st, 2008 at 16:02 | #37

    Dude you ROCK!!!!
    Thanks!!!

  38. Matt
    August 1st, 2008 at 17:36 | #38

    Worked like a charm. Thanks so much!

  39. spants
    August 2nd, 2008 at 04:46 | #39

    thanks for your help!

  40. Ben
    August 4th, 2008 at 06:30 | #40

    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
    August 4th, 2008 at 19:54 | #41

    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
    August 4th, 2008 at 20:02 | #42

    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. August 9th, 2008 at 17:23 | #43

    Thanks! This helped a lot!

  44. Marc
    August 9th, 2008 at 19:09 | #44

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

  45. Lanny
    August 10th, 2008 at 17:24 | #45

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

  46. August 10th, 2008 at 17:34 | #46

    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
    August 13th, 2008 at 04:09 | #47

    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. August 13th, 2008 at 05:05 | #48

    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
    August 14th, 2008 at 09:23 | #49

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

  50. Han
    August 18th, 2008 at 04:34 | #50

    Dude, I love you. THANKS!

Comment pages
1 2 910
Comments are closed.

[ bbPress synchronization by bobrik ]