I wonder if I should start an iPhone category 😉
I recently used the Pwn Project tools to make a custom 1.1.4 firmware that is activated, jailbroken etc, it all worked well and after restoring the firmware to my iPhone everything “Just Worked” except the Mail application.
I have seen this issue before where you start Mail and it immediately crashes, the only way I have fixed it in the past is to do another restore. This time I thought I’d poke around a little first.
I logged into my phone via SSH and found that I could start the Mail application as root with no problem, although it acted as though it was a new installation. Starting it as “mobile” caused the expected crash behavior.
Poking around in the filesystem I found that the directory that mail uses to store its preferences
/var/mobile/Library/Mail
was owned by root:wheel and had permissons that would not allow applications launched as the mobile user to write to it..
# ls -la
drwxr-xr-x 5 root wheel 272 Apr 7 08:06 Mail
It seems that the only issues I have on my hacked iPhone relate to permissions problems so I changed the ownership of the directory (and it’s contents) to mobile:wheel
# chown -R mobile:wheel Mail
The ownership and permission should look like this.
# ls -la
drwxr-xr-x 5 mobile wheel 306 Apr 7 07:58 Mail
After that Mail worked as normal.