Linux FAQs--How to fix "tar:exiting with failure status due to previous errors"

Source: Internet
Author: User

problem : When I use the tar command to create a compressed file, it always fails during execution and throws an error stating "Tar: Failed exit due to previous error" ("Exiting with failure status due to previous errors") . What causes this error to occur and how to solve it?

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/A8/wKioL1Xq3BDhdWmgAAFfFriMUTA591.jpg "title=" 222. PNG "alt=" wkiol1xq3bdhdwmgaafffrimuta591.jpg "/>

When you execute the TAR command, you encounter the following error, the most likely cause is that you do not have read access to a file that you want to compress with the tar command.

    1. tar:Exitingwith failure status due to previous errors

So how do we determine the file that caused the error? Or how to identify other sources of error?

In fact, the tar command should print out what the so-called "Last Error" ("Previous errors") is, but if you let tar run in verbose mode (that is, verbose mode, for example,-CVF), you can easily miss this information. To find this information, you can filter out the TAR's standard output (stdout) information as follows.

    1. # tar zcvf bak_lamp.tar.gz /var/spool/cron/ /etc/ /root/scripts/ /application/data/ /application/apache/logs/ /application/apache/conf/ >/dev/null

You will then see the standard error (STDERR) information for the tar output. (LCTT: Naturally, you can do it without the V parameter.) )

  1. # tar zcvf bak_lamp.tar.gz/var/spool/cron//etc//root/scripts//application/data//application/apache/logs// application/apache/conf/>/dev/null

  2. Tar:removing leading '/' from member names #出现错误原因 (1)

  3. Tar:/root/scripts:cannot stat:no such file or directory # error occurred cause (2)

  4. Tar:exiting with failure status due to previous errors


You can see from the above example that the cause of the error is (1) "No files or directories were found"(tar:/root/scripts:cannot stat:no suchfile or directory) To solve this problem, simply create a/root/scripts file or directory, (2) "Remove '/' from the last side of the parameter name, and then re-execute the tar command."




This article is from the "Lanzhou Linux operation and Maintenance" blog, please be sure to keep this source http://linuxzkq.blog.51cto.com/9379412/1691628

Linux FAQs--How to fix "tar:exiting with failure status due to previous errors"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.