强文本我已经稳定地运行了 18.04.02 Desktop 大约 30 个月。服务器大约 2 周没有开机,所以今天早上开机时它进行了自动安全更新。更新完成后,我运行了更新管理器并收到以下错误消息
显然软件包不一致。我通过运行“sudo nano /etc/apt /sources.list”检查过,我没有任何第三方存储库。至少我是这么认为的。
有没有办法可以恢复到一致的软件包集?没有,我没有最近的备份。我当然已经按照错误消息中的建议进行了操作
已编辑以回应评论。apt-get install -f 的输出
Your Hardware Enablement Stack (HWE) is supported until April 2023.
Last login: Mon Sep 27 15:38:50 2021 from 192.168.1.96
stephen@leia:~$
stephen@leia:~$ sudo apt-get install -f
[sudo] password for stephen:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
linux-hwe-5.4-headers-5.4.0-77
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
libwebkit2gtk-4.0-37
Suggested packages:
libwebkit2gtk-4.0-37-gtk2
The following packages will be upgraded:
libwebkit2gtk-4.0-37
1 to upgrade, 0 to newly install, 0 to remove and 24 not to upgrade.
1 not fully installed or removed.
Need to get 0 B/13.4 MB of archives.
After this operation, 81.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 264170 files and directories currently installed.)
Preparing to unpack .../libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb ...
Unpacking libwebkit2gtk-4.0-37:amd64 (2.32.4-0ubuntu0.18.04.1) over (2.32.3-0ubuntu0.18.04.1) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb (--unpack):
cannot copy extracted data for './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5' to '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
/var/cache/apt/archives/libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
stephen@leia:~$
机器看上去很稳定,但现在无法更新。这是无可救药的问题吗?
谢谢你的帮助
答案1
您的输出包含解决问题所需的信息:
cannot copy extracted data for './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5' to '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new':unexpected end of file or stream
为了便于理解,我们稍微抽象一下……
cannot copy extracted data for X to Y:unexpected end of file or stream
X = './usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5'
Y = '/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37.53.5.dpkg-new'
这是什么意思?
“文件或流意外结束“”的意思就是这个包不完整或损坏了。你必须从本地缓存中删除它,然后让 apt 下载一个新的、新鲜的、完整的包副本。
哪个包裹?
让我们使用 X 提供的路径来向 apt 询问这个问题:
- 包名称在第二行:
libwebkit2gtk-4.0-37
$ dpkg -S /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37
libwebkit2gtk-4.0-37:amd64: /usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.0.so.37
我如何删除损坏的本地包并下载全新的副本?
$ sudo apt clean libwebkit2gtk-4.0-37 // Delete local
$ sudo apt update
$ sudo apt install --reinstall libwebkit2gtk-4.0-37 // Download fresh
答案2
对我有用的解决方案是执行 sudo apt full-upgrade,其效果是下载损坏软件包的最新副本,然后执行 sudo apt upgrade