Why tar Can't Restore Mac Extended Attributes on Linux
We built a Mac-style tar archive by hand, extracted it on a real Linux box, and traced the exact kernel call that rejects it, down to the single attribute name.
By Ram Velmurugan · Founder & Lead Developer, 1dot.ai
com.apple.*, and Linux only accepts attribute names under four fixed namespaces: user, trusted, security, and system. com.apple.* isn't one of them, so the kernel refuses to store it and GNU tar prints Operation not supported. The file itself extracts intact either way. If you want the message gone, restrict what tar tries to restore with --xattrs-include='user.*' or exclude the Apple names explicitly, both covered below.Editorial note: 1dot.ai makes Quick X Folder Preview, a folder and archive preview app for Mac mentioned near the end of this guide. It plays no role in tar, extended attributes, or anything tested below. Every command here ran in a Linux container (Ubuntu 24.04.5 LTS, GNU tar 1.35), not on a Mac, since that is the platform this error actually shows up on. We did not have bsdtar available in this session, so we built the archive's pax headers by hand in Python, in the same per-file pax format bsdtar writes, and checked the behavior against the GNU tar manual, the Linux kernel source, and libarchive's pax writer. This is a companion piece to our earlier post on why COPYFILE_DISABLE does nothing on Linux, which covers a different tar/Mac metadata mismatch. Checked live on November 25, 2026.
The Short Version
You extracted a tarball that came from a Mac, maybe a backup, a release artifact, or a project someone zipped up and tarred for you, and GNU tar printed something like:
tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'photo.jpg': Operation not supportedThe archive isn't corrupted and the extraction didn't stop. Something far more specific happened: tar read one piece of Mac-only metadata out of the archive, tried to reattach it to the extracted file, and the Linux kernel refused, because the name of that metadata doesn't fit any category Linux recognizes. We reproduced the exact message on November 25, 2026, traced the real system call behind it with strace, and worked out which tar flags make the warning disappear without quietly dropping attributes you'd actually want kept.
- We Built the Archive and Reproduced the Error
- A Dead End First: a Global Header GNU tar Misreads
- Why Linux Rejects com.apple.* Specifically
- Five Extraction Commands, Five Different Outcomes
- The Fix, Depending on What You Actually Want
- Not the Same as "Ignoring Unknown Extended Header Keyword"
- Does This Affect Our Own Apps?
- Sources & Further Reading
- FAQ
We Built the Archive and Reproduced the Error
This session's container has no Mac, and we couldn't install bsdtar either (the package manager refused the install under this session's own guardrails). So rather than restate what other articles say macOS-made archives contain, we built one ourselves, matching the real pax extended-header format bsdtar actually writes, using Python's tarfile module:
$ python3 - <<'PY'
import tarfile, os
os.makedirs("src", exist_ok=True)
with open("src/one.txt", "wb") as f:
f.write(b"data")
t = tarfile.open("fixed.tar", "w", format=tarfile.PAX_FORMAT)
ti = t.gettarinfo("src/one.txt", arcname="one.txt")
ti.pax_headers = {
"SCHILY.xattr.user.onlyone": "just-one-value",
"SCHILY.xattr.com.apple.quarantine": "0081;deadbeef;Safari;GUID",
}
with open("src/one.txt", "rb") as f:
t.addfile(ti, f)
t.close()
PY
$ tar --xattrs --xattrs-include='*' -xvf fixed.tar -C out
one.txt
tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'one.txt': Operation not supported
$ echo "exit: $?"
exit: 0Two attributes went in, one Linux-safe (user.onlyone) and one Apple-only (com.apple.quarantine, the same attribute macOS sets on anything downloaded from the internet). One restored cleanly. The other produced the exact error reported in the wild, on Ubuntu 24.04.5 LTS with GNU tar 1.35, and the process still exited 0, meaning this did not fail the extraction as a whole.
A Dead End First: a Global Header GNU tar Misreads
Our first attempt at building this archive used a shortcut: passing pax_headers directly to tarfile.open() instead of to each file's own TarInfo. That produced a different, uglier error:
tar: setxattrat: Cannot set '' extended attribute for file 'one.txt': Operation not supportedAn empty attribute name. We almost wrote that off as the real behavior, since it still looked like a failure related to extended attributes. Running the extraction under strace -e trace=setxattr showed what tar actually tried to do:
setxattr("doc.txt", "\177", "this-should-work", 16, 0) = -1 EOPNOTSUPP (Operation not supported)The attribute name tar passed to the kernel was a single byte, \177 (the DEL character), not user.realtest, the key we set. That is not a Linux namespace problem. It comes from where the record sat in the archive: tarfile.open(..., pax_headers=...) writes a global extended header (typeflag g, name ./@PaxHeader), which applies to every subsequent member in the archive, not the per-file local header (typeflag x) that real tar implementations use for a single file's xattrs. Python wrote a valid global header (its documentation says pax_headers on TarFile becomes a pax global header). GNU tar 1.35 is the one that mishandles an xattr record found there: it passed a garbage name instead of applying the attribute. Setting pax_headers on the TarInfo object instead, as shown above, writes a local header and produces the real, correctly named error. If you build test archives with Python's tarfile and expect GNU tar to restore per-file xattrs, put them on each TarInfo.
Why Linux Rejects com.apple.* Specifically
Linux's extended attributes are organized into four namespaces:
| Namespace | What it's for |
|---|---|
user | Attributes any process owning the file can set, the one ordinary tools use |
trusted | Visible and settable only with CAP_SYS_ADMIN, used by system tools |
security | Reserved for the kernel's own security modules, like SELinux contexts |
system | Used by the kernel itself for things like POSIX ACLs |
When a program sets an attribute, the kernel (fs/xattr.c) looks for a handler whose prefix matches the name among the handlers the filesystem registered. If none matches, it returns EOPNOTSUPP without storing anything. ext4, XFS, Btrfs and tmpfs register handlers only for user., trusted., security. and system., so com.apple.quarantine is rejected on all of them, on a real disk or in a container. FUSE mounts are the exception: FUSE registers one catch-all handler with an empty prefix and hands any name to the userspace filesystem, which may accept it.
We checked that tar was not the cause by taking it out of the loop. With Python's os.setxattr() on this session's ext4 disk, user.test set and read back with no error. com.apple.quarantine failed with [Errno 95] Operation not supported, on ext4 and again on tmpfs at /dev/shm.
com.apple.* attributes are a convention Apple's own tools follow, not a category the Darwin kernel validates against a fixed list the way Linux does. That asymmetry, not a bug in either operating system, is why this breaks going from Mac to Linux. A Linux user.* name is just another name to macOS.Five Extraction Commands, Five Different Outcomes
We ran all five against the same archive on November 25, 2026, to map out exactly when the warning appears and when it doesn't:
| Command | What actually happened |
|---|---|
tar -xf archive.tar | No attempt at all |
tar --xattrs -xf archive.tar | Restores user.* only, others skipped silently |
tar --xattrs --xattrs-include='*' -xf archive.tar | Tries every namespace, errors loudly on com.apple.* |
tar --xattrs --xattrs-include='user.*' -xf archive.tar | Restores only what Linux accepts, no error possible |
tar --xattrs --xattrs-include='*' --xattrs-exclude='com.apple.*' -xf archive.tar | Tries everything except the names guaranteed to fail |
The pattern worth remembering: --xattrs by itself is quiet, because the GNU tar manual specifies that only the user namespace is restored by default even with the option enabled. The warning only shows up once you explicitly widen the filter with --xattrs-include='*', telling tar to attempt everything in the archive, Apple metadata included, and then report back honestly when the kernel says no.
The Fix, Depending on What You Actually Want
Just want the files, nothing else
Do nothing extra. tar -xf archive.tar never requests extended-attribute restoration in the first place, since --no-xattrs is the default. No flag, no warning, no missing file content either way.
Want your own custom attributes back, nothing from macOS
tar --xattrs --xattrs-include='user.*' -xf archive.tar restores only the namespace Linux actually supports. Anything under com.apple.* is never attempted, so there's nothing for the kernel to reject.
Want everything tar can restore, minus the guaranteed failures
tar --xattrs --xattrs-include='*' --xattrs-exclude='com.apple.*' -xf archive.tar tries every namespace present in the archive except the one you already know will fail. We tested this against the same archive that triggers the error unfiltered: silent, clean extraction.
Not the Same as "Ignoring Unknown Extended Header Keyword"
Search around this error and you'll run into a related but distinct message, Ignoring unknown extended header keyword. That one happens earlier in the process: it's GNU tar failing to even recognize the name of a pax header field, most often LIBARCHIVE.xattr.*, a keyword bsdtar writes that GNU tar 1.35, the current release, still does not read. Our COPYFILE_DISABLE post shows bsdtar writing that keyword and SCHILY.xattr.*, which GNU tar does read, for the same attribute. libarchive's pax writer does this by default (its source sets both WRITE_LIBARCHIVE_XATTR and WRITE_SCHILY_XATTR). The error this post is about happens one step later: tar parsed the header and understood the attribute's name and value. The kernel is the one saying no, to one specific name, not to the header format.
Because a bsdtar archive carries both keywords, you can get both messages from one file. We built an entry with both records for com.apple.quarantine and extracted it with --xattrs-include='*.*', the pattern the Gentoo handbook uses when unpacking a stage3 archive:
$ tar --xattrs --xattrs-include='*.*' -xf lib.tar -C out
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.com.apple.quarantine'
tar: setxattrat: Cannot set 'com.apple.quarantine' extended attribute for file 'one.txt': Operation not supported
$ tar --warning=no-unknown-keyword --xattrs --xattrs-include='*.*' --xattrs-exclude='com.apple.*' -xf lib.tar -C out2
$ echo $?
0--xattrs-exclude='com.apple.*' removes the second line only. The first goes away with --warning=no-unknown-keyword. Both are cosmetic: the file extracted intact in every run.
Does This Affect Our Own Apps?
No, and we'd rather state that plainly than let it sit unanswered. Quick X Folder Preview shows you what's inside an archive from the space bar before you extract it, useful for spotting unexpected files, but it has no involvement in extended attributes or how a Linux box handles them after extraction. Files Magic AI's System Cleaner targets unused apps, old installers, and developer caches on your own Mac, nothing to do with archives moving to Linux. If a CI job or a server is the one printing this warning, the tar flags above are the actual fix, not either product.
Sources & Further Reading
GNU tar's own documentation on the behavior: the GNU tar manual's Extended File Attributes section, which states that --no-xattrs is the default, that --xattrs stores or restores attributes under the POSIX.1-2001 (pax) format, that only the user namespace is restored on extraction by default, and documents --xattrs-include and --xattrs-exclude as sequential filters applied to the attribute set.
A public report showing that real macOS-made archives carry com.apple.* attributes in their pax headers (it shows the "Ignoring unknown extended header keyword" warnings for com.apple.quarantine and others): "Tar Files Created on macOS Display Errors When Extracting on Linux" (December 2024). We did not find a public report of the exact "Cannot set" message; the transcripts above are our own.
Kernel and library source, read November 25, 2026: Linux fs/xattr.c (handler lookup returns EOPNOTSUPP when no prefix matches), Linux fs/fuse/xattr.c (one handler with an empty prefix), and libarchive archive_write_set_format_pax.c (both xattr keywords written by default). The --xattrs-include='*.*' pattern is from the Gentoo AMD64 handbook's stage3 step.
Version banners in this post were read directly from tar --version (GNU tar 1.35) and /etc/os-release (Ubuntu 24.04.5 LTS) in this session's own container on November 25, 2026. The strace output and the extended attribute checks via Python's os.setxattr/os.getxattr were run the same day, in the same container.
Our related coverage: why COPYFILE_DISABLE does nothing when you tar on Linux, and what ._ files and the __MACOSX folder actually are in a zip archive.
Frequently Asked Questions
The Bottom Line
tar: Cannot set ... extended attribute ... Operation not supported is a correctly-working kernel refusing a correctly-read attribute name that simply doesn't fit Linux's four namespaces. We proved the file content survives untouched, traced the exact rejected system call with strace, and found that the warning only ever appears when you explicitly ask tar to restore every namespace in an archive with --xattrs-include='*'. Narrow that to user.*, or exclude com.apple.* explicitly, and it goes away for good.
Looking for more Mac-to-Linux troubleshooting? Read why COPYFILE_DISABLE does nothing on Linux, see what ._ files and __MACOSX actually are in a zip archive, browse every 1dot.ai guide, or check Quick X Folder Preview's product page.
Want to See Inside an Archive Before You Open It?
Quick X Folder Preview adds 13 Quick Look extensions to the space bar, notarized by Apple. Free for 14 days, then $4.99 once for a lifetime license.
Try It FreeRead More Guides