dotnet/aspnetcore · error · ValueError
Unsupported compression format
Error message
Unsupported compression format: {file_extension} What it means
Raised as ValueError by extract_deb_file when the data.tar member's file extension is not one of .xz, .gz, or .zst. It guards tarfile.open against being called with an unknown mode; a different compression means the code has no decompressor wired up.
Solutions
- Run `ar t <deb>` to see the exact member name; the suffix in the error message tells you which compressor you need.
- If it is .bz2/.lzma/.Z, add a branch in extract_deb_file (mirroring the .zst branch using a streaming decompressor) or pre-convert the .deb.
- Switch --suite to one that ships data.tar.xz or data.tar.gz (modern Debian/Ubuntu suites do).
- If you control the input, repack the .deb with a supported compressor: `ar -d data.tar.bz2 foo.deb && ar -r data.tar.xz foo.deb` after recompressing.
Example fix
# before: data.tar.bz2 not handled -> 'Unsupported compression format: .bz2'
# after: add a branch (or switch suite)
# Option A: code change
elif file_extension == ".bz2":
mode = "r:bz2"
# Option B: switch to a suite that ships .xz
python3 install-debs.py --suite bookworm --mirror http://deb.debian.org/debian ... Defensive patterns
Strategy: validation
Validate before calling
# Enumerate data.tar compressions across the .debs you will download, fail early:
for f in tmp/*.deb; do
ext=$(ar t "$f" | awk '/^data\.tar/{print substr($0, index($0,"."))}')
case "$ext" in .xz|.gz|.zst) ;; *) echo "unsupported $ext in $f"; exit 1;; esac
done Type guard
import os, subprocess
SUPPORTED = {'.xz', '.gz', '.zst'}
def deb_compression_supported(deb: str) -> bool:
r = subprocess.run(['ar', 't', deb], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
for line in r.stdout.decode().splitlines():
if line.startswith('data.tar'):
return os.path.splitext(line.lower())[1] in SUPPORTED
return False Prevention
- Prefer modern suites (bookworm+, jammy+) that ship data.tar.xz.
- If you must handle .bz2/.lzma, extend extract_deb_file with a matching branch (mode 'r:bz2' / streaming lzma).
- Do not repack .debs with exotic compressors in your own pipeline.
When it happens
Trigger: os.path.splitext(tar_file_path)[1].lower() is compared against .xz/.gz/.zst and matches none — for example data.tar.bz2, data.tar.lzma, data.tar.lz4, or a member named data.tar with no compression extension at all.
Common situations: Older Debian releases shipped data.tar.lzma or data.tar.bz2; some embedded/ports distros produce uncompressed data.tar; the .deb was repacked with a non-standard compressor; filename has an unexpected case or suffix that os.path.splitext misparses (e.g. data.tar.gz handled correctly, but data.tar.Z fails).
Related errors
- Could not find 'data.tar.*' in
- Could not find checksum for
- Failed to download after attempts.
- Failed to download , Status Code
- Invalid Debian version format
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/07c6e7e1c089d508.
Report an issue: GitHub.
Appendix: source
Thrown at eng/common/cross/install-debs.py:332
subprocess.run([ar_tool, "p", os.path.abspath(deb_file), tar_filename], check=True, stdout=outfile, stderr=subprocess.PIPE)
file_extension = os.path.splitext(tar_file_path)[1].lower()
if file_extension == ".xz":
mode = "r:xz"
elif file_extension == ".gz":
mode = "r:gz"
elif file_extension == ".zst":
# zstd is not supported by standard library yet
decompressed_tar_path = tar_file_path.replace(".zst", "")
with open(tar_file_path, "rb") as zst_file, open(decompressed_tar_path, "wb") as decompressed_file:
dctx = zstandard.ZstdDecompressor()
dctx.copy_stream(zst_file, decompressed_file)
tar_file_path = decompressed_tar_path
mode = "r"
else:
raise ValueError(f"Unsupported compression format: {file_extension}")
with tarfile.open(tar_file_path, mode) as tar:
tar.extractall(path=extract_dir, filter=_rootfs_extraction_filter)
def _rootfs_extraction_filter(member, dest_path):
"""Tarfile extraction filter based on the 'data' filter that additionally
rewrites absolute-target symlinks/hardlinks into rootfs-relative paths.
"""
if (member.issym() or member.islnk()) and os.path.isabs(member.linkname):
link_dir = os.path.dirname(member.name)
new_linkname = os.path.relpath(member.linkname.lstrip('/'),
start=link_dir or '.')
member = member.replace(linkname=new_linkname, deep=False)
return tarfile.data_filter(member, dest_path)
def finalize_setup(rootfsdir):
lib_dir = os.path.join(rootfsdir, 'lib')
usr_lib_dir = os.path.join(rootfsdir, 'usr', 'lib')View on GitHub (pinned to 3600ca084e)