摆脱“以下软件包将被降级”

Loc*_*ith 19 debian apt repository xscreensaver pop-os

我首先要说明的是,我很确定这是我自己设计的独特混乱,但我希望有人遇到过这种情况并且可能能够提供帮助。

设置

我的笔记本电脑运行 Pop!_OS 22.04(基于 Ubuntu Jammy)。我真的很喜欢xscreensaver软件包,但是 Debian/Ubuntu/Pop!_OS 发行版存储库包含过时的版本,并且只有 sid (又名不稳定)包含更新的软件包*

不用担心,这就是固定存在的原因,所以这就是我的设置方式:

/etc/apt/preferences.d/unstable-200文件:

Package: *
Pin: release a=unstable
Pin-Priority: 200
Run Code Online (Sandbox Code Playgroud)

/etc/apt/preferences.d/xscreensaver-2000文件:

Package: xscreensaver*
Pin: release a=unstable
Pin-Priority: 2000
Run Code Online (Sandbox Code Playgroud)

/etc/apt/sources.list.d/debian.sid.list文件:

deb [arch=amd64] http://http.us.debian.org/debian sid main contrib non-free
Run Code Online (Sandbox Code Playgroud)

这实际上是有效的,此时运行sudo apt install xscreensaver会安装更新的版本。然而,有一个奇怪的副作用。

问题

当我sudo apt update接着运行时sudo apt upgrade,我得到以下输出:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be DOWNGRADED:
  alsa-topology-conf appmenu-gtk-module-common aspell-en ca-certificates
  chrome-gnome-shell dictionaries-common dns-root-data emacsen-common folks-common
  fonts-arphic-ukai fonts-noto-cjk fonts-noto-cjk-extra fonts-noto-color-emoji
  fonts-urw-base35 friendly-recovery gir1.2-flatpak-1.0 gir1.2-gdkpixbuf-2.0
  gir1.2-graphene-1.0 gir1.2-gtksource-4 gir1.2-polkit-1.0 gir1.2-secret-1
  gir1.2-soup-2.4 gsfonts gsfonts-x11 hunspell-ar hunspell-de-at-frami
  hunspell-de-ch-frami hunspell-de-de-frami hunspell-en-au hunspell-en-ca hunspell-en-gb
  hunspell-en-us hunspell-en-za hunspell-es hunspell-fr hunspell-fr-classical hunspell-it
  hunspell-pt-br hunspell-pt-pt hunspell-ru hyphen-de hyphen-en-gb hyphen-es hyphen-fr
  hyphen-it hyphen-pt-br hyphen-pt-pt ieee-data javascript-common klibc-utils
  laptop-detect liba52-0.7.4 libappmenu-gtk2-parser0 libbytesize-common libffi8
  libflatpak-dev libgl1 libgles2 libgutenprint-common libgweather-4-0 libio-stringy-perl
  libjs-jquery libldacbt-abr2 libmpcdec6 libmysofa1 libopengl0 libpolkit-gobject-1-0
  libsndio7.0 libsoup-gnome2.4-1 libtermkey1 libvterm0 libwacom-common libxkbcommon0
  mythes-ar mythes-de mythes-de-ch mythes-en-au mythes-en-us mythes-es mythes-fr
  mythes-it mythes-pt-pt mythes-ru neovim-runtime netbase pass policykit-1 poppler-data
  powermgmt-base printer-driver-all python3-certifi python3-fido2 python3-jinja2
  python3-launchpadlib python3-lazr.uri python3-macaroonbakery python3-more-itertools
  python3-pkg-resources python3-pyatspi python3-rfc3339 python3-setuptools python3-tz
  python3-wheel python3-ykman sensible-utils sgml-base sgml-data sound-icons ssl-cert
  tpm-udev ucf update-inetd va-driver-all wamerican wbrazilian wbritish wfrench witalian
  wngerman wogerman wspanish wswiss xfonts-base xml-core yubikey-manager
0 upgraded, 0 newly installed, 125 downgraded, 0 to remove and 0 not upgraded.
Need to get 257 MB/283 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Run Code Online (Sandbox Code Playgroud)

这也会导致 Pop!_OS Shop 的更新计数消失,这些软件包显示为待处理的操作系统更新。

故障排除

我在尝试解决此问题时收集的一些数据。

删除/etc/apt/sources.list.d/debian.sid.list并运行sudo apt update可以解决问题,所以我知道这只是某个地方的计算错误/有缺陷的逻辑。

重点关注列表中的第一个包alsa-topology-conf

尽管我知道这个错误完全是肤浅的,但起初我认为apt以某种方式跟踪了该包的来源(哪个存储库),所以我删除、清理了该包,然后重新安装了该包。没有什么区别。

sudo apt remove alsa-topology-conf
sudo apt clean
sudo apt update
sudo apt install alsa-topology-conf
Run Code Online (Sandbox Code Playgroud)

运行apt policy alsa-topology-conf,结果为:

alsa-topology-conf:
  Installed: 1.2.5.1-2
  Candidate: 1.2.5.1-2
  Version table:
 *** 1.2.5.1-2 200
        200 http://http.us.debian.org/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status
     1.2.5.1-2 501
        501 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        501 http://us.archive.ubuntu.com/ubuntu jammy/main i386 Packages
Run Code Online (Sandbox Code Playgroud)

看起来 和sid都有jammy完全相同的版本,并且出于某种原因,apt将包与200优先级而不是501优先级条目相匹配。

删除后/etc/apt/sources.list.d/debian.sid.list,输出如下所示:

alsa-topology-conf:
  Installed: 1.2.5.1-2
  Candidate: 1.2.5.1-2
  Version table:
 *** 1.2.5.1-2 501
        501 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        501 http://us.archive.ubuntu.com/ubuntu jammy/main i386 Packages
        100 /var/lib/dpkg/status
Run Code Online (Sandbox Code Playgroud)

相关问题

以下是类似情况的相关问题,但没有一个答案可以帮助我理解或解决这个问题。

我已经尝试了上述问题中的所有答案,但似乎没有一个是相关的或有效的。

我的问题

有没有人对如何协调这一点有任何建议,以便系统不会不断地认为这些软件包需要降级?

Ste*_*itt 27

基本答案是您\xe2\x80\x99正在做一些您应该\xe2\x80\x99t的事情,即跨版本(和分发)混合存储库。在基于 Ubuntu 的发行版中引入 Debian 软件包是一个坏主意。在更高版本的 Ubuntu 中xscreensaver可用,使用起来危险性较小,但即使\xe2\x80\x99 也是一个坏主意。

\n

鉴于您\xe2\x80\x99 所做的所有调查以及您\xe2\x80\x99 提供的详细信息,\xe2\x80\x99 值得解释您\xe2\x80\x99 在此处看到的行为。为 \xe2\x80\x9cdowngrade\xe2\x80\x9d 提供的所有软件包都具有在 Debian 和 Ubuntu 中以相同版本提供的共享属性;然而,他们不是相同的软件包,因为从 Debian 导入的所有软件包都是在 Ubuntu 中重建的。

\n

apt这里发挥作用的第一个功能是引脚优先级仅选择版本。对于存储库中不同版本的任何可用软件包,引脚优先级将区分它们。对于存储库中同一版本中可用的任何软件包,它们将\xe2\x80\x99t。然后应用下一个功能:当多个存储库提供相同版本时,列出的第一个版本获胜。这与 的另一个功能相结合apt,即如果哈希值不匹配,则使用给定哈希安装的软件包将被具有相同版本的存储库软件包替换(那里有关于 xe2x80x99 的问答)就在这里的某个地方,但我现在不能\xe2\x80\x99找到它)。

\n

这一切的结果是,对于 Pop!_OS(底层的 Ubuntu)提供的所有软件包,其在 Jammy 中的版本与 Debian stable 中的当前版本完全匹配,apt将考虑将其替换为 Debian 版本。I\xe2\x80\x99m 不确定为什么它将它们标识为降级。

\n

如果您要继续执行此操作,则\xe2\x80\x99d 将许多 Pop!_OS 软件包替换为 Debian \xe2\x80\x9cequivalents\xe2\x80\x9d;\xe2\x80\x99s 很有可能确实有效,但 \xe2\x80\x99s 所使用的库中的细微差异也有可能导致问题。你\xe2\x80\x99d最终得到了一个完全未经测试的设置。

\n

要撤消此操作,您应该删除sid.list、更新存储库,并显式重新安装您 \xe2\x80\x9cdowngraded\xe2\x80\x9d 的任何软件包:

\n
sudo apt reinstall alsa-topology-conf\n
Run Code Online (Sandbox Code Playgroud)\n


Loc*_*ith 17

谢谢斯蒂芬·基特

需要明确的是,斯蒂芬·基特的答案是选定的。
然而,作为OP,我添加了具体细节来解决我的特定问题(以防其他人觉得有趣)。

正如斯蒂芬如此慷慨而耐心地指出的那样,记录得很详细,但我却未能正确理解/阅读:

选择要获取的包是一个分为两个阶段的过程:

  1. 优先级决定了要获取哪个版本。
  2. 只有这样才能apt获取列出了该特定版本的第一个存储库。
    • /etc/apt/sources.list首先它在文件中查找
    • 接下来它在 dir 中查找/etc/apt/sources.list.d,按词法顺序对目录中的文件进行排序(基本上是ls默认情况下的操作)

我的问题

我的问题中未指定,Pop!_OS 源文件已在 dir 中列出,/etc/apt/sources.list.d并且它们的名称为:

pop-os-apps.sources
pop-os-release.sources
system.sources
Run Code Online (Sandbox Code Playgroud)

这意味着sid.listordebian.sid.list当与上面的列表一起排序时,仍然会显示在Ubuntu 的 Jammy存储库指定的位置之前 system.sources

解决问题 - 答案

为了解决我在问题中描述的特定场景,我的解决方案是重命名sid.list,以确保始终最后选择zzz.sid.list其中的包。sid

apt policy alsa-topology-conf修复后的样子如下:

1.2.5.1-2   Candidate: 1.2.5.1-2   Version table:  *** 1.2.5.1-2 501
        501 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
        501 http://us.archive.ubuntu.com/ubuntu jammy/main i386 Packages
        100 /var/lib/dpkg/status
     1.2.5.1-2 200
        200 http://http.us.debian.org/debian sid/main amd64 Packages
        200 http://http.us.debian.org/debian sid/main i386 Packages
Run Code Online (Sandbox Code Playgroud)

正确答案

如果可能的话,不需要这样做,特别是对于最新版本的 Pop!_OS,底层 Ubuntu 版本终于升级了 xscreensaver软件包并且它们实际上与sid.

长话短说,我认为(根据过去的经验)我需要破解系统,而在这种特殊情况下,我不需要,解决方案就是不要尝试。

但话又说回来,当我打破东西时,我学得最好,这是一个很棒的教训,我感谢那些花时间阅读和回复的人。


归档时间:

查看次数:

2676 次

最近记录:

3 年,10 月 前