Its always a good idea to validate a file's MD5 checksum before and after you download it (and after placing it on your /sdcard). Reputable sites/sources should publish the MD5 sums for the files hosted there. Beware of those that do not. Verifying the MD5 sum of the file that you've downloaded ensures that you have a full, complete, and uncorrupted version of the file.
--- edit 8/11/2010 --- Okay, so I realized that not everyone could actually verify their MD5 checksums directly on their phone via the method I originally published below. So, I decided to create my own Android application to do this. Here's the result of that effort. Many thanks to jcase over at XDA for helping me get started doing this by providing me a sample project and some starter code he had on-hand.
My AFV (Android File Verifier) app (free in the Android Market)
is the successor to the following checksum app and has a much
better UI and more features *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Download my (free)v2.2 app: MD5-Checksum-v2.2.apk
(MD5 checksum: 3aec3fd4cae8f200db8457894ae4193f)
Here's the app details (click 'Show' to view):
// ScaryAlienWare MD5/SHA1 Checksum utility v2.2
//
// developed August-2010 by Android Forum's "scary alien"
//
// Features:
//
// - calculates MD5 or SHA1 checksum of specified file
// - defaults to /sdcard/download directory
// - copies calculated checksum to clipboard
// - also displays file size
// - tested on HTC Droid Eris Android 2.1
// - tested on Motorola Droid-X Android 2.1
// - tested on Motorola Cliq Android 1.5
// - very light-weight app (only 36kb in size)
// - v2.2 now includes file-selector, menu, jar-file verification)
//
// Special thanks to:
//
// - jcase at XDA for allowing me to view example project co-authored w/eclips3
// and for the starter MD5 Java code; this was a huge help and I wouldn't have
// tried this without jcase's help and encouragement
//
// - RLK for helping me test on his Motorola Cliq
Note: during my testing, I realized/discovered you can actually view a file's MD5 checksum using Astro File Manager (i.e., via viewing a file's details). So, you don't really need this application but my version also calculates SHA1 checksums and was pretty fun to develop .
Enjoy and let me know if you have any questions. --- edit 8/11/2010 ---
You actually now have several options for checking MD5 sums on your phone:
- via my free app (MD5-Checksum-v2.2.apk) [gratuitous/shamelss plug ]; download and manually install
- via ManD5 Lite (free app in the Market) [this app did not work for me at the time I first posted this thread; it does work, wonderfully, now]
- via Astro File Manager (long-press your file and select 'Details')
- via Android Terminal Emulator [note: not all phones can do this since the md5sum utility may not be present/installed] by typing "md5sum filename" (you might need to long-press the menu key to bring-up the keyboard)
Checking Via The Android Software Development Kit (SDK)
1. Download and install the Android SDK
2. Start-up Windows Command Prompt (or Terminal for Macs)
3. Change to the SDK's tools directory
4. Enter adb shell md5sum /sdcard/download/gscript.zip
4. After downloading, extract the md5sum.exe file to your Android SDK's tools directory. That way, you'll have a home for all of the tools that you use for rooting.
5. To run it, just launch the Windows Command Prompt and change (cd) to your Android SDK's tools directory.
6. Type md5sum.exe c:\temp\gscript.zip
7. For example:
Code:
C:\Documents and Settings> cd c:\android\android-sdk-windows\tools
C:\android\android-sdk-windows\tools>md5sum.exe c:\temp\gscript.zip
\92796a8c6e61e8f1ee36e315c0acae7d *c:\\temp\\gscript.zip
Checking from a Mac
Courtesy of doogald's post below:
Things are a bit easier from a Mac, since there is no utility that you need ro find or download. To check from the terminal on a mac:
- [optional] change directory to the location of the file for which you would like to check. For example, cd ~/Downloads
- use the openssl command to check, using the following syntax: openssl md5 pathtofile
For example, openssl md5 gscript.zip
Last edited by scary alien; March 29th, 2011 at 12:09 PM.
Reason: updated app to v2.2
The Following User Says Thank You to scary alien For This Useful Post:
scroll down to "MD5" Lots of other cool stuff there too
astrostrat89,
Thanks for that! I downloaded and installed and tested MD5 with the same sample file...very nice interface to use! (and lots of other cool things I'm going to check out too). Appreciate this a lot (and I'm sure others will too!).
Also, I looked for a free Android app to use in place of running from the Android Terminal Emulator, but the one I tried (ManD5 Free) wasn't calculating the same MD5 checksum and eu1 published and I received using the various methods in the OP.
I tried using Android Terminal Emulator from the market to get the md5 checksum from the gscript.zip file and when I entered the information from the original post I get the response "permission denied".
Well, I tried the free version and the sums that it returned didn't match the known values and that values that I calculated using other methods (all of the others matched--this one didn't).
I tried using Android Terminal Emulator from the market to get the md5 checksum from the gscript.zip file and when I entered the information from the original post I get the response "permission denied".
That's odd...I tested this on my rooted Eris, but not su'd to root (as evidenced by the "$" prompt). I also tested this on my unrooted Droid X and it also worked from there.
Is this working for others using the Android Terminal Emulator?
tingster, can you post a screenshot? (by the way, are you sure you typed "md5sum" before the filename? i.e., "md5sum /sdcard/download/gscript.zip"...you will get "permission denied" if you omit the "md5sum" command).
Last edited by scary alien; August 2nd, 2010 at 08:35 AM.
Vudu is a fairly powerful and easy scripting language to use (the debugger is awesome), the latest version is not documented. But I work with the guy who wrote it, and I've been pestering him to get on that.
won't work for me either using android terminal, get "illegal instruction". tried it su and without.
varkie,
Can you try /system/bin/md5sum /sdcard/download/gscript.zip from the Android Terminal Emulator (or some other file name to check the MD5 sum against). This will force an explicit reference to the native Android md5sum utility instead of possibly hitting the busybox version.
Can you try /system/bin/md5sum /sdcard/download/gscript.zip from the Android Terminal Emulator (or some other file name to check the MD5 sum against). This will force an explicit reference to the native Android md5sum utility instead of possibly hitting the busybox version.
Thanks.
/system/bin/md5sum returns a message "not found", /sdcard/download/gscript.zip returns "permission denied"
Okay, thanks again! I'm still investigating other options for doing this directly on the phone for those that this doesn't work on. I have a friend here at work that has a Motorola Cliq (1.5) that it doesn't work on either. It works on my rooted Eris (not su'd) and it works on my Droid X (not (yet) rooted).
I tried finding a Market app that would work, but I don't trust the one I found, so I'm going to try to write one myself (with help from jcase ).
Hey guys, I've updated the first post to include details of an app that I developed that you can install and use directly on your phone to calculate MD5 or SHA1 checksums of any file on your phone (that you have access to).
Anyway, check it out and let me know what you think and/or if you have any problems or questions. Be gentle, this is my first app developed for Android .
Again, big props and thanks to jcase from XDA who let me view a sample project he developed with eclips3 and gave me some MD5 sum starter code to get me on my way. I would not have tried creating this without him being willing to help me out. He deserves lots of credit for not only helping me but all of the help he gives the Android community in general.
Things are a bit easier from a Mac, since there is no utility that you need ro find or download. To check from the terminal on a mac:
- [optional] change directory to the location of the file for which you would like to check. For example, cd ~/Downloads
- use the openssl command to check, using the following syntax: openssl md5 pathtofile
For example, openssl md5 gscript.zip
doogald,
Thank you for that. I will include this in the OP. I plan on re-writing the first post to make it a little cleaner and incorporate this info and comments from erisuser1 about these checksum's value and meaningful use. Also, was it you that told me about (Windows) fciv (File Checksum Integrity Verifier)? I've got to go back and lookup this tool and include it too since it will also display SHA1 sums.
edit: yep, went back and did a quick search and you are (still) the man! thanks, info. and credit to you forthcoming in the top post.
Last edited by scary alien; August 11th, 2010 at 08:39 PM.
Reason: fciv info.
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Just a quick question: Is there a way to repair an MD5 mismatch ? I have 5 Nandroid backups that I can't reinstall because of this.
Haven't finished researching yet but figured I'd ask anyway.
Thanks.
Just a quick question: Is there a way to repair an MD5 mismatch ? I have 5 Nandroid backups that I can't reinstall because of this.
Haven't finished researching yet but figured I'd ask anyway.
Thanks.
It is pretty unusual to experience a md5 mismatch - when it occurs, it means that something horrible has gone wrong: for instance, the file system of your SD card got corrupted, the SD card has developed some dead patches ( "bad blocks" ), or you corrupted/truncated one or more image files when restoring nandroid backups from your PC to your SD card.
In short, these are exactly the types of disasters that the use of checksums is there for - so that a bad situation is not made worse by restoring corrupted backups to your phone.
In general, the answer to your question is an emphatic "NO!" - the checksums does not somehow "save" information that got lost/changed, so that it can be magically recovered.
Now, the ".md5" file saved with each nandroid backup is just a plain text file, which could certainly be edited so that you are changing the checksum of one of the image files. So, the nandroid restore could be "tricked" into restoring a file, but you would never want to do this unless you were absolutely sure that the image file you were providing the checksum for was a valid, uncorrupted image file.
__________________
Please don't send me PMs - post your questions so others may benefit from any answers given.
The Following User Says Thank You to erisuser1 For This Useful Post:
By the way, when the Nandroid backups are created, the script uses an "mdsum *img > nandroid.md5" command to create the checksum file that is used later by a Nandroid restore to verify that your files are intact.
Altering or rebuilding your nandroid.md5 file is certainly possible but should only be done, like erisuser1 said, if you are sure that the files and checksums you are "re-introducing" are proper. Like he said, having five Nandroids you can't restore points to a much larger problem.
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Interesting. So reading your guys posts sounds like I should reformat my SD card. 2 of the backups were only days old, so somethings up with the card or file system ? It's an 8GB Class 6, with approx. 2.5GB free.
Downloaded ScaryAlienWare Checksum Utility v2.1.
I'm assuming the following:
MD5 Checksum (hex)
Below that line a bunch of numbers in Green.
I see green in a bunch of files, & guess if it's in red it means it's a bad file ?
Everything else seems to run good on the card. Approx. 90+ apps installed on the card, approx. 1600 backed up to the card, about 2GB of music, some videos & some pics. 2.37GB free space. My only problem, which has only started within the last 3 weeks has been trying to restore my backups. Also, I do all this on the phone, nothing goes back & forth to the computer.
Have tried all various versions including BeatMod Gingerbread but keep coming back to this rom because of it's speed, instant opening, no/or the least, FC's and no phantom reboots.
Going to wait before I do anything till I hear from you guys.
Thanks.
Last edited by crz6662; March 29th, 2011 at 10:52 AM.
Reason: add
Interesting. So reading your guys posts sounds like I should reformat my SD card. 2 of the backups were only days old, so somethings up with the card or file system ? It's an 8GB Class 6, with approx. 2.5GB free.
Downloaded ScaryAlienWare Checksum Utility v2.1.
I'm assuming the following:
MD5 Checksum (hex)
Below that line a bunch of numbers in Green.
I see green in a bunch of files, & guess if it's in red it means it's a bad file ?
Everything else seems to run good on the card. Approx. 90+ apps installed on the card, approx. 1600 backed up to the card, about 2GB of music, some videos & some pics. 2.37GB free space. My only problem, which has only started within the last 3 weeks has been trying to restore my backups. Also, I do all this on the phone, nothing goes back & forth to the computer.
Have tried all various versions including BeatMod Gingerbread but keep coming back to this rom because of it's speed, instant opening, no/or the least, FC's and no phantom reboots.
Going to wait before I do anything till I hear from you guys.
Thanks.
crz6662,
Wow...been a while since I've even looked at my old "MD5 Checksum" app...there's a newer version available (free) in the Market: AFV (Android File Verifier) that has quite a few more features (but hey, an MD5 is an MD5, eh? ).
The text in green below the "MD5 Checksum:" line is indeed the checksum itself. I'm not sure about what the "in red" you are referring to (my app only calculates the checksum--it can't actually tell that the file is bad or not). My AFV app that I refererenced about has a feature where you can select the nandroid.md5 file in a Nandroid backup directory, long-press, and select "Verify Nandroid Backup" and it will cross-check the MD5 checksum of the files listed in the nandroid.md5 file. This is basically equivalent to the "md5sum -c" command which is what the Nandroid restore function will do prior to allow a restore operation to proceed.
Also, I'm just inferring here, but it sounds like you are not using an HTC Droid Eris. I say this because of the "G1" reference and the non-Eris ROMs that you mention.
I would hate to speculate further about what future course of action you might take given that its not an Eris...
I bow to erisuser1's much greater / vast experience (in most things, lol)...so, hopefully, he might have a suggestion or two...
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Thanks for the reply. I'll download the new version & check it out.
As far as the "in red", I just assumed if it was a good file, it's green, if it's bad, it's red. That's what I thought the app did, so you didn't install a corrupted file. I had already deleted all my backups so I couldn't do a check of those. I'm not understanding what good is knowing the MD5 checksum hex if I can't edit it, fix it or whatever. Not being a smart ass at all, just don't know. I'd appreciate any further explanation you could give me.
I'm still a bit lost as to what exactly the app does if it's not to tell me if a files good or not. What's the purpose ?
I'm far from an expert, that's why I listen/learn from guys like you, so thanks again for your time.
You are correct, I am not using a Droid Eris, I'm using the HTC Dream/T-Mobile G1. I know we're not talking the same phone but a lot of things with android can pertain to the system & not a particular phone. I'd say that's the case here though you might not be able to give me step by step instruction. I've gained more here than elsewhere.
When researching MD5 this is 1 of the sites that came up. This forum was actually 1 of the more helpful.
Will your new version tell me if I have a bad file ? Going to download now and see what she does.
Appreciate any more feedback. Thanks.
Thanks for the reply. I'll download the new version & check it out.
As far as the "in red", I just assumed if it was a good file, it's green, if it's bad, it's red. That's what I thought the app did, so you didn't install a corrupted file. I had already deleted all my backups so I couldn't do a check of those. I'm not understanding what good is knowing the MD5 checksum hex if I can't edit it, fix it or whatever. Not being a smart ass at all, just don't know. I'd appreciate any further explanation you could give me.
I'm still a bit lost as to what exactly the app does if it's not to tell me if a files good or not. What's the purpose ?
I'm far from an expert, that's why I listen/learn from guys like you, so thanks again for your time.
You are correct, I am not using a Droid Eris, I'm using the HTC Dream/T-Mobile G1. I know we're not talking the same phone but a lot of things with android can pertain to the system & not a particular phone. I'd say that's the case here though you might not be able to give me step by step instruction. I've gained more here than elsewhere.
When researching MD5 this is 1 of the sites that came up. This forum was actually 1 of the more helpful.
Will your new version tell me if I have a bad file ? Going to download now and see what she does.
Appreciate any more feedback. Thanks.
You are most welcome! We like to think that AF is a pretty helpful site (and the Eris forums in particular ).
Having the MD5 checksum gives you a benchmark for comparing a file against in the future so that you know that a file is whole and uncorrupted.
It (and the myriad of other types of checksums like SHA1, CRC32, etc.) are just calculations done on a file (or string) in an attempt give it a unique "signature" (for lack of a more precise term in this context).
Using the Nandroid backups as an excellent example, the nandroid-mobile.sh script that is invoked by the custom recovery (ClockworkMod in your case) will, after creating the Nandroid backup files, calculate the checksums for each of the files made in the backup.
Then, when you go to actually restore these Nandroid backups, you would like some assurance (warm and fuzzies ) that the files are indeed in the same condition (size and content) as they were when the backup was created. The nandroid-mobile.sh script will, before performing a Nandroid restore operation, verify that the MD5 checksums still match the ones recorded in the nandroid.md5 file.
Having the newly-calculated MD5 checksum match the old / previously recorded checksum tells you that the file has not been modified.
Having them not match tells you that something has either modified the file or the checksum.
Does that help?
Cheers!
The Following User Says Thank You to scary alien For This Useful Post:
An MD5 is what is called a cryptographic hash of a file. Basically, the contents of a file are run through a very specific arithmetic formula, and the result is a particular numeric result of an exact number of bits. What is very useful about the MD5 hash is that it is impossible to predict what the result is going to be before you create the hash, and changing a single bit in the file will create a randomly different MD5 result.
The MD5 of a file with this sentence: "the quick brown fox jumped over the lazy dog" - is this: bb0fa6eff92c305f166803b6938dd33a
If I change one bit in that file by capitalizing the first t: "The quick brown fox jumped over the lazy dog" - the MD5 is this: 5c6ffbdd40d9556b73a21e63c3e0e904
One way that an MD5 is used is to verify that a file that somebody sent to you, or that you downloaded, is the one that you were supposed to have. If the MD5 does not match, you can be certain that somehow the file changed - an incomplete download, or somebody intercepted and changed the file.
In the particular case of a Nandroid backup, no, there is absolutely nothing that you can do to repair a mismatched MD5 error. As I said before, it is nearly impossible to predict what an MD5 hash result will be before you actually run the calculation, and you cannot take an MD5 hash result and determine the contents of the original file. Just having what the MD5 result should be will not tell you what the original file should have been.
(And, before any pedants chime in, it is true that MD5 is no longer considered completely secure, as somebody has found a way - using a massively parallel array of PS3s, if I remember correctly - to take a file and add something to it to create a specific MD5 hash result. However, that still is not a solution in this case - the last thing that you would want is to have a Nandroid backup have something random added to it just to match an MD5 hash.)
The AFV tool will just tell you the result of the MD5 calculation - it will not (nor cannot) tell you what a file needs to be to create a specific MD5 hash result.
Last edited by doogald; March 29th, 2011 at 02:03 PM.
The Following 2 Users Say Thank You to doogald For This Useful Post:
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Yes, that helps me further, but what could be changing my files ? My backups have never left the phone. I've never even opened them. Let me ask you this. If I mount my SD card to my computer and mess with other files, could that possibly corrupt my backups ? Should I transfer my backups to the computer & just leave them there till I actually needed them ? I'd like to leave them on the phone but not if they're going to keep getting screwed up.
Let me throw a scenario at you.
Say I do an MD5 checksum and copy the number shown on a particular backup. Later when I try to reinstall the backup it comes up MD5 mismatch. Technically I could insert the copied number to the mismatched file, replacing the 1 that's there, and it would then install ? Not that I would ever do that. Just trying to wrap my head around this.
Downloaded your new app version, haven't played with it yet.
You've been very helpful explaining this for and I think I almost got it. I won't stop till I know it.
Thanks for the help Scary Alien.
Doogald: Your explanation also helped. I was in the middle of reply to Scary.
Thanks Guys
Last edited by crz6662; March 29th, 2011 at 01:44 PM.
Also, the Nandroid backup (at least on the Eris) is actually a compressed zip file (I think), and when I just used AFV it will not calculate the MD5 for that particular name.
doogald,
Not sure what you mean by the last part of this...? Can you elaborate a little?
Yes, that helps me further, but what could be changing my files ? My backups have never left the phone. I've never even opened them. Let me ask you this. If I mount my SD card to my computer and mess with other files, could that possibly corrupt my backups ? Should I transfer my backups to the computer & just leave them there till I actually needed them ? I'd like to leave them on the phone but not if they're going to keep getting screwed up.
Let me throw a scenario at you.
Say I do an MD5 checksum and copy the number shown on a particular backup. Later when I try to reinstall the backup it comes up MD5 mismatch. Technically I could insert the copied number to the mismatched file, replacing the 1 that's there, and it would then install ? Not that I would ever do that. Just trying to wrap my head around this.
Downloaded your new app version, haven't played with it yet.
You've been very helpful explaining this for and I think I almost got it. I won't stop till I know it.
Thanks for the help.
crz6662,
Let me back-track a little here first..
I feel a little like an idiot right now...(lol)...I should have realized and remembered this earlier .
I just re-read your first post here in this thread and it occurred to me that there are actually other reasons why you would get an "MD5 mismatch" when trying to do a Nandroid restore.
The main one is that you have (or had ) some non-standard characters in your Nandroid backup directory's name (like a space, ampersand, asterisk, etc.).
Did you perchance rename your Nandroid backups in ROM manager?
I have seen this reported by several folks on several threads that this is indeed the behavior that is reported when a Nandroid backup is renamed with "wonky" characters.
Let me know.
The Following User Says Thank You to scary alien For This Useful Post:
Not sure what you mean by the last part of this...? Can you elaborate a little?
Thanks!
Sure.
Go into AFV.
Navigate to where your Nandroids are stored.
You will see that all of the Nandroid backups are listed as folders - long press on one, try to calculate an MD5, and it will give you a message "Long-press not applicable for selected row".
(For some reason, I always thought Nandroid backups were zip files, but they really are folders, aren't they?)
So, never mind, I will go back and re-edit my post and pull that part out.
The Following User Says Thank You to doogald For This Useful Post:
Go into AFV.
Navigate to where your Nandroids are stored.
You will see that all of the Nandroid backups are listed as folders - long press on one, try to calculate an MD5, and it will give you a message "Long-press not applicable for selected row".
(For some reason, I always thought Nandroid backups were zip files, but they really are folders, aren't they?)
So, never mind, I will go back and re-edit my post and pull that part out.
edit: yes, they are folders
lol...no, I don't have any functionality in AFV that operates on folders / directories--just files. Sorry, it is a little confusing...(I'll try to put something in the next version to address this (at least a pop-up note re. that)).
You'd have to select a system.img, data.img, cache.img, or boot.img file individually in the Nandroid backup's subdirectory or use the Verify Nandroid Backup on the nandroid.md5 file (when you do that, the app will read through the file and checksum pairs in the nandroid.md5 file, re-calculate the MD5 on the file listed, and compare it to the one stored in the nandroid.md5 (it really is what I expect is equivalent to the md5sum -c functionality)).
Sorry for the confusion re. that. By the way, my next version of AFV will support having a filename passed to it from other apps (like other file managers (already tested with Astro, ES File Explorer, OI File Manager))...thanks to eu1 (again ) for that suggestion .
Cheers!
The Following User Says Thank You to scary alien For This Useful Post:
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Quote:
Originally Posted by scary alien
crz6662,
Let me back-track a little here first..
I feel a little like an idiot right now...(lol)...I should have realized and remembered this earlier .
I just re-read your first post here in this thread and it occurred to me that there are actually other reasons why you would get an "MD5 mismatch" when trying to do a Nandroid restore.
The main one is that you have (or had ) some non-standard characters in your Nandroid backup directory's name (like a space, ampersand, asterisk, etc.).
Did you perchance rename your Nandroid backups in ROM manager?
I have seen this reported by several folks on several threads that this is indeed the behavior that is reported when a Nandroid backup is renamed with "wonky" characters.
Let me know.
Yes, I did rename all the backups, with the Rom name and date. Had 2 Donut, 2 Eclair & 1 gingerbread. Renamed so I knew which was which.
I also caught that but had no hash marks but I did have some "spaces".
Ah ha. A bulb just lite up. Even a single empty space will change my checksum. I think it finally clicked guys.
Won't be renaming. Period.
Appreciate you ERIS guys helping this ol' G1 guy out. I'm in the G1 section right now checking it out.
I think I remember when I 1st joined this forum back in 2008 there wasn't much here so I kinda forgot about it & spent my time over @ XDA.
Let me say, very helpful people here, even if your in the wrong section. Friendly. Easy going.
XDA is a great site but a few of them are all over people for things, posting in the wrong area, asking something that was already answered, crap like that. Just a few though. They really need to chill, have a beer, relax.
Thanks
Last edited by crz6662; March 29th, 2011 at 02:35 PM.
The Following User Says Thank You to crz6662 For This Useful Post:
Yes, I did rename all the backups, with the Rom name and date. Had 2 Donut, 2 Eclair & 1 gingerbread. Renamed so I knew which was which.
I also caught that but had no hash marks but I did have some "spaces".
Ah ha. A bulb just lite up. Even a single empty space will change my checksum. I think it finally clicked guys.
Well, the name of the file won't affect the checksum, but the nandroid-mobile.sh script's ability to actually identify your Nandroid backup files will.
When the custom recovery invokes the nandroid-mobile.sh script, it passes the name of the Nandroid backup directory via a shell command line and a space character will cause the filename to be parsed as separate pieces (i.e., your filename will actually appear short to the nandroid-mobile.sh script and he won't be able to actually do the comparison). His reporting of the error is obviously not as precise as it should be.
Make sense? Sorry for stringing this out for so long, but at least we got to "meet" a fellow Android user and discuss the merits of MD5 checksums .
Cheers!
The Following User Says Thank You to scary alien For This Useful Post:
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Quote:
Originally Posted by scary alien
Well, the name of the file won't affect the checksum, but the nandroid-mobile.sh script's ability to actually identify your Nandroid backup files will.
When the custom recovery invokes the nandroid-mobile.sh script, it passes the name of the Nandroid backup directory via a shell command line and a space character will cause the filename to be parsed as separate pieces (i.e., your filename will actually appear short to the nandroid-mobile.sh script and he won't be able to actually do the comparison). His reporting of the error is obviously not as precise as it should be.
Make sense? Sorry for stringing this out for so long, but at least we got to "meet" a fellow Android user and discuss the merits of MD5 checksums .
Cheers!
Oh no, not at all. Nice talking to you and I learned some things.
Think I'll be spending more time here. Makes me want to go out and get an Eris. LOL
Ah ha. A bulb just lite up. Even a single empty space will change my checksum. I think it finally clicked guys.
Won't be renaming. Period.
I looked at the nandroid-mobile.sh script - it would fault out BEFORE any md5sum checks were performed (and give you a different error message) if the "nandroid.md5" file could not be found (for instance, if the backup folder name had some spaces in it).
I rename nandroid backups all the time - I just avoid the use of anything but letters, digits, dashes, underscores, and the dot (".") character.
The "nandroid.md5" file only contains the names "boot.img", "system.img", "data.img", et cetera - the only way that you would get a "MD5 mismatch" error if you changed the names of THOSE files (not the folder that contained them).
It should be easy enough for you to figure out which of those image files is giving you fits - use AFV to examine each of them, and then compare the MD5 checksums one by one to the values reported in the "nandroid.md5" file (it is a simple text file).
eu1
The Following User Says Thank You to erisuser1 For This Useful Post:
I looked at the nandroid-mobile.sh script - it would fault out BEFORE any md5sum checks were performed (and give you a different error message) if the "nandroid.md5" file could not be found (for instance, if the backup folder name had some spaces in it).
I rename nandroid backups all the time - I just avoid the use of anything but letters, digits, dashes, underscores, and the dot (".") character.
The "nandroid.md5" file only contains the names "boot.img", "system.img", "data.img", et cetera - the only way that you would get a "MD5 mismatch" error if you changed the names of THOSE files (not the folder that contained them).
It should be easy enough for you to figure out which of those image files is giving you fits - use AFV to examine each of them, and then compare the MD5 checksums one by one to the values reported in the "nandroid.md5" file (it is a simple text file).
eu1
eu1,
I still think that an errant space in the Nandroid backup directory name will manifest itself as the "MD5 mismatch" condition, but only from having read reports on AF and over at XDA that this ended-up being the case. I thought I had actually tested this myself late last summer, but I don't have that feeling of having first-hand experienced / tested it (possibly since its been so long).
I've looked at the script before trying to make sense of how this could be and I do certainly hesitate (with very good reason) in disagreeing with you (but I've eaten crow before...).
I will make a point to re-test this when I get home in a little while (just to make sure ).
Also, the AFV's "Verify Nandroid Backup" function invoked via long-pressing the nandroid.md5 file will check each file and report which one does not match, so you don't have to manually do this for each file listed.
Cheers!
edit: time for me to eat a little crow: I actually did test this way back in September:
and I got an "Error : run 'nandroid-mobile.sh restore' via adb!' error instead. Perhaps the version of ClockworkMod's nandroid-mobile.sh script is different than that of the Eris and will yield this result? Dunno. As you can see, the above thread is from the Droid X forums and involved ClockworkMod and not Amon_RA recovery.
I'll still re-test this tonight .
Last edited by scary alien; March 29th, 2011 at 03:12 PM.
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
erisuser: Thanks for your input. Helpful explanation. It still baffles me then, what could be screwing up my backups. And this problem just started a few weeks ago, and only, it seems, with my nandroid backups.
I did download ScaryAlien's newer AFV, which by the way has a nicer look & feel to it. So I'm going to peak around some files, create a new backup and then go inside it and look around.
Per your explanation it sounds relatively easy so I'm off to search.
Thanks.
Okay, here's the scoop re. the mysterious "md5sum mismatch" issue.
I do believe that an errant space (or other character that the shell would find not compatible with his parsing of the command-line arguments) will cause the "Error: md5sum mismatch, aborting" error message to be produced--but probably only for ClockworkMod recovery.
For Amon_RA recovery, the error message you will see on the phone will be "Error : run 'nandroid-mobile.sh restore' via adb!" (which is exactly what I saw back in September).
So, what's difference this time? Well, I (finally ) checked the /cache/recovery/log file to examine its contents.
The "Error: md5sum mismatch, aborting" actually occurs in the Amon_RA invocation with an errant space, but only the "Error: run 'nandroid-mobile.sh restore' via adb!" message is actually displayed by Amon_RA's custom recovery. I'm guessing that many others that have reported this behavior (not just Eris users) were using ClockworkMod which can probably display the first message.
Now, why does this happen? Simple, its because the nandroid-mobile.sh script cannot find the nandroid.md5 file to perform its "md5sum -c" command against.
Here's what I did to test all of this:
1. Created a Nandroid backup of my current setup
2. Renamed the BCDS-20110329-2223 subdir to "gsb 16 -20110329-2223"
3. I also made a copy of the "gsb 16 -20110329-2223" and named it "gsb16x-20110329-2223" (no spaces) and then I altered the nandroid.md5 file's first entry (for the boot.img file) to place an "x" at the front of his MD5 checksum
4. Booted back into recovery
5. Attempted to restore the space-filled "gsb 16 -20110329-2223" and only saw the "Error: run 'nandroid-mobile.sh restore' via adb!" message on the phone's display. But this is what I saw in the /cache/recovery/log for this attempt:
Code:
Starting recovery on Tue Mar 29 22:34:27 2011
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (320 x 480)
Build : RA-eris-v1.6.2
[trackball optional]
I:Set boot command "boot-recovery"
Command: "/sbin/recovery"
ro.secure=0
:
: <bulk of the build.prop snipped>
:
adb.connected=
I:Set boot command ""
I:Set boot command ""
I:Set boot command ""
I:Set boot command ""
Restore gsb 16 -20110329-2223 ?
Press Trackball or END/PWR to confirm,
any other key to abort.
Restoring : .nandroid-mobile v2.2.2: invalid option -- 2
nandroid-mobile v2.2.2: invalid option -- 0
nandroid-mobile v2.2.2: invalid option -- 1
nandroid-mobile v2.2.2: invalid option -- 1
nandroid-mobile v2.2.2: invalid option -- 0
nandroid-mobile v2.2.2: invalid option -- 3
nandroid-mobile v2.2.2: invalid option -- 2
nandroid-mobile v2.2.2: invalid option -- 9
nandroid-mobile v2.2.2: invalid option -- -
nandroid-mobile v2.2.2: invalid option -- 2
nandroid-mobile v2.2.2: invalid option -- 2
nandroid-mobile v2.2.2: invalid option -- 2
nandroid-mobile v2.2.2: invalid option -- 3
nandroid-mobile v2.2.1
Searching for backup directories, matching gsb, to delete or restore
or compress
Looking for the latest backup, will display other choices!
Default backup is the latest: /sdcard/nandroid/HT9xxxxxxxxx/gsb 16 -20110329-2223
Other available backups are:
grep: invalid option -- 2
BusyBox v1.15.3 (2010-02-06 17:13:19 CET) multi-call binary
Usage: grep [-HhrilLnqvsoeFEABC] PATTERN [FILE]...
Search for PATTERN in each FILE or standard input
Options:
-H Prefix output lines with filename where match was found
-h Suppress the prefixing filename on output
-r Recurse subdirectories
-i Ignore case distinctions
-l List names of files that match
-L List names of files that do not match
-n Print line number with output lines
-q Quiet. Return 0 if PATTERN is found, 1 otherwise
-v Select non-matching lines
-s Suppress file open/read error messages
-c Only print count of matching lines
-o Show only the part of a line that matches PATTERN
-m MAX Match up to MAX times per file
-F PATTERN is a set of newline-separated strings
-E PATTERN is an extended regular expression
-e PTRN Pattern to match
-f FILE Read pattern from file
-A Print NUM lines of trailing context
-B Print NUM lines of leading context
-C Print NUM lines of output context
Using G1 keyboard, enter a unique name substring to change it and <CR>
or just <CR> to accept: Accepting default.
Restore path: /sdcard/nandroid/HT9xxxxxxxxx/gsb 16 -20110329-2223
/sbin/nandroid-mobile.sh: cd: line 997: can't cd to /sdcard/nandroid/HT9xxxxxxxxx/gsbsh: 16: unknown operand
Verifying backup images...
md5sum: nandroid.md5: No such file or directoryError: md5sum mismatch, abortingError : run 'nandroid-mobile.sh restore' via adb!
As you can see, the "md5sum mismatch" was produced--just not shown.
6. Then, I tried to restore my "gsb16x-20110329-2223" with the altered nandroid.md5 file (bad MD5 sum for the boot.img file) and this is what I got:
Code:
I:Set boot command ""
I:Set boot command ""
I:Set boot command ""
Restore gsb16x-20110329-2223 ?
Press Trackball or END/PWR to confirm,
any other key to abort.
Restoring : .
nandroid-mobile v2.2.1
Searching for backup directories, matching gsb16x-20110329-2223, to delete or restore
or compress
Looking for the latest backup, will display other choices!
Default backup is the latest: /sdcard/nandroid/HT9xxxxxxxxx/gsb16x-20110329-2223
Other available backups are:
Using G1 keyboard, enter a unique name substring to change it and <CR>
or just <CR> to accept: Accepting default.
Restore path: /sdcard/nandroid/HT9xxxxxxxxx/gsb16x-20110329-2223
Verifying backup images...
.............boot.img: FAILED
cache.img: OK
data.img: OK
system.img: OK
md5sum: WARNING: 1 of 4 computed checksums did NOT match
Error: md5sum mismatch, aborting
Error : run 'nandroid-mobile.sh restore' via adb!
Wow scary, I'm gonna have to give you a "TL;DR" on that one.
Actually, it would have been helpful if I did read a little more carefully - crz6662 did say (way back there several novels ago) that he was using ClockworkMod recovery.
I ran the same experiments as you - put a space in the nandroid backup folder name and attempted a restore, with both Amon_RA and ClockworkMod.
Just as you said, ClockworkMod produces a (spurious) "MD5 mismatch!" error message, and Amon_RA produces the "run nandroid-mobile.sh" message - on screen
So, it looks as if crz6662 actually has 5 good Nandroid backups - he just needs to name the backup folders without using any spaces or other unusual characters. Hopefully he didn't go and delete them because (I) convinced him they were bad!
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Quote:
Originally Posted by erisuser1
Wow scary, I'm gonna have to give you a "TL;DR" on that one.
Actually, it would have been helpful if I did read a little more carefully - crz6662 did say (way back there several novels ago) that he was using ClockworkMod recovery.
I ran the same experiments as you - put a space in the nandroid backup folder name and attempted a restore, with both Amon_RA and ClockworkMod.
Just as you said, ClockworkMod produces a (spurious) "MD5 mismatch!" error message, and Amon_RA produces the "run nandroid-mobile.sh" message - on screen
By the way, I like novels. LOL
Later.
So, it looks as if crz6662 actually has 5 good Nandroid backups - he just needs to name the backup folders without using any spaces or other unusual characters. Hopefully he didn't go and delete them because (I) convinced him they were bad!
eu1
Yeah, actually I did delete them all. Damn. Oh Well. Not a big deal.
You guys are great. Really helpful. At least I know what I was doing wrong and how to avoid it next time.
Thanks again guys
Last edited by crz6662; March 29th, 2011 at 07:17 PM.
Reason: add
Device(s): All Rooted/Flashed - Nexus 7, T-MO Samsung SGS2, Motorola Defy MB525, G1, Sony Ericsson, Motorola Ra
Carrier: Not Provided
Thanks: 9
Thanked 1 Time in 1 Post
Found this zip over @ XDA.
There's a PDF file that explains how to use this inside the zip, haven't used it yet myself, haven't needed to, but looks relatively easy. Shame I didn't find this earlier.
Phone backups (Nandroid) have installed with no further problems yet but I've only restored twice, and I haven't changed the backups names at all.
To help someone else in the future who may need it.
Found this zip over @ XDA.
There's a PDF file that explains how to use this inside the zip, haven't used it yet myself, haven't needed to, but looks relatively easy. Shame I didn't find this earlier.
Phone backups (Nandroid) have installed with no further problems yet but I've only restored twice, and I haven't changed the backups names at all.
To help someone else in the future who may need it.
Later
Yeah, this looks like some just detailed the steps for manually fixing / rebuilding a bad or missing nandroid.md5 file.
However, if the checksums in the nandroid.md5 file truly do not match the entries in the nandroid.md5 file, then, like we said before, you've probably got bigger problems (unwanted space character in the Nandroid backup directory filename notwithstanding) and "fixing" the MD5 sums in the file will not make your files any "better" (they didn't match for a reason...and that reason should make you not trust the contents of the .img files that are backed-up in that Nandroid backup directory). At least I wouldn't trust them.
I just uploaded my newest version of AFV to the Android Market.
Been working on this one for a while (sorry it took so long ).
Thanks again to eu1 for suggesting the "launch / send" from other apps idea .
Hope you enjoy it!
Here's the change log:
version 1.4 - 7-Apr-2011:
- display elapsed time for long-running operations
- allow app to be invoked from other applications (tested with Astro File Manager, Estrongs File Explorer, OI File Manager); use the "Send" function
- added donate button (donate version of app will be published soon)
- added 'md5sum -c Type Check' function for .md5 files (equivalent to 'Verify Nandroid Backup') to make it clear that functionality exists for non-Nandroid .md5 files too
Last edited by scary alien; April 7th, 2011 at 09:18 PM.
The Following 2 Users Say Thank You to scary alien For This Useful Post:
AFV (Android File Verifier) v1.6 just published to the Market.
Change logs for v1.6 and v1.5:
[version 1.6 - 02-May-2011]:
- thanks to all who have donated or purchased the donate version (very much appreciated!)
- fix FC issue when null/empty URI is received via Send function (please contact me if you experience an FC or other issue)
- several other minor fixes
- dynamically identify external storage directory instead of hardcoding /sdcard
- make pop-up dialogs cancelable via back button
[version 1.5 - 11-Apr-2011]:
- fixed FC issue when last remembered directory is no longer present (renamed / deleted) and app is re-launched (thanks to Michael C. for bringing this to my attention)
The Following User Says Thank You to scary alien For This Useful Post:
By the way, the donate version will be updated tonight... I have to rebuild it each time I create a new version and wanted to make sure that there were no issues before rolling things out to the donate users. I like to build and run the donate version to make sure there's no issues (its usually a package name conflict...ugh, I wish there was a better, more dynamic way instead of having to maintain multiple versions).
I know that sounds kind of backwards, lol, but I thought it would be less impactful.
The HTC Droid Eris launched for Verizon Wireless on November 6th in part as the carrier's first Android Phone. However it was overshadowed by the other member of the inaugural Verizon Droid duo - the Motorola Droid. The Droid Eris might look fa... Read More