Linux tar:错误不可恢复:正在退出

Linux tar:错误不可恢复:正在退出,linux,doctrine,compression,gzip,tar,Linux,Doctrine,Compression,Gzip,Tar,当我解开教条时 -rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz 我总是收到这样的错误消息 root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz . . . Doctrine-1.2.0/tests/ViewTestCase.php Doctrine-1.2.0/CHANGELOG gzip: stdin: decom

当我解开教条时

-rw-r--r-- 1 root root 660252 2010-10-16 23:06 Doctrine-1.2.0.tgz
我总是收到这样的错误消息

root@X100e:/usr/local/lib/Doctrine/stable# tar -xvzf Doctrine-1.2.0.tgz

.
.
.

Doctrine-1.2.0/tests/ViewTestCase.php
Doctrine-1.2.0/CHANGELOG

gzip: stdin: decompression OK, trailing garbage ignored
Doctrine-1.2.0/COPYRIGHT
Doctrine-1.2.0/LICENSE
tar: Child returned status 2
tar: Error is not recoverable: exiting now
untar操作正常,但我总是收到此错误消息


有什么线索表明我做错了什么吗?

我会尝试分别解压和解压,看看会发生什么:

mv Doctrine-1.2.0.tgz Doctrine-1.2.0.tar.gz
gunzip Doctrine-1.2.0.tar.gz
tar xf Doctrine-1.2.0.tar

尝试使用
wget
获取您的归档文件,我在通过浏览器下载归档文件时遇到了相同的问题。然后我只需复制存档链接并在终端中使用以下命令:

wget http://PATH_TO_ARCHIVE
如果出现“错误不可恢复:立即退出”,则可能指定了不正确的路径引用

[me@host ~]$ tar -xvf nameOfMyTar.tar -C /someSubDirectory/
tar: /someSubDirectory: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
[me@host ~]$
确保提供正确的相对或绝对目录引用,例如:

[me@host ~]$ tar -xvf ./nameOfMyTar.tar -C ./someSubDirectory/
./foo/
./bar/
[me@host ~]$ 

问题是您没有安装bzip2。tar程序依赖这个外部程序进行压缩。 要安装bzip2,这取决于您使用的系统。例如,使用Ubuntu,它将在Ubuntu上运行

sudo apt-get install bzip2
GNU tar程序不知道如何压缩现有文件,如user-logs.tar(bzip2就是这样做的)。tar程序可以使用外部压缩程序gzip、bzip2、xz,方法是打开到这些程序的管道,通过管道将tar存档发送到压缩实用程序,压缩实用程序压缩从tar读取的数据,并将结果写入tar程序指定的文件名

或者,tar和压缩实用程序可以是同一个程序。BSD tar使用lib archive进行压缩(除了名称之外,它们并没有真正的区别)。

使用sudo

sudo tar -zxvf xxxxxxxxx.tar.gz

事实上,错误已经消失了。但不确定是什么原因造成的。我今天在尝试解压缩和卸载mediawiki-1.18.0.tar.gz时遇到了这个错误。我重新下载了mediawiki-1.18.0.tar.gz,错误已停止,因此我假设该文件在初始下载过程中已损坏。您没有回答原始问题,而是修复了另一个错误。对,我没有回答用户特定的问题,但标题中的错误消息与我的相同。