LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MD5Sum - How do I compute the MD5Sum of a downloaded iso? (https://www.linuxquestions.org/questions/linux-newbie-8/md5sum-how-do-i-compute-the-md5sum-of-a-downloaded-iso-4175532318/)

kd6tzf 01-28-2015 01:28 PM

MD5Sum - How do I compute the MD5Sum of a downloaded iso?
 
Was running Windows 8.1 Pro till it got sick and died. I managed to install Ubuntu 14.04 on my sick computer over Windows wiping it out.

I first installed Linux Mint and downloaded Ubuntu. Somehow I was able to verify checksums or MD5Sums. I think my age is catching up with me and my mind doesn't work like it used to.

How do I find the MD5sum of a downloaded iso file. I've downloaded debian-7.8.0-amd64-DVD-1-3.iso's and both update DVD's as well. I've located the MD5Sum files on the Mirror. Now, how do I compare those numbers/letters with the iso's I've downloaded.

I know I need to run a program to compute the MD5 but can't find it in the menu. I see I need to read man pages and info pages, but can't find them either.

A brain is a terrible thing to waste, but mine needs help.

Thanks,
Stephen

suicidaleggroll 01-28-2015 01:37 PM

The program is called md5sum. Open a terminal and run:
Code:

md5sum file.iso
If you have an md5 file, you can check it with the -c flag
Code:

md5sum -c file.iso.md5
It will read the md5 file, get the name of the file to check out of it, calculate the md5, compare it to what's in the file, and tell you if there are any differences.

kd6tzf 01-28-2015 01:52 PM

Also, if I run MD5Sum in a Terminal Window, do I need to be in the same directory where the files are located?

How do I compare the new created MD5Sum with the one posted on the Mirror? Do I just have to read it letter by letter, or is that an input for the MD5Sum program?

I know enough about Linux to be dangereous. I appreciate any guidance you may provide.

Thanks,

suicidaleggroll 01-28-2015 02:00 PM

Yes you should be in the same directory as the files.

See my edit on the -c flag.

kd6tzf 01-28-2015 02:06 PM

Here is the command I entered at the terminal and the result.

stephen@stephen:~/Downloads$ md5sum debian-update-7.8.0-amd64-DVD-1.iso.MD5SUMS
md5sum: debian-update-7.8.0-amd64-DVD-1.iso.MD5SUMS: No such file or directory

Here is the other info in this Directory;

stephen@stephen:~/Downloads$ ls
Audio Disc.toc debian-7.8.0-amd64-DVD-3.iso
Audio Disc.toc.bin debian-update-7.8.0-amd64-DVD-1.iso
debian-7.8.0-amd64-DVD-1.iso debian-update-7.8.0-amd64-DVD-2.iso
debian-7.8.0-amd64-DVD-2.iso MD5SUMS

kd6tzf 01-28-2015 02:10 PM

stephen@stephen:~/Downloads$ md5sum -c debian-update-7.8.0-amd64-DVD-1.iso.MD5SUMS
md5sum: debian-update-7.8.0-amd64-DVD-1.iso.MD5SUMS: No such file or directory
stephen@stephen:~/Downloads$

suicidaleggroll 01-28-2015 02:12 PM

As you can see from the output of ls, there is no file called "debian-update-7.8.0-amd64-DVD-1.iso.MD5SUMS". The file is just called "MD5SUMS".

kd6tzf 01-28-2015 02:15 PM

stephen@stephen:~/Downloads$ md5sum -c file.iso.md5
md5sum: file.iso.md5: No such file or directory
stephen@stephen:~/Downloads$

kd6tzf 01-28-2015 02:21 PM

stephen@stephen:~/Downloads$ md5sum -c file.iso.MD5SUMS
md5sum: file.iso.MD5SUMS: No such file or directory
stephen@stephen:~/Downloads$

I'm not trying to be difficult. I know Linux is short on explaining errors. I know the file I want checked is in this directory as is the mdd5sums file. I'm just having difficulty with it.

Thank you for trying to assist me.

suicidaleggroll 01-28-2015 02:26 PM

It's not short on explaining errors, it's telling you exactly what the error is. You keep typing in random names that don't exist. You might as well be running "md5sum -c thisisnotafile.andisgoingtofail".

Typing random non-existent file names into the terminal will accomplish nothing. As I said before, and as you can see from the output of the "ls" you ran earlier, the file is called "MD5SUMS".

Code:

md5sum -c MD5SUMS
With Linux, you can't just hammer on the keyboard and hope for the best, you need to think about what you're running and why. What do you hope to accomplish? How will the command know what it is you're trying to do? If you don't understand how to use a command, visit its man page with the "man" command. In this case:

Code:

$ man md5sum
MD5SUM(1)                        User Commands                        MD5SUM(1)

NAME
      md5sum - compute and check MD5 message digest

SYNOPSIS
      md5sum [OPTION]... [FILE]...

DESCRIPTION
      Print  or  check MD5 (128-bit) checksums.  With no FILE, or when FILE is
      -, read standard input.

      -c, --check
              read MD5 sums from the FILEs and check them

If you want more information, at the bottom of the man page is the command for more info
Code:

info coreutils 'md5sum invocation'
Which has this tiddbit on the -c flag
Code:

'-c'
'--check'
    Read file names and checksum information (not data) from each FILE
    (or from stdin if no FILE was specified) and report whether the
    checksums match the contents of the named files.  The input to this
    mode of 'md5sum' is usually the output of a prior,
    checksum-generating run of 'md5sum'.  Each valid line of input
    consists of an MD5 checksum, a binary/text flag, and then a file
    name.  Binary mode is indicated with '*', text with ' ' (space).
    For each such line, 'md5sum' reads the named file and computes its
    MD5 checksum.  Then, if the computed message digest does not match
    the one on the line with the file name, the file is noted as having
    failed the test.  Otherwise, the file passes the test.  By default,
    for each valid line, one line is written to standard output
    indicating whether the named file passed the test.  After all
    checks have been performed, if there were any failures, a warning
    is issued to standard error.  Use the '--status' option to inhibit
    that output.  If any listed file cannot be opened or read, if any
    valid line has an MD5 checksum inconsistent with the associated
    file, or if no valid line is found, 'md5sum' exits with nonzero
    status.  Otherwise, it exits successfully.


kd6tzf 01-28-2015 02:39 PM

Here is the output of the last attempt. It looks like we are making headway. I use copy and paste as much as possible to eliminate typos.

stephen@stephen:~/Downloads$ md5sum -c MD5SUMS
debian-7.8.0-amd64-DVD-1.iso: OK
md5sum: debian-7.8.0-amd64-DVD-10.iso: No such file or directory
debian-7.8.0-amd64-DVD-10.iso: FAILED open or read
debian-7.8.0-amd64-DVD-2.iso: OK
debian-7.8.0-amd64-DVD-3.iso: OK
md5sum: debian-7.8.0-amd64-DVD-4.iso: No such file or directory
debian-7.8.0-amd64-DVD-4.iso: FAILED open or read
md5sum: debian-7.8.0-amd64-DVD-5.iso: No such file or directory
debian-7.8.0-amd64-DVD-5.iso: FAILED open or read
md5sum: debian-7.8.0-amd64-DVD-6.iso: No such file or directory
debian-7.8.0-amd64-DVD-6.iso: FAILED open or read
md5sum: debian-7.8.0-amd64-DVD-7.iso: No such file or directory
debian-7.8.0-amd64-DVD-7.iso: FAILED open or read
md5sum: debian-7.8.0-amd64-DVD-8.iso: No such file or directory
debian-7.8.0-amd64-DVD-8.iso: FAILED open or read
md5sum: debian-7.8.0-amd64-DVD-9.iso: No such file or directory
debian-7.8.0-amd64-DVD-9.iso: FAILED open or read
md5sum: WARNING: 7 listed files could not be read
stephen@stephen:~/Downloads$ ls
Audio Disc.toc debian-7.8.0-amd64-DVD-3.iso
Audio Disc.toc.bin debian-update-7.8.0-amd64-DVD-1.iso
debian-7.8.0-amd64-DVD-1.iso debian-update-7.8.0-amd64-DVD-2.iso
debian-7.8.0-amd64-DVD-2.iso MD5SUMS
stephen@stephen:~/Downloads$

Also included ls of directory.

suicidaleggroll 01-28-2015 02:41 PM

So debian-7.8.0-amd64-DVD-1.iso, debian-7.8.0-amd64-DVD-2.iso, and debian-7.8.0-amd64-DVD-3.iso all checked out ok. You didn't download any of the others, so it just printed an error saying it couldn't find them. For some reason the update ISOs you downloaded weren't in the MD5SUMS file.

kd6tzf 01-28-2015 02:46 PM

I used gedit to open the MD5SUMS file and learned that I only have iso's for 1,2 and 3. The md5's for the update iso's are not included. Looks like 1,2 and 3 are all OK.

Thank you for your help. It is much appreciated.

Stephen

TxLonghorn 01-29-2015 12:15 PM

Here is how to do it without the MD5SUMS file:
1) Copy the correct md5sum number from the website into a new text file in your text editor -
EXAMPLE: 0307ffcd5046c176599904193899426e
2) In your File Manager, right-click on the folder containing the .iso file you downloaded, then chose Open In Terminal
3) In the terminal, enter the command: md5sum debian-update-7.8.0-amd64-DVD-1.iso
4) After a few seconds, it will give you the number. Copy the number to your text file, placing it under the original number, so that you can compare them at a glance.
EXAMPLE:
0307ffcd5046c176599904193899426e
0307ffcd5046c176599904193899426e


All times are GMT -5. The time now is 05:43 AM.