ImranRazaKhan
ImranRazaKhan

Reputation: 2297

tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'

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 in desired directory

Upvotes: 36

Views: 46661

Answers (5)

RKou
RKou

Reputation: 5221

I faced the same when getting a tar file from a target. The "default" tar command installed on my ubuntu host reports the following:

host$ tar xvf NAD_crash.14h07m50s470_16863.XCAL-NotifiDis-6-full.tar
tar: Ignoring unknown extended header keyword 'SCHILY.fflags'
NAD_crash.14h07m50s470_16863/
tar: Ignoring unknown extended header keyword 'SCHILY.fflags'
NAD_crash.14h07m50s470_16863/core.lz4
tar: Unexpected EOF in archive
tar: rmtlseek not stopped at a record boundary
tar: Error is not recoverable: exiting now

It appears that the tar command installed on the target is the BSD version one:

target# /bin/tar --version
bsdtar 3.4.1 - libarchive 3.4.1 zlib/1.2.7.1 liblz4/1.8.3

And the same command on my ubuntu host is the GNU one:

host$ tar --version
tar (GNU tar) 1.30

So, I installed the BSD tar command on my host through the libarchive-tools package to get the bsdtar command:

host$ sudo apt install libarchive-tools
[...]
host$ bsdtar --version
bsdtar 3.4.0 - libarchive 3.4.0 zlib/1.2.11 liblzma/5.2.4 bz2lib/1.0.8 liblz4/1.9.2 libzstd/1.4.4

Then, I was able to untar my archive without error:

host$ bsdtar xvf NAD_crash.14h07m50s470_16863.XCAL-NotifiDis-6-full.tar 
x NAD_crash.14h07m50s470_16863/
x NAD_crash.14h07m50s470_16863/core.lz4

Upvotes: 1

kgibm
kgibm

Reputation: 1038

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

Upvotes: 16

Ryan
Ryan

Reputation: 565

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

Upvotes: 40

spinpwr
spinpwr

Reputation: 351

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'

Upvotes: 1

aiguofer
aiguofer

Reputation: 2135

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

Upvotes: 27

Related Questions