Kubuntu 22.04 LTS系统apt升级与依赖修复失败问题求助
Kubuntu 22.04 LTS系统apt升级与依赖修复失败问题求助
嘿,看起来你在Kubuntu 22.04 LTS上碰到了apt升级和依赖修复的棘手问题,我来帮你一步步理清问题并解决它。
你遇到的核心问题梳理:
- 尝试安装apache2和git时触发了依赖不满足错误,系统提示运行
apt --fix-broken install来修复 - 执行修复命令时,出现了systemd包解压损坏的错误(
ZSTD_decompressStream error : Corrupted block detected),这是因为下载的包文件本身有问题
你的操作及错误日志:
~# cd /var/www -bash: cd: /var/www: No such file or directory ~# apt install apache2 git Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: apache2 : Depends: apache2-bin (= 2.4.52-1ubuntu4.2) but it is not going to be installed Depends: apache2-data (= 2.4.52-1ubuntu4.2) but it is not going to be installed Depends: apache2-utils (= 2.4.52-1ubuntu4.2) libnss-systemd : Depends: systemd (= 249.11-0ubuntu3.6) libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.6) systemd : Depends: libsystemd0 (= 249.11-0ubuntu3.4) but 249.11-0ubuntu3.6 is to be installed systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.6) systemd-timesyncd : Depends: systemd (= 249.11-0ubuntu3.6) udev : Breaks: systemd (< 249.11-0ubuntu3.6) Breaks: systemd:i386 (< 249.11-0ubuntu3.6) Recommends: systemd-hwe-hwdb but it is not going to be installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). ~# apt update Hit:1 http://nl.archive.ubuntu.com/ubuntu jammy InRelease Hit:2 http://nl.archive.ubuntu.com/ubuntu jammy-updates InRelease Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease Hit:4 http://nl.archive.ubuntu.com/ubuntu jammy-backports InRelease Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done 291 packages can be upgraded. Run 'apt list --upgradable' to see them. ~# apt upgrade Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: libnss-systemd : Depends: systemd (= 249.11-0ubuntu3.6) libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.6) systemd : Depends: libsystemd0 (= 249.11-0ubuntu3.4) but 249.11-0ubuntu3.6 is installed systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.6) systemd-timesyncd : Depends: systemd (= 249.11-0ubuntu3.6) udev : Breaks: systemd (< 249.11-0ubuntu3.6) Breaks: systemd:i386 (< 249.11-0ubuntu3.6) Recommends: systemd-hwe-hwdb but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). ~# apt --fix-broken install Reading package lists... Done Building dependency tree... Done Reading state information... Done Correcting dependencies... Done The following additional packages will be installed: systemd Suggested packages: systemd-container libtss2-rc0 The following packages will be upgraded: systemd 1 upgraded, 0 newly installed, 0 to remove and 290 not upgraded. 15 not fully installed or removed. Need to get 0 B/4.580 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] (Reading database ... 168775 files and directories currently installed.) Preparing to unpack .../systemd_249.11-0ubuntu3.6_amd64.deb ... Unpacking systemd (249.11-0ubuntu3.6) over (249.11-0ubuntu3.4) ... dpkg-deb (subprocess): ZSTD_decompressStream error : Corrupted block detected dpkg-deb: error: <decompress> subprocess returned error exit status 2 dpkg: error processing archive /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb (--unpack): cannot copy extracted data for './lib/systemd/libsystemd-shared-249.so' to '/lib/systemd/libsystemd-shared-249.so.dpkg-new': unexpected end of file or stream Errors were encountered while processing: /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
一步步解决方案:
1. 删除损坏的systemd缓存包
问题的核心是下载的systemd包文件损坏了,先把这个坏包删掉:
rm /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb
2. 清理并更新apt缓存
接下来清理所有旧的缓存,重新从源获取最新的包信息:
apt clean apt update
3. 重新执行依赖修复
现在再运行修复命令,系统会重新下载完整的systemd包,应该能正常解压安装了:
apt --fix-broken install
4. 完成系统升级
修复完依赖后,就可以正常执行系统升级了:
apt upgrade
5. 安装需要的软件包
等系统升级完成,依赖都没问题了,就能顺利安装apache2和git了:
apt install apache2 git
补充:关于/var/www目录不存在的问题
这个是正常的,因为apache2还没安装,等apache2安装完成后,系统会自动创建/var/www目录,到时候你就能正常进入该目录了。
备注:内容来源于stack exchange,提问作者NicerApp_WebOS




