Saturday, July 14, 2012

[SOLVED] Unfortunately, Clock has stopped

When I upgraded my xperia ray from CM7 to CM9(FXP128), I was greeted by the message 'Unfortunately, Clock has stopped' whenever the phone started and anytime I touched the Clock widget. Apart from being annoying it meant I couldn't set my alarms so this became a priority one issue :-)

I opened the Terminal Emulator and typed:

$ su 
# logcat

Then I held 'Volume down' (a.k.a. Ctrl) and 'c' to stop the output. I scrolled a bit up in the output and found a line that said:

E/SQLiteOpenHelper( 5231): Couldn't open alarms.db for writing (will try read-only): E/SQLiteOpenHelper( 5231): android.database.sqlite.SQLiteException: Can't downgrade database from version 7 to 5

OK, so this is where it's breaking. I wasn't really interested in finding out what should the proper combination of ownership/permissions for the file as I didn't really trust it would end just here, downgrading database version offers a range of situations that can go wrong. And since I don't really care for my past alarm clock times, I got rid of the old database:

# cd /data/data/com.android.deskclock/databases 
# mv alarms.db alarms.db.bak 

Problem solved.

53 comments:

  1. y my lg optimus 2x, always prompt this " Unfortunately, clock has stopped "...I already Use what you are showing above? I am using NOvaHD cm9

    ReplyDelete
  2. Wow thank you so much! You just made my day.

    ReplyDelete
  3. Thank you WOW it worked. Had exact same problem. Will use logcat more often for sure!

    ReplyDelete
  4. Thx my friend~ it worked~
    I once had the same problem on my AOKP hd2~

    ReplyDelete
  5. Just took a Nexus 10 with Jelly Bean on it getting the same error after about a day. I tried this and it didn't work. Wouldn't even recognize such and logcat. Am I messing up syntax in terminal emulator? H-e-l-p!

    ReplyDelete
  6. Awesome! Easiest fix yet for my Samsung Galaxy S2 running Cyanogenmod 10.

    ReplyDelete
  7. Wow. A little peeved it was something so simple. CM10.1 Nightly on a Captivate.

    ReplyDelete
  8. Excellent fix for my HTC One S on JellyBam 3.3

    ReplyDelete
  9. This worked for me (Xperia Arc S - CM9.1)
    It had never occurred to me to look at the log files; despite my being an embedded systems developer. I mustn't be very good :)

    ReplyDelete
    Replies
    1. hi i am using the same phone as you..but cant fix this problem, do you mind telling me how to fix it, step by step? Thank you :)

      Delete
  10. Great work. Renamed the alarm.db file and it did the trick
    Deleted the old .bak file now.I had this issue on my Samsung Galaxy S2 after upgrading from Slim Bean 3.x to the latest version (at the time of this post) 4.2.1 RC1, I gather because the ROM changed the type of clock but used the same database. All good now, thanks.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Yes, I renamed the alarm.db file and it worked for me. The terminal emulator commands did not work for me.

      Delete
  11. Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

    ReplyDelete
  12. To clear the database and any data cached already, you can also find the Clock app in your app drawer, press and hold, then drag it up to the App Info icon. From here if you choose to Clear Data it will get rid of the ill-permissioned database and allow the app to create a new one with the appropriate permissions.

    ReplyDelete
  13. I have fought that problem for over a year and finally got annoyed enough to search for a fix. Thanks so much for posting!

    ReplyDelete
  14. What if it says the database not found?

    ReplyDelete
  15. Thanks, this has been bugging me for weeks.

    ReplyDelete
  16. Thanks, worked for me too! On kitkat, even.

    ReplyDelete
  17. Thanks, worked on Slim Kat wondrously...

    ReplyDelete
  18. unfortunately emain has stopped how to fix this

    ReplyDelete
  19. Great Wrok Man, Smooth and simple.

    ReplyDelete
  20. thanks, currently I upgrade my galaxy wonder cm10 to cm11. and the problem solved

    ReplyDelete
  21. Thank you for your help :) It works for me with my slimkat rom

    ReplyDelete
  22. My clock stopped working and I cannot set the alarms. This method worked once for me, but the problem returned, and I could not fix it anymore. Nevertheless, there is something strange I saw. I deleted the caches, the data, do junk cleansing on the my phone, disabled the phone and re-enabled it. After these steps, I saw that the most current alarm settings disappeared, and the alarm settings of some time ago returned. I suspect there are hidden backup/cache/whatever files that the clock is clinging to, that prevents the clock from going back to normal, that I need to delete. Can anybody help?

    ReplyDelete
  23. Tried but 'permission denied on alarms.db', so I went to app settings and cleared data/cache and tried again. This time 'no such file alarms.db', but everytime i try to modify an alarm its the same error message galaxy gt1900). Thanks anyway

    ReplyDelete
  24. Thanks it works on Android L on Xperia SP

    ReplyDelete
  25. Thank you very much! It worked flawlessly here!

    ReplyDelete
  26. Thanks, your tip worked for me too (galaxy s4 mini, CM12 lollipop 5.1.1).

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Hi All, I had this issue , was trying out one rom after the other as none of the suggestions including deleting the clock db worked for me.After lot of digging , at last the issue in my case turned out to be a corrupt system & internal memory partitions.Once they were fixed the issue did not reappear on the next rom installed.

    Please note that this is an one off case and please try the solution at your own risk and only after understanding thoroughly about what is suggested as a possibility. I'm not responsible for bricked devices.

    ReplyDelete
  29. I upgraded to cm12.1 this week and everything worked perfectly except for this. LG G2 LS980 (Spint) - this fix worked! Thanks so much!

    ReplyDelete
  30. Worked like a charm. I often forget that Android has a Linux underpinning.

    ReplyDelete
  31. Worked 4 me on cm 12.1! Thank u!

    ReplyDelete
  32. I could not find alarm.db at all... One plus one - Cyanogenmod 13... upgraded recently and getting the message "unfortunately clock stopped working" once I click on the clock widget.... has the file structure or .db name different here

    ReplyDelete
  33. I could not find alarm.db at all... One plus one - Cyanogenmod 13... upgraded recently and getting the message "unfortunately clock stopped working" once I click on the clock widget.... has the file structure or .db name different here

    ReplyDelete
  34. i opend the terminal imulator and typed thw command it replys that file not found ?
    plz hlp ?

    ReplyDelete
  35. i opend the terminal imulator and typed thw command it replys that file not found ?
    plz hlp ?

    ReplyDelete
  36. i opend the terminal imulator and typed thw command it replys that file not found ?
    plz hlp ?

    ReplyDelete
  37. Thank you!
    Although I didn't have those entries in muy $logcat, I did change alarma.db and TVE message is gone.
    I'm on cm11, Samsung Galaxy Tan 2.

    ReplyDelete
  38. This comment has been removed by the author.

    ReplyDelete
  39. Thanks, realy work on cm13 google's clock app.

    ReplyDelete
  40. Bravo! Im running MM with a geris s5 duos rom from xda-developers. This fixed my problem as well. Though my file structure was a bit different. Thanks. Now for the folder mount error. ;-)

    ReplyDelete
  41. Worked like a charm, thanks so much.

    ReplyDelete
  42. Thanks for letting me know that such a thing exists.

    I have the same problem with Clock after I installed cm13 custom ROM on Lenovo A7000. Your instructions helped me fix the problem.

    Thanks.

    ReplyDelete