sudo apt update 命中:1 http://mirrors.aliyun.com/ubu...

생성일: 2025년 11월 25일

답변에 사용된 모델 GPT-5.1 Thinking by Chat01

질문

sudo apt update
命中:1 http://mirrors.aliyun.com/ubuntu focal InRelease
命中:2 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
获取:3 https://mirrors.aliyun.com/docker-ce/linux/ubuntu focal InRelease [57.7 kB]
命中:4 http://mirrors.aliyun.com/ubuntu focal-backports InRelease
命中:5 http://mirrors.aliyun.com/ubuntu focal-security InRelease
命中:6 https://dl.google.com/linux/chrome/deb stable InRelease
命中:7 https://packages.microsoft.com/repos/code stable InRelease
获取:8 https://nvidia.github.io/libnvidia-container/stable/ubuntu18.04/amd64 InRelease [1,484 B]
获取:9 https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu18.04/amd64 InRelease [1,481 B]
命中:10 https://apt.releases.hashicorp.com focal InRelease
获取:11 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64 InRelease [1,474 B]
已下载 62.1 kB,耗时 2秒 (34.3 kB/s)
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
有 435 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。
(zh_workflow_310) zzz@zzz-System-Product-Name:/etc/apt/sources.list.d$ sudo apt install --allow-downgrades \

libqt5core5a=5.12.8+dfsg-0ubuntu2.1
libqt5dbus5=5.12.8+dfsg-0ubuntu2.1
libqt5gui5=5.12.8+dfsg-0ubuntu2.1
libqt5network5=5.12.8+dfsg-0ubuntu2.1
libqt5widgets5=5.12.8+dfsg-0ubuntu2.1
libqt5qml5=5.12.8-0ubuntu1
libqt5quick5=5.12.8-0ubuntu1
libqt5qmlmodels5=5.12.8-0ubuntu1
libqt5svg5=5.12.8-0ubuntu1
libqt5waylandclient5=5.12.8-0ubuntu1
libqt5waylandcompositor5=5.12.8-0ubuntu1
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 未找到“libqt5qmlmodels5”的“5.12.8-0ubuntu1”版本
(zh_workflow_310) zzz@zzz-System-Product-Name:/etc/apt/sources.list.d$ apt-cache policy libqt5core5a
libqt5core5a:
已安装:5.15.8+dfsg-3
候选: 5.12.8+dfsg-0ubuntu2.1
版本列表:
*** 5.15.8+dfsg-3 100
100 /var/lib/dpkg/status
5.12.8+dfsg-0ubuntu2.1 1001
500 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages
500 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 Packages
5.12.8+dfsg-0ubuntu1 1001
500 http://mirrors.aliyun.com/ubuntu focal/universe amd64 Packages

사고

Clarifying apt package versions

The user likely wants the version 5.12.8+dfsg-0ubuntu2.1, which matches the candidate, not the installed version 5.15.8+dfsg-3. This upgrade seems fine, but apt-cache policy shows the installed version as 5.15.8+dfsg-3, which might have come from a PPA. So, updating to the desired version should work.

Analyzing apt error and repo configuration

It seems like they want to downgrade to a specific version (5.12.8-0ubuntu1) of the Qt libraries, but apt can’t find it. This could be due to using a configuration that has pinned some repositories (e.g., for Nvidia), causing apt to miss the correct Qt version. The error indicates that version 5.12.8-0ubuntu1 isn’t available in the current repos.

Suggesting alternatives to downgrade manually

Instead of manually downgrading multiple Qt libraries, it might be easier to remove the conflicting PPA providing Qt 5.15. They can then install the correct version from the focal-updates pocket using the apt install command. This avoids unnecessary complexities and resolves dependencies automatically.

Thought for 1m 28s

답변

你这个报错其实很简单:你指定的版本号在当前源里根本不存在,所以 apt 只能说 “未找到版本”。


1. 现在问题具体出在谁身上?

命令里这几行里:

bash
libqt5qml5=5.12.8-0ubuntu1 \ libqt5quick5=5.12.8-0ubuntu1 \ libqt5qmlmodels5=5.12.8-0ubuntu1 \ ...

报错的是:

bash
E: 未找到“libqt5qmlmodels5”的“5.12.8-0ubuntu1”版本

意思是:在你当前配置的所有源里,没有名为 5.12.8-0ubuntu1libqt5qmlmodels5 这个版本。版本号可能是:

  • +dfsg:比如 5.12.8+dfsg-0ubuntu1 / 0ubuntu2.1
  • 或者是 5.12.8-0ubuntu2.1 之类,而不是 0ubuntu1
  • 甚至整个 5.12.8 版本都已经被更新成别的号了

你给 libqt5core5a 查过 policy,可以看到真实存在的版本;但 libqt5qmlmodels5 你还没查


2. 先看看 libqt5qmlmodels5 真实有哪些版本

在你机器上执行:

bash
apt-cache policy libqt5qmlmodels5

或者更详细一点:

bash
apt-cache madison libqt5qmlmodels5

你会看到类似这样的输出(下面只是举例):

text
libqt5qmlmodels5: 已安装:5.15.8-xxxx 候选: 5.12.8-0ubuntu2.1 版本列表: 5.12.8-0ubuntu2.1 500 500 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages 5.12.8-0ubuntu1 500 500 http://mirrors.aliyun.com/ubuntu focal/universe amd64 Packages

你要照抄这里出现的完整版本号,包括 +dfsg-0ubuntu2.1 之类的后缀。


3. 按实际版本号改你的安装命令

假设 apt-cache policy libqt5qmlmodels5 给出的老版本是:

text
5.12.8-0ubuntu2.1

那你的命令就应该写成:

bash
sudo apt install --allow-downgrades \ libqt5core5a=5.12.8+dfsg-0ubuntu2.1 \ libqt5dbus5=5.12.8+dfsg-0ubuntu2.1 \ libqt5gui5=5.12.8+dfsg-0ubuntu2.1 \ libqt5network5=5.12.8+dfsg-0ubuntu2.1 \ libqt5widgets5=5.12.8+dfsg-0ubuntu2.1 \ libqt5qml5=5.12.8-0ubuntu2.1 \ libqt5quick5=5.12.8-0ubuntu2.1 \ libqt5qmlmodels5=5.12.8-0ubuntu2.1 \ libqt5svg5=5.12.8-0ubuntu2.1 \ libqt5waylandclient5=5.12.8-0ubuntu2.1 \ libqt5waylandcompositor5=5.12.8-0ubuntu2.1

关键点: 每个包后面的 = 后面,必须是 apt-cache policy 真正显示出来的完整版本号,不能自己“猜”后缀。

如果 libqt5qmlmodels5 的版本是带 +dfsg 的,比如:

text
5.12.8+dfsg-0ubuntu2.1

那就写:

bash
libqt5qmlmodels5=5.12.8+dfsg-0ubuntu2.1

4. 一个更省事的做法(让 apt 自动选老版本)

如果你只是想从 5.15.x 降回系统自带的 5.12.x,而不执着于具体的 0ubuntu1 / 0ubuntu2.1,可以让 apt 自己选版本,不手写 =

bash
sudo apt install --allow-downgrades \ libqt5core5a/focal-updates \ libqt5dbus5/focal-updates \ libqt5gui5/focal-updates \ libqt5network5/focal-updates \ libqt5widgets5/focal-updates \ libqt5qml5/focal-updates \ libqt5quick5/focal-updates \ libqt5qmlmodels5/focal-updates \ libqt5svg5/focal-updates \ libqt5waylandclient5/focal-updates \ libqt5waylandcompositor5/focal-updates

/focal-updates 的意思是:用 focal-updates 仓库里的那个版本(一般就是 5.12.8 带安全更新的那一版)。


5. 一点点风险提示

你现在是用 系统级 Qt 库在做降级,有几点要注意:

  • Qt 是很多桌面程序和 KDE 组件的依赖,降级可能会导致:
    • 一堆包一起被降级/升级
    • 有些 GUI 程序崩溃或起不来
  • 如果只是某个软件/项目需要特定 Qt 版本,更推荐:
    • 用 Docker / LXC 容器装一套旧 Qt 环境
    • 或者用 conda / venv + PyQt5==5.xPySide2==5.x 这种方式,在用户空间解决

如果你愿意,可以把 apt-cache policy libqt5qmlmodels5 的输出贴出来,我可以直接帮你拼好一条完整可执行的 apt install 命令。

질문

apt-cache policy libqt5qmlmodels5
libqt5qmlmodels5:
已安装:5.15.8+dfsg-3
候选: 5.15.8+dfsg-3
版本列表:
*** 5.15.8+dfsg-3 100
100 /var/lib/dpkg/status

사고

Explaining Qt version limitations on Focal

On Focal, the libqt5qmlmodels5 package isn't available for 5.12. Apt can't find it because it wasn't included in this LTS release. So:

  • Either keep 5.15 libs for everything, or
  • Remove 5.15 packages and reinstall compatible 5.12 versions, but this may break the reason for using libqt5qmlmodels5 in the first place.

The user might be asking a broader question, so it's best to focus on the actual issue.

Explaining apt-cache policy and Qt version limitations

For libqt5qmlmodels5, the apt-cache policy output shows that the version you have installed (5.15.8+dfsg-3) is the only available version. Apt can’t find any other versions, including 5.12.*. On Ubuntu 20.04 (Focal), this package isn’t part of the official repos — it's only available on later releases like Ubuntu 22.04 or derivatives. Using this on top of Qt 5.12 may lead to compatibility issues, so it's not recommended.

Exploring solutions for Qt version conflict

Solution A: Keep Qt 5.15 without downgrading. You can remove version pins for 5.12.8-... in your apt command or align all Qt libraries to a consistent 5.15 version. However, you must ensure the repository supplying Qt 5.15 (possibly from Debian) is present, but mixing Debian and Ubuntu can be risky.

Solution B: Revert to the official 5.12 version for a more stable OS setup. This involves removing non-focal Qt packages and reinstalling the official version with sudo apt install --reinstall for relevant packages. It’s safer to follow steps carefully, keeping possible system impacts in mind.

Thought for 2m 54s

답변

看你这段输出,其实已经把答案说完了 😂:

bash
libqt5qmlmodels5: 已安装:5.15.8+dfsg-3 候选: 5.15.8+dfsg-3 版本列表: *** 5.15.8+dfsg-3 100 100 /var/lib/dpkg/status

意思是:

  • 你现在装着的 libqt5qmlmodels5 版本是 5.15.8+dfsg-3
  • “候选版本”也是 5.15.8+dfsg-3
  • 更关键:没有任何来自 Ubuntu 源里的其它版本(下面没有列出 5.12.x 之类)

所以:

bash
sudo apt install libqt5qmlmodels5=5.12.8-0ubuntu1

这个版本在你当前所有 APT 源里 根本不存在,apt 只能报:

E: 未找到“libqt5qmlmodels5”的“5.12.8-0ubuntu1”版本


为什么会这样?

  1. 你是 Ubuntu 20.04(focal)
    • focal 官方 Qt5 是 5.12.8 LTS,确实有 libqt5core5a 这些 5.12 包。(Launchpad)
  2. focal 官方仓库根本没有 libqt5qmlmodels5 这个包,这个库是后来在新版本 Ubuntu(比如 22.04 jammy)里才单独拆出来的。(Ask Ubuntu)
  3. 你现在的 libqt5qmlmodels5=5.15.8+dfsg-3 很大概率是:
    • 别的发行版(Debian / jammy / 其它 PPA) 手动装进来的 .deb,或者
    • 曾经加过某个非官方源,后来又删掉了,所以 apt 现在只知道“本地有 5.15.8+dfsg-3 这个版本”,但仓库里没有任何版本可用。

总结一下:

你想降级到的 5.12.8-0ubuntu1 这个版本,在 focal 的仓库里 从来就没出现过,所以 apt 不可能帮你降。


接下来怎么做比较现实?

取决于你的目标是啥:


情况 A:你只是想把 Qt 全部降回 5.12(保持系统干净)

那你应该:

  1. 把这个“外来户”删掉(因为 focal 没有对应 5.12 版本):

    建议先用模拟看看会删掉什么:

    bash
    sudo apt remove --simulate libqt5qmlmodels5

    如果输出看起来能接受,再真正执行:

    bash
    sudo apt remove libqt5qmlmodels5

    可能还会顺带删掉依赖它的一些包(比如某些 qml-module 开头的包),这是正常的。

  2. 其它 Qt 库用 “按仓库降级” 的方式,而不是手写版本号,例如:

    bash
    sudo apt install --allow-downgrades \ libqt5core5a/focal-updates \ libqt5dbus5/focal-updates \ libqt5gui5/focal-updates \ libqt5network5/focal-updates \ libqt5widgets5/focal-updates \ libqt5qml5/focal-updates \ libqt5quick5/focal-updates \ libqt5svg5/focal-updates \ libqt5waylandclient5/focal-updates \ libqt5waylandcompositor5/focal-updates

    xxx/focal-updates 的意思是:强制用 focal-updates 仓库中该包的版本(也就是 5.12.8 那批官方版本),不用你自己记具体 5.12.8+dfsg-0ubuntu2.1 之类的尾巴。

不要再在命令里写 libqt5qmlmodels5=5.12... 了,因为 focal 就没有那玩意儿。


情况 B:你其实需要的是 Qt 5.15 系列

如果你是因为某个项目/软件需要 Qt 5.15 才搞来的 5.15.8+dfsg-3,那正确做法反而是:

  • 统一所有 Qt 相关包都用同一“来源”的 5.15 版本(比如直接用更新的发行版 / 容器 / chroot),
  • 而不是在 5.12 的系统上硬掺一堆 5.15 的库,又想把一部分降回 5.12。

AskUbuntu 上也有人专门提醒:把别的发行版中的 libqt5qmlmodels5 硬塞进 focal 会导致依赖要升级到 libqt5core5a>=5.14,而 focal 只有 5.12,这种混搭很容易把系统搞乱。(Ask Ubuntu)

这种需求,更推荐用:

  • Docker / LXC 容器
  • 或者直接升级到 22.04 之类的系统,在那里用官方 Qt 5.15

简短结论

  • apt-cache policy 已经告诉你:没有 5.12 版本可降,只有本地装着的 5.15.8+dfsg-3。
  • 你现在跟着的那条安装命令,对 Ubuntu 20.04 来说是“幻想中的版本号”,apt 找不到是正常的。
  • 如果你的目标是“回到系统自带 Qt 5.12”,就:
    • 先卸载 libqt5qmlmodels5
    • 再用 /focal-updates 的方式把其它 Qt 包统一降回官方 5.12。

如果你愿意把你最初要解决的“实际问题”(比如编译哪个项目、哪个程序运行报错)贴出来,我可以帮你看看是不是有更轻量、安全的方案,而不是在系统层面硬折腾 Qt。

질문

sudo apt remove libqt5qmlmodels5
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
libqt5qml5 libqt5waylandclient5
使用'sudo apt autoremove'来卸载它(它们)。
下列软件包将被【卸载】:
libqt5qmlmodels5 libqt5quick5 libqt5waylandcompositor5 qtwayland5
升级了 0 个软件包,新安装了 0 个软件包,要卸载 4 个软件包,有 443 个软件包未被升级。
解压缩后将会空出 10.2 MB 的空间。
您希望继续执行吗? [Y/n] y
(正在读取数据库 ... 系统当前共安装有 329923 个文件和目录。)
正在卸载 qtwayland5:amd64 (5.15.8-2) ...
正在卸载 libqt5waylandcompositor5:amd64 (5.15.8-2) ...
正在卸载 libqt5quick5:amd64 (5.15.8+dfsg-3) ...
正在卸载 libqt5qmlmodels5:amd64 (5.15.8+dfsg-3) ...
正在处理用于 libc-bin (2.36-6) 的触发器 ...
(zh_workflow_310) zzz@zzz-System-Product-Name:/etc/apt/sources.list.d$ sudo apt install --allow-downgrades \

libqt5core5a/focal-updates
libqt5dbus5/focal-updates
libqt5gui5/focal-updates
libqt5network5/focal-updates
libqt5widgets5/focal-updates
libqt5qml5/focal-updates
libqt5quick5/focal-updates
libqt5svg5/focal-updates
libqt5waylandclient5/focal-updates
libqt5waylandcompositor5/focal-updates
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
E: 未找到“libqt5qml5”的“focal-updates”发布版本
E: 未找到“libqt5quick5”的“focal-updates”发布版本
E: 未找到“libqt5svg5”的“focal-updates”发布版本
E: 未找到“libqt5waylandclient5”的“focal-updates”发布版本
E: 未找到“libqt5waylandcompositor5”的“focal-updates”发布版本

사고

Summarizing package versions for installation

The canonical version for these packages is 5.12.8-0ubuntu1. So, for packages like libqt5qml5, libqt5quick5, and others, we’ll assign this version. For base libraries like libqt5core5a, libqt5dbus5, and libqt5gui5, we’ll go with 5.12.8+dfsg-0ubuntu2.1, as shown in apt-cache and Launchpad. This ensures we’re using the right versions.

Proposing package installation with specific versions

We should opt for version 5.12.8+dfsg-0ubuntu2.1 for all the base libraries, since Launchpad confirms these versions as security updates. I suggest we use this command to install:

text
sudo apt install --allow-downgrades \ libqt5core5a=5.12.8+dfsg-0ubuntu2.1 \ libqt5dbus5=5.12.8+dfsg-0ubuntu2.1 \ libqt5gui5=5.12.8+dfsg-0ubuntu2.1 \ libqt5network5=5.12.8+dfsg-0ubuntu2.1 \ libqt5widgets5=5.12.8+dfsg-0ubuntu2.1 \ libqt5qml5=5.12.8-0ubuntu1 \ libqt5quick5=5.12.8-0ubuntu1 \ libqt5svg5=5.12.8-0ubuntu1 \ libqt5waylandclient5=5.12.8-0ubuntu1 \ libqt5waylandcompositor5=5.12.8-0ubuntu1 \ qtwayland5=5.12.8-0ubuntu1

We’re also adding qtwayland5 in case it’s needed. Just ensure that version 5.12.8 is available in the currently configured repos.

Addressing potential apt issues and mismatched sources

If their system uses mismatched apt sources

Thought for 2m 55s

답변

问题很清楚了:
/focal-updates 这种写法只能用在这个包真的在 focal-updates 仓库里有版本的时候。

像这些包:

  • libqt5qml5
  • libqt5quick5
  • libqt5svg5
  • libqt5waylandclient5
  • libqt5waylandcompositor5

在 Ubuntu 20.04(focal)里只有一个版本,发布在 focal 主仓库(release pocket),根本没有 focal-updates 这个 pocket 里的版本,所以:

bash
libqt5qml5/focal-updates

会直接报:

E: 未找到“xxx”的“focal-updates”发布版本

可以从 Ubuntu 的包网站看到这一点,比如:
libqt5qml5 最新就是 5.12.8-0ubuntu1,仓库是 focal / universe / base,没有其它 pocket (Launchpad)。
libqt5quick5libqt5svg5 等同理,focal 里都是单一版本 5.12.8-0ubuntu1 (Launchpad)。
Qt Wayland 那几个(libqt5waylandclient5 / libqt5waylandcompositor5 / qtwayland5)也是同一个源包 qtwayland-opensource-src 5.12.8-0ubuntu1 生成的 (Launchpad)。


正确的做法:对不同包,用不同写法

1. 基础 Qt 库(来自 qtbase-opensource-src,有安全更新的)

这些是你之前查过的 libqt5core5a 那一批:

  • libqt5core5a
  • libqt5dbus5
  • libqt5gui5
  • libqt5network5
  • libqt5widgets5

它们都有 5.12.8+dfsg-0ubuntu2.1 这个安全更新版本,在 focal-updates / focal-security 里 (Launchpad)。
这里比较稳的写法是直接写版本号

bash
sudo apt install --allow-downgrades \ libqt5core5a=5.12.8+dfsg-0ubuntu2.1 \ libqt5dbus5=5.12.8+dfsg-0ubuntu2.1 \ libqt5gui5=5.12.8+dfsg-0ubuntu2.1 \ libqt5network5=5.12.8+dfsg-0ubuntu2.1 \ libqt5widgets5=5.12.8+dfsg-0ubuntu2.1

版本号可以用 apt-cache policy 包名 自己再确认一遍,如果你想非常稳。


2. 其它 Qt 模块(只有 release 版本,没有 updates)

这些只有 focal 的 release 版本,没有 focal-updates

  • libqt5qml5 → 5.12.8-0ubuntu1 (Launchpad)
  • libqt5quick5 → 5.12.8-0ubuntu1 (Launchpad)
  • libqt5svg5 → 5.12.8-0ubuntu1 (Ubuntu Updates)
  • libqt5waylandclient5 → 5.12.8-0ubuntu1 (Launchpad)
  • libqt5waylandcompositor5 → 5.12.8-0ubuntu1 (Launchpad)
  • (可选)qtwayland5 → 5.12.8-0ubuntu1 (Launchpad)

这些就不能写 /focal-updates,要么:

  • =版本号,要么
  • /focal(因为它们就只有 release 版本)

我给你一条“全家桶”命令,你可以直接试(注意这是一次性降回 5.12):

bash
sudo apt install --allow-downgrades \ libqt5core5a=5.12.8+dfsg-0ubuntu2.1 \ libqt5dbus5=5.12.8+dfsg-0ubuntu2.1 \ libqt5gui5=5.12.8+dfsg-0ubuntu2.1 \ libqt5network5=5.12.8+dfsg-0ubuntu2.1 \ libqt5widgets5=5.12.8+dfsg-0ubuntu2.1 \ libqt5qml5=5.12.8-0ubuntu1 \ libqt5quick5=5.12.8-0ubuntu1 \ libqt5svg5=5.12.8-0ubuntu1 \ libqt5waylandclient5=5.12.8-0ubuntu1 \ libqt5waylandcompositor5=5.12.8-0ubuntu1 \ qtwayland5=5.12.8-0ubuntu1

如果里面某个包你确实不需要(比如你根本不用 Wayland),可以把对应那几行删掉再执行。


再提醒一下:你这系统已经很「混」了

从这句输出看:

text
正在处理用于 libc-bin (2.36-6) 的触发器 ...
  • Ubuntu 20.04 自带的 glibc 是 2.31,而 2.36-6 是 Ubuntu 23.04 / Debian 12 的区间里才有的版本 (Launchpad)
  • 再加上你之前有 Qt 5.15.8+dfsg-3,这些版本组合基本说明:
    👉 系统以前混用了别的发行版/版本的源(或者手装过 .deb)

给你的诚恳建议是:

  1. 现在先把 Qt 这块按上面的命令「救回来」,能用就行。
  2. 长远看:
    • 要么用 Docker / 容器里搞你需要的特殊 Qt 版本;
    • 要么备份数据,找个时间重装一个干净的系统(比如直接 22.04),避免后面被各种诡异依赖坑。

如果你执行上面那条大命令还有 “找不到版本” 之类的报错,下一步就要看:

bash
apt-cache policy 出问题的那个包

看它的版本列表里到底有没有 5.12.8-0ubuntu1,那时候我们可以再一起分析到底是源没配对,还是优先级之类的问题。

질문

sudo apt install --allow-downgrades \

libqt5core5a=5.12.8+dfsg-0ubuntu2.1
libqt5dbus5=5.12.8+dfsg-0ubuntu2.1
libqt5gui5=5.12.8+dfsg-0ubuntu2.1
libqt5network5=5.12.8+dfsg-0ubuntu2.1
libqt5widgets5=5.12.8+dfsg-0ubuntu2.1
libqt5qml5=5.12.8-0ubuntu1
libqt5quick5=5.12.8-0ubuntu1
libqt5svg5=5.12.8-0ubuntu1
libqt5waylandclient5=5.12.8-0ubuntu1
libqt5waylandcompositor5=5.12.8-0ubuntu1
qtwayland5=5.12.8-0ubuntu1
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包是自动安装的并且现在不需要了:
libmd4c0
使用'sudo apt autoremove'来卸载它(它们)。
建议安装:
qt5-image-formats-plugins qt5-qmltooling-plugins
推荐安装:
qt5-gtk-platformtheme
下列【新】软件包将被安装:
libqt5quick5 libqt5waylandcompositor5 qtwayland5
下列软件包将被【降级】:
libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5qml5 libqt5svg5 libqt5waylandclient5 libqt5widgets5
升级了 0 个软件包,新安装了 3 个软件包,降级了 8 个软件包,要卸载 0 个软件包,有 435 个软件包未被升级。
需要下载 11.8 MB 的归档。
解压缩后会消耗 8,260 kB 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5qml5 amd64 5.12.8-0ubuntu1 [1,438 kB]
获取:2 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5network5 amd64 5.12.8+dfsg-0ubuntu2.1 [673 kB]
获取:3 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5waylandclient5 amd64 5.12.8-0ubuntu1 [270 kB]
获取:4 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5svg5 amd64 5.12.8-0ubuntu1 [131 kB]
获取:5 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5widgets5 amd64 5.12.8+dfsg-0ubuntu2.1 [2,295 kB]
获取:6 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5gui5 amd64 5.12.8+dfsg-0ubuntu2.1 [2,971 kB]
获取:7 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5dbus5 amd64 5.12.8+dfsg-0ubuntu2.1 [208 kB]
获取:8 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 libqt5core5a amd64 5.12.8+dfsg-0ubuntu2.1 [2,006 kB]
获取:9 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5quick5 amd64 5.12.8-0ubuntu1 [1,335 kB]
获取:10 http://mirrors.aliyun.com/ubuntu focal/universe amd64 libqt5waylandcompositor5 amd64 5.12.8-0ubuntu1 [300 kB]
获取:11 http://mirrors.aliyun.com/ubuntu focal/universe amd64 qtwayland5 amd64 5.12.8-0ubuntu1 [166 kB]
已下载 11.8 MB,耗时 1秒 (8,150 kB/s)
dpkg: 警告: 即将把 libqt5qml5:amd64 从 5.15.8+dfsg-3 降级到 5.12.8-0ubuntu1
(正在读取数据库 ... 系统当前共安装有 329872 个文件和目录。)
准备解压 .../00-libqt5qml5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 libqt5qml5:amd64 (5.12.8-0ubuntu1) 并覆盖 (5.15.8+dfsg-3) ...
dpkg: 警告: 即将把 libqt5network5:amd64 从 5.15.8+dfsg-3 降级到 5.12.8+dfsg-0ubuntu2.1
准备解压 .../01-libqt5network5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ...
正在解压 libqt5network5:amd64 (5.12.8+dfsg-0ubuntu2.1) 并覆盖 (5.15.8+dfsg-3) ...
dpkg: 警告: 即将把 libqt5waylandclient5:amd64 从 5.15.8-2 降级到 5.12.8-0ubuntu1
准备解压 .../02-libqt5waylandclient5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 libqt5waylandclient5:amd64 (5.12.8-0ubuntu1) 并覆盖 (5.15.8-2) ...
dpkg: 警告: 即将把 libqt5svg5:amd64 从 5.15.8-2 降级到 5.12.8-0ubuntu1
准备解压 .../03-libqt5svg5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 libqt5svg5:amd64 (5.12.8-0ubuntu1) 并覆盖 (5.15.8-2) ...
dpkg: 警告: 即将把 libqt5widgets5:amd64 从 5.15.8+dfsg-3 降级到 5.12.8+dfsg-0ubuntu2.1
准备解压 .../04-libqt5widgets5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ...
正在解压 libqt5widgets5:amd64 (5.12.8+dfsg-0ubuntu2.1) 并覆盖 (5.15.8+dfsg-3) ...
dpkg: 警告: 即将把 libqt5gui5:amd64 从 5.15.8+dfsg-3 降级到 5.12.8+dfsg-0ubuntu2.1
准备解压 .../05-libqt5gui5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ...
正在解压 libqt5gui5:amd64 (5.12.8+dfsg-0ubuntu2.1) 并覆盖 (5.15.8+dfsg-3) ...
dpkg: 警告: 即将把 libqt5dbus5:amd64 从 5.15.8+dfsg-3 降级到 5.12.8+dfsg-0ubuntu2.1
准备解压 .../06-libqt5dbus5_5.12.8+dfsg-0ubuntu2.1_amd64.deb ...
正在解压 libqt5dbus5:amd64 (5.12.8+dfsg-0ubuntu2.1) 并覆盖 (5.15.8+dfsg-3) ...
dpkg: 警告: 即将把 libqt5core5a:amd64 从 5.15.8+dfsg-3 降级到 5.12.8+dfsg-0ubuntu2.1
准备解压 .../07-libqt5core5a_5.12.8+dfsg-0ubuntu2.1_amd64.deb ...
正在解压 libqt5core5a:amd64 (5.12.8+dfsg-0ubuntu2.1) 并覆盖 (5.15.8+dfsg-3) ...
正在选中未选择的软件包 libqt5quick5:amd64。
准备解压 .../08-libqt5quick5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 libqt5quick5:amd64 (5.12.8-0ubuntu1) ...
正在选中未选择的软件包 libqt5waylandcompositor5:amd64。
准备解压 .../09-libqt5waylandcompositor5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 libqt5waylandcompositor5:amd64 (5.12.8-0ubuntu1) ...
正在选中未选择的软件包 qtwayland5:amd64。
准备解压 .../10-qtwayland5_5.12.8-0ubuntu1_amd64.deb ...
正在解压 qtwayland5:amd64 (5.12.8-0ubuntu1) ...
正在设置 libqt5core5a:amd64 (5.12.8+dfsg-0ubuntu2.1) ...
正在设置 libqt5dbus5:amd64 (5.12.8+dfsg-0ubuntu2.1) ...
正在设置 libqt5network5:amd64 (5.12.8+dfsg-0ubuntu2.1) ...
正在设置 libqt5qml5:amd64 (5.12.8-0ubuntu1) ...
正在设置 libqt5gui5:amd64 (5.12.8+dfsg-0ubuntu2.1) ...
正在设置 libqt5widgets5:amd64 (5.12.8+dfsg-0ubuntu2.1) ...
正在设置 libqt5waylandclient5:amd64 (5.12.8-0ubuntu1) ...
正在设置 libqt5quick5:amd64 (5.12.8-0ubuntu1) ...
正在设置 libqt5svg5:amd64 (5.12.8-0ubuntu1) ...
正在设置 libqt5waylandcompositor5:amd64 (5.12.8-0ubuntu1) ...
正在设置 qtwayland5:amd64 (5.12.8-0ubuntu1) ...
正在处理用于 libc-bin (2.36-6) 的触发器 ...

사고

Guiding next steps after downgrade

Looking at the log, it seems like the downgrade worked well, with Qt 5.12.8 and Wayland installed. The warnings are normal. Now, I’ll suggest checking the versions using apt-cache policy to ensure everything is consistent. Also, running apt -f install and apt autoremove wouldn’t hurt.

Preventing Qt 5.15 upgrade

To prevent Qt from upgrading back to 5.15, you can use apt-mark hold or set apt preferences. It looks like the 5.15 version in /var/lib/dpkg/status isn't coming from the repo but might be pinned by a higher priority. To fix, double-check that the correct pin is set for Qt 5.12 in apt preferences.

Clarifying upgrade behavior after downgrade

It looks like the installed Qt version is 5.12 (not the 5.15 from dpkg status), and apt will keep it unless a newer 5.12 comes up. The upgradeable packages count may drop, but don’t run apt upgrade yet, as it could trigger a Qt upgrade. Running apt -f install is safer.

Navigating the upgrade challenge with glibc

Running apt upgrade could be risky because, even though the Qt candidate is 5.12, there are other packages like glibc that are newer than what’s available in the focal repo (e.g., 2.36 versus 2.31). Apt would try downgrading those packages, which could leave the system in an inconsistent state. It’s tricky.

Thought for 30s

답변

好爽,看日志这波操作已经成功把 Qt 全家桶降回 5.12 了 🎉

从输出里关键几行看:

  • libqt5core5a / libqt5gui5 / libqt5widgets5 / libqt5network5 / libqt5dbus5 都变成了:
    5.12.8+dfsg-0ubuntu2.1

  • libqt5qml5 / libqt5quick5 / libqt5svg5 / libqt5waylandclient5 / libqt5waylandcompositor5 / qtwayland5 都是:
    5.12.8-0ubuntu1

  • 过程中出现的都是类似:

    text
    dpkg: 警告: 即将把 XXX 从 5.15.8... 降级到 5.12.8... ... 正在设置 XXX (5.12.8-0ubuntu1) ...

这些 “警告” 只是提醒你在降级,不是错误,属于预期行为。


1️⃣ 简单自检一下版本(可选但推荐)

你现在可以自己确认一下版本是否统一成 5.12 了:

bash
apt-cache policy libqt5core5a libqt5gui5 libqt5widgets5 libqt5qml5 libqt5quick5

大致应该都是类似:

text
已安装:5.12.8... 候选:5.12.8... 版本列表: 5.12.8...

只要 “已安装” 和 “候选” 都是 5.12.8.xxx,就说明 apt 在以后不会想把它们升级回 5.15(除非你再加什么奇怪的源)。


2️⃣ 要不要给它们“锁个版本”

目前看,你的 Qt 5.15 是从别的仓库/手动 .deb 搞进来的,现在那个源已经不存在,所以 apt 的候选版本就是 5.12.8(Ubuntu 官方的)。理论上不再会自动升到 5.15 了。

如果你还是不放心,可以给这些包加个 hold,让 apt 不去动它们,例如:

bash
sudo apt-mark hold \ libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5widgets5 \ libqt5qml5 libqt5quick5 libqt5svg5 libqt5waylandclient5 libqt5waylandcompositor5 qtwayland5

以后如果你真的想取消锁定,再:

bash
sudo apt-mark unhold \ libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5widgets5 \ libqt5qml5 libqt5quick5 libqt5svg5 libqt5waylandclient5 libqt5waylandcompositor5 qtwayland5

小提示:加 hold 的副作用是:如果将来有软件强制要求更高版本 Qt,apt 会抱怨依赖关系,而不是悄悄给你升级。


3️⃣ 关于 libmd4c0autoremove

输出里还有一行:

text
下列软件包是自动安装的并且现在不需要了: libmd4c0 使用'sudo apt autoremove'来卸载它(它们)。

这是正常提示,你可以顺手清一下:

bash
sudo apt autoremove

不删也没大问题,只是多占一点点空间。


4️⃣ 接下来做什么?

从 apt 的角度来看:

  • Qt 相关的库现在已经全部回到了 Ubuntu 20.04 官方的 5.12.8 系列
  • Wayland 的 Qt 库也成套回到 5.12.8-0ubuntu1
  • 你之前那种“系统是 5.12 + 半套 5.15 混着”的状态已经基本解决

接下来关键就是:
你当初想解决的那个实际问题(编译/运行哪个程序)现在还报不报错。

如果还有报错,直接把报错贴出来(连同你跑的命令),我可以帮你一起顺着现在的这个干净 Qt 环境继续查;
如果已经能跑了,那这一步就算是收工了 😄

질문

sudo dpkg -i ./sogoupinyin_2.4.0.3469_amd64.deb
正在选中未选择的软件包 sogoupinyin。
(正在读取数据库 ... 系统当前共安装有 330152 个文件和目录。)
准备解压 .../sogoupinyin_2.4.0.3469_amd64.deb ...
正在解压 sogoupinyin (2.4.0.3469) ...
dpkg: 依赖关系问题使得 sogoupinyin 的配置工作不能继续:
sogoupinyin 依赖于 fcitx-frontend-qt5;然而:
未安装软件包 fcitx-frontend-qt5。
sogoupinyin 依赖于 fcitx-libs | libfcitx-qt0;然而:
未安装软件包 fcitx-libs。
未安装软件包 libfcitx-qt0。
sogoupinyin 依赖于 libqt5quickwidgets5;然而:
未安装软件包 libqt5quickwidgets5。
sogoupinyin 依赖于 qml-module-qtquick2;然而:
未安装软件包 qml-module-qtquick2。

dpkg: 处理软件包 sogoupinyin (--install)时出错:
依赖关系问题 - 仍未被配置
正在处理用于 gnome-menus (3.36.0-1ubuntu1) 的触发器 ...
正在处理用于 desktop-file-utils (0.24-1ubuntu3) 的触发器 ...
正在处理用于 mime-support (3.64ubuntu1) 的触发器 ...
正在处理用于 hicolor-icon-theme (0.17-2) 的触发器 ...
在处理时有错误发生:
sogoupinyin

사고

Resolving dependency issues with apt-get

The user is facing dependency errors while installing sogoupinyin, caused by missing packages like fcitx-frontend-qt5 and others, likely due to downgrading Qt packages. To fix it, we can run the command apt-get -f install to resolve and install the needed dependencies without needing to browse the web.

Step-by-step dependency resolution

To fix the dependencies for sogoupinyin, we can run sudo apt-get -f install to configure it. While fcitx-frontend-qt5, fcitx-libs, and Qt modules exist in some form, the version of sogoupinyin is quite old and was likely designed for Ubuntu 20.04. I'll make sure to install the appropriate Qt version and modules from the Aliyun mirror.

Fixing sogoupinyin dependencies

To clear the dependencies for sogoupinyin, we should first update apt and install the required packages:

text
sudo apt update sudo apt install -y fcitx fcitx-bin fcitx-table-all fcitx-frontend-qt5 fcitx-libs libfcitx-qt0 libqt5quickwidgets5 qml-module-qtquick2

Afterwards, running sudo apt -f install will resolve any missing dependencies or configuration issues. If that's unsuccessful, we can manually install the package using:

sudo apt install ./sogoupinyin_2.4.0.3469_amd64.deb

Providing guidance for installing sogoupinyin dependencies

We should answer in Chinese, as the user's logs are in Chinese, while also providing English package names in the response. Since dpkg doesn't automatically install dependencies, we can guide them to either manually install the missing packages, run sudo apt -f install, or use sudo apt install ./sogoupinyin.deb. Make sure libqt5quickwidgets5 and qml-module-qtquick2 are on version 5.12.8-0ubuntu1.

Thought for 33s

답변

现在这个报错是典型的 dpkg 装本地 .deb 没有自动拉依赖导致的,问题本身不大 👍

报错里缺的东西已经列得很清楚了:

  • fcitx-frontend-qt5
  • fcitx-libslibfcitx-qt0
  • libqt5quickwidgets5
  • qml-module-qtquick2

你现在做两步就能收尾:


✅ 第一步:让 apt 自动补全依赖

先用 apt 把缺的包装上,同时顺便把 sogoupinyin 配置完成:

bash
sudo apt update # 自动修复依赖并完成 sogoupinyin 的安装 sudo apt -f install

这一步会看到类似提示,要安装上面这些依赖包,直接选 Y 确认就行。

如果非常意外地,apt -f install 说要卸载 sogoupinyin 而不是安装依赖,那就按 n 取消,然后用下面的“手动装依赖”方式。


🛠 备选方案:手动安装依赖再装 sogou

如果你想更“显式”一点,可以直接把依赖装上,然后再重新装 sogou:

bash
sudo apt update sudo apt install \ fcitx fcitx-configtool \ fcitx-frontend-qt5 \ fcitx-libs libfcitx-qt0 \ libqt5quickwidgets5 \ qml-module-qtquick2

依赖都 OK 之后,再安装 sogou(推荐用 apt 而不是 dpkg,这样即使将来有别的依赖也会自动处理):

bash
sudo apt install ./sogoupinyin_2.4.0.3469_amd64.deb # 或者继续用你原来的: # sudo dpkg -i ./sogoupinyin_2.4.0.3469_amd64.deb

👀 可以简单检查一下是否安装成功

装完后看一眼:

bash
dpkg -l | grep sogoupinyin

正常会有一行类似:

text
ii sogoupinyin 2.4.0.3469 amd64 Sogou Pinyin Input Method

🧩 之后要做的(输入法启用)

如果你是第一次用 fcitx + 搜狗拼音,大概还需要:

bash
im-config

在里面选用 fcitx 作为输入法框架,然后重新登录图形界面,再在 fcitx 配置里添加“搜狗拼音”。


你可以先跑一遍:

bash
sudo apt -f install

执行过程有任何奇怪的提示(比如要卸载 sogoupinyin),直接把那段输出贴出来,我帮你一起看看是不是依赖冲突还是源的问题。

이 Q&A 공유하기