19

I am installing Openshift Origin All-in-One Server using below links

https://docs.openshift.org/latest/getting_started/administrators.html#downloading-the-binary

after download when i did

tar -xf openshift-origin-server-v3.10.0-rc.0-c20e215-linux-64bit.tar.gz -C /opt/redhat

It throws following output but directory got untar n desired directory

ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74

4 Answers4

19

I just encountered the same.

Based on http://lifeonubuntu.com/tar-errors-ignoring-unknown-extended-header-keyword/

"It turns out this is just an issue with tar files created on Mac OS X. Mac OS X uses BSD tar and creates some extra info that is not recognized by GNU tar."

It should extract just fine, so no need to worry about it.

NOTE: The following is bad advice unless you perform other checks to make sure the file is fine. This will hide legitimate errors encountered while trying to extract.

If you'd prefer to not see those error lines you could just redirect the errors to /dev/null like this:

tar -xf openshift-origin-server-v3.10.0-rc.0-c20e215-linux-64bit.tar.gz -C /opt/redhat 2> /dev/null
aiguofer
  • 1,887
  • 20
  • 34
  • 11
    This is bad advice. This would redirect *all* errors to `/dev/null` and thus hide legitimate other possible warning messages. – josch Jan 13 '20 at 22:44
  • True that... didn't think of that at the time. I guess if you do other checks like sha to make sure the file isn't damaged you might still be "safe enough". – aiguofer Jan 14 '20 at 04:47
  • 1
    I am getting this error is being thrown up by the tar in WSL2 Debian when working with the tar created by `wsl --export `. – Michael Harvey Apr 06 '21 at 19:08
18

use --no-xattrs when you create a archive file using BSD tar in macOS, which will turn off xattr headers in the generated archive file.

tar -cz --no-xattrs --exclude .* -f zippath source
Ryan
  • 327
  • 2
  • 6
4

If you understand why the warning is happening and you want to suppress it, use, --warning=no-unknown-keyword

kgibm
  • 852
  • 10
  • 22
  • This flag is supported only by GNU `tar`, so I had to do `tar xf yourFile.tar.gz --warning=no-unknown-keyword || tar xf yourFile.tar.gz` in order to support both MacOS and Linux. – Moshisho Aug 09 '23 at 13:14
  • thanks! other useful flags: `tar --no-same-owner --no-same-permissions --warning=no-unknown-keyword --warning=no-timestamp --delay-directory-restore` – milahu Aug 11 '23 at 14:20
0

Addition to answer by aiguofer, if you don't want to see these errors, but also don't want to suppress all errors, you can just filter it out with the following:

tar -xf openshift-origin-server-v3.10.0-rc.0-c20e215-linux-64bit.tar.gz -C /opt/redhat 2>&1 | grep -v 'LIBARCHIVE.xattr.security.selinux'

Or if to suppress all xattr.security related errors:

tar -xf openshift-origin-server-v3.10.0-rc.0-c20e215-linux-64bit.tar.gz -C /opt/redhat 2>&1 | grep -v 'LIBARCHIVE.xattr.security'
spinpwr
  • 11
  • 1
  • 1