You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04 LTS安装libwebkitgtk报错如何解决

Ubuntu 18.04 apt 依赖损坏修复方案

问题背景

运行环境为x64架构Ubuntu 18.04 LTS,执行sudo apt-get install安装软件时持续抛出未满足依赖错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libwebkit2gtk-4.0-37 : Depends: libjavascriptcoregtk-4.0-18 (= 2.32.3-0ubuntu0.18.04.1) but 2.32.4-0ubuntu0.18.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

核心错误为libwebkit2gtk-4.0-37依赖2.32.3-0ubuntu0.18.04.1版本的libjavascriptcoregtk-4.0-18,但系统待安装的该依赖版本为2.32.4-0ubuntu0.18.04.1,系统默认提示执行apt --fix-broken install修复。

已尝试操作及报错

  • 手动执行sudo apt-get install libwebkit2gtk-4.0-37安装目标包:终端先提示存在冗余自动安装包可通过sudo apt autoremove清理,随后出现大量dpkg警告,提示多个软件包的文件列表文件缺失;解压2.32.4-0ubuntu0.18.04.1版本的libwebkit2gtk-4.0-37安装包时抛出lzma压缩数据损坏、文件流意外终止错误,dpkg返回错误码1,安装失败:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libexiv2-14 libgee-0.8-2 libgexiv2-2 libraw16 linux-hwe-5.4-headers-5.4.0-66
  linux-hwe-5.4-headers-5.4.0-67 linux-hwe-5.4-headers-5.4.0-73
  linux-hwe-5.4-headers-5.4.0-74 shotwell-common
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  libwebkit2gtk-4.0-37-gtk2
The following packages will be upgraded:
  libwebkit2gtk-4.0-37
1 upgraded, 0 newly installed, 0 to remove and 206 not upgraded.
43 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.
dpkg: warning: files list file for package 'fonts-sil-abyssinica' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libatk-adaptor:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libvorbisfile3:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libquadmath0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libxkbfile1:amd64' missing; assuming package has no files 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)
  • 误操作:将版本号2.32.4-0ubuntu0.18.04.1识别为独立包名,执行sudo apt-get purge 2.32.4-0ubuntu0.18.04.1尝试卸载,系统提示找不到对应包:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package 2.32.4-0ubuntu0.18.04.1
E: Couldn't find any package by glob '2.32.4-0ubuntu0.18.04.1'
E: Couldn't find any package by regex '2.32.4-0ubuntu0.18.04.1'
  • 按系统提示执行sudo apt --fix-broken install修复损坏依赖,报错与手动安装时完全一致,修复无效。

修复步骤

注:2.32.4-0ubuntu0.18.04.1是Ubuntu为18.04编译打包的软件版本号,并非独立包名;lzma解压报错本质是本地apt缓存的deb包下载不完整/损坏,dpkg文件列表警告是此前安装中断导致的元数据损坏,按以下顺序操作即可修复

  1. 删除本地损坏的缓存安装包,清空全部apt缓存
    sudo rm -f /var/cache/apt/archives/libwebkit2gtk-4.0-37_2.32.4-0ubuntu0.18.04.1_amd64.deb
    sudo apt clean
    
  2. 更新软件源索引,拉取最新的包版本信息
    sudo apt update
    
  3. 同时安装同版本的webkit核心包和依赖包,强制保证版本完全匹配(webkit相关包要求严格版本一致,这是解决依赖冲突的核心)
    sudo apt install --reinstall libjavascriptcoregtk-4.0-18=2.32.4-0ubuntu0.18.04.1 libwebkit2gtk-4.0-37=2.32.4-0ubuntu0.18.04.1
    
  4. 执行依赖修复命令收尾,完成剩余包的配置
    sudo apt --fix-broken install
    sudo apt upgrade -y
    
  5. 清理系统提示的冗余无用依赖包
    sudo apt autoremove -y
    

内容的提问来源于stack exchange,提问作者Zecyel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.01 03:42:31