Unable to tar a .tgz file

I have a .tgz file and I'm running tar -xfvz cudnn-9.0-linux-x64-v7.tgz but that I get the following error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I don't understand why this is happening. I got the the file using the following curl command: curl -O https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/cudnn-9.0-linux-x64-v7.tgz

Perhaps this is a problem with curl? I tried using wget but that doesn't even get the file for some reason.

What am I doing wrong?

With the command: tar -xfz cudnn-9.0-linux-x64-v7.tgz I get the following error:

tar: z: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

Solution 1:

Your answer is simple, that file doesn't exists and curl just save a HTML document as a .tgz file!

You can check it by opening this link in your browser. As you see, Page Not Found!

Also you can check it by command line:

curl -Is https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/cudnn-9.0-linux-x64-v7.tgz | head -n 1
HTTP/1.1 404 Not Found

As you can see, it has the same output.

So when you run this command:

curl -O https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/9.0_20171129/cudnn-9.0-linux-x64-v7.tgz

Curl just download this web page and save it as .tgz file. So you can change .tgz suffix to .html and open that file with favorite web browser like firefox, because its not in gzip format it is just a HTML document.

Also when we check cudnn-9.0-linux-x64-v7.tgz file format, as you see it is HTML document and it's not gzip compressed data:

file cudnn-9.0-linux-x64-v7.tgz 
cudnn-9.0-linux-x64-v7.tgz: HTML document, ASCII text, with very long lines, with CRLF, LF line terminators

Update:

For download cudnn you can visit this page, and after logging in, you can find many versions of cuddn that you can download them.

And this is exactly the same file with which one, you want to download it before (But now many new versions and easy install files like .deb are available and you can download them instead).


Update2:

Because you said, you can't access web browser, I got this download link and write this command:

curl -O http://developer.download.nvidia.com/compute/redist/cudnn/v7.0.5/cudnn-9.0-linux-x64-v7.tgz

So you can use it by command line without web browser or logging in.

Solution 2:

As per this SuperUser answer:

If you are using the -v flag, try leaving it off. This should reduce the output and let you see what is going on.

I'll see if I can find a better link. In the meantime change your command to:

tar -xfz cudnn-9.0-linux-x64-v7.tgz

Now you can see all the error messages. Then adjust your question accordingly or answer your own question using the new information.