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?

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."

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.