Linux 在 Solaris 上解压缩文件报告 - tar: directory checksum error
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7120232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Untar a file on Solaris reports - tar: directory checksum error
提问by Shawn Vader
Hi I am trying to untar a compressed file on a Solaris server. I run the command
您好,我正在尝试在 Solaris 服务器上解压缩压缩文件。我运行命令
tar xvf 4.56_release.tar.gz
But this reports the following error
但这会报告以下错误
tar: directory checksum error
tar:目录校验和错误
Initially I thought it was a bad download so I re-downloaded the file (actually a different version) and it reports the same error. Un-compressing and un-tar'ing it on Linux on a Linux server works fine.
最初我认为这是一个错误的下载,所以我重新下载了该文件(实际上是一个不同的版本)并且它报告了同样的错误。在 Linux 服务器上的 Linux 上解压缩和解压缩它工作正常。
Any ideas what I am doing wrong.
任何想法我做错了什么。
采纳答案by carlpett
The .tar.gz
is the hint for what you are doing wrong - you are not uncompressing it first. If your version of tar
supports it, you can use the -z
flag to specify it is compressed with gzip:
这.tar.gz
是您做错了什么的提示 - 您没有先解压缩它。如果您的版本tar
支持它,您可以使用该-z
标志来指定它是用 gzip 压缩的:
tar -xzvf 4.56_release.tar.gz
Otherwise, you'll have to gunzip
it manually:
否则,您将不得不gunzip
手动操作:
gunzip -c 4.56_release.tar.gz | tar xvf -
(The reason it works on Linux is probably that is has a newer/different version which automagically detects the compression)
(它在 Linux 上工作的原因可能是它有一个更新/不同的版本,它会自动检测压缩)
回答by Ilya K.
If you have a '.tar.bz2' type of archive file and neither of the above options worked ('-z' is not supported for your version of 'tar'), you can use:
如果您有一个 '.tar.bz2' 类型的存档文件,并且上述选项都不起作用(您的 'tar' 版本不支持'-z'),您可以使用:
bzip2 -d your_file.tar.bz2
to decompress, then use tar:
解压,然后使用tar:
tar -xvf your_file.tar
Taken from here: https://www.linuxquestions.org/questions/solaris-opensolaris-20/how-to-unpack-a-tar-bz2-file-654772/
取自此处:https: //www.linuxquestions.org/questions/solaris-opensolaris-20/how-to-unpack-a-tar-bz2-file-654772/
回答by Dan Anderson
Solaris tar automatically detects if the tar file is compressed or not, as does Linux. But older versions of Solaris and Linux do not do this. For Solaris, I think it needs to be Solaris 11 or greater to automatically detect compressed files. Otherwise use the tar -z
option.
Solaris tar 自动检测 tar 文件是否被压缩,Linux 也是如此。但是旧版本的 Solaris 和 Linux 不这样做。对于 Solaris,我认为需要 Solaris 11 或更高版本才能自动检测压缩文件。否则使用该tar -z
选项。