我正在运行 Debian,即:
# uname -A
Linux martlins2 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux
一段时间以来,我看到一些错误表明一些部分一些包用途未知压缩时做apt update
。特别是,问题的原因在于dpkg
:
# apt update
(...)
# apt upgrade
(...)
dpkg-deb: error: archive '/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
Traceback (most recent call last):
File "/usr/share/apt-listchanges/DebianFiles.py", line 124, in readdeb
output = subprocess.check_output(command)
File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dpkg-deb', '-f', '/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb', 'Package', 'Source', 'Version', 'Architecture', 'Status']' returned non-zero exit status 2.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/apt-listchanges", line 323, in <module>
main(config)
File "/usr/bin/apt-listchanges", line 104, in main
pkg = DebianFiles.Package(deb)
File "/usr/share/apt-listchanges/DebianFiles.py", line 358, in __init__
parser.readdeb(self.path)
File "/usr/share/apt-listchanges/DebianFiles.py", line 127, in readdeb
raise RuntimeError(_("Error processing '%(what)s': %(errmsg)s") %
RuntimeError: Error processing '/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb': Command '['dpkg-deb', '-f', '/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb', 'Package', 'Source', 'Version', 'Architecture', 'Status']' returned non-zero exit status 2.
dpkg-deb: error: archive '/tmp/apt-dpkg-install-XiLPN8/01-libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb' uses unknown compression for member 'control.tar
.zst', giving up
dpkg: error processing archive /tmp/apt-dpkg-install-XiLPN8/01-libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb (--unpack):
dpkg-deb --control subprocess returned error exit status 2
(...)
Errors were encountered while processing:
/tmp/apt-dpkg-install-XiLPN8/01-libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb
(...)
E: Sub-process /usr/bin/dpkg returned an error code (1)
为了证明这一点,我dpkg
直接运行命令(简化):
# dpkg -f /var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb 'Package'
dpkg-deb: error: archive '/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
该文件确实使用了这样的压缩:
# file /var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb
/var/cache/apt/archives/libdrm-amdgpu1_2.4.107+git2109030500.d201a4~oibaf~i_amd64.deb: Debian binary package (format 2.0), with control.tar.zs, data compression zst
我确实已经安装了该zstd
软件包:
# apt search zstd
(...)
libzstd1/stable,stable,now 1.4.8+dfsg-2.1 amd64 [installed,automatic]
fast lossless compression algorithm
(...)
zstd/stable,stable,now 1.4.8+dfsg-2.1 amd64 [installed]
fast lossless compression algorithm -- CLI tool
此外,我发现了以下 dpkg bugreport:https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/17642201.18.4ubuntu1.7
说版本中添加了 zstd 支持。我的 dpkg 版本是1.20.9
:
# dpkg --version
Debian 'dpkg' package management program version 1.20.9 (amd64).
(...)
以便可能不是问题。
/var/cache/apt/archives/*
我还删除了和 red的全部内容update && upgrade
。没有帮助。
您有什么建议吗?是否还有/还有其他包裹丢失吗? Debian版本没有这个功能吗?是配置问题吗?有什么解决方法吗?
答案1
Debian 的dpkg
软件包zstd
1.21.18之前的版本不支持压缩。支持正好赶上 Debian 12 添加。
我猜你已经添加了 Ubuntu PPA;你不应该在 Debian 中使用它们。
答案2
如果您运行的是 Debian < 12 并且需要安装使用 zstd 的 .deb 软件包,您可以重新打包它:
# Extract files from the archive
ar x some-package.deb
# Uncompress zstd files an re-compress them using xz
zstd -d < control.tar.zst | xz > control.tar.xz
zstd -d < data.tar.zst | xz > data.tar.xz
# Re-create the Debian package in /tmp/
ar -m -c -a sdsd /tmp/some-package.deb debian-binary control.tar.xz data.tar.xz
# Clean up
rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst
您现在应该能够安装新生成的包:
apt-get install /tmp/some-package.deb
答案3
为了扩展 @stephen-kitt 的答案,当用户添加一个 debian 官方存储库(例如bookworm
)/etc/apt/sources.list
,然后意外升级dpkg
到 Debian 版本时,这种情况也可能发生在 Ubuntu 中。
这种情况下的修复方法是删除源代码和sudo apt upgrade dpkg/jammy-updates
/或apt list
.