防止 Firefox 在 Ubuntu 22.04 中降级

防止 Firefox 在 Ubuntu 22.04 中降级

当我全新安装 22.04 后看到 Firefox 在我最先进的装备——Intel Core i9 12900K / G.Skill 64 GB DDR5 5600 Mhz / Samsung 980 PRO M.2 PCI4 / Nvidia RTX 3080——上花费 10 秒钟进行冷启动时,我惊呆了。

所以我按照很多人的建议做了 - 卸载 snap firefox,彻底消灭 snap 并使用 mozillateam ppa 安装它:

sudo add-apt-repository ppa:mozillateam/ppa
sudo apt install -t 'o=LP-PPA-mozillateam' firefox

一切顺利,Firefox 99 已安装。

但现在我遇到了一个问题。apt 中仍然隐藏着一个旧版本 98:

$ sudo apt list --upgradable -a
Listing... Done
firefox/jammy 1:98.0.2+build1-1~xtradeb3 amd64 [upgradable from: 99.0.1+build1-0ubuntu0.22.04.1~mt1]
firefox/jammy 1:1snap1-0ubuntu2 amd64
firefox/jammy,now 99.0.1+build1-0ubuntu0.22.04.1~mt1 amd64 [installed,upgradable to: 1:98.0.2+build1-1~xtradeb3]

我一这么做

$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  firefox
1 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Need to get 62.8 MB of archives.
After this operation, 555 kB disk space will be freed.
Do you want to continue? [Y/n] 

这实际上将当前版本 99 降级为版本 98。然后 Firefox 拒绝启动并要求创建新的配置文件,因为版本已降级。WTF?如何防止 Firefox 从安装它的 mozillateam 存储库以外的任何地方“升级”?

编辑:

$ sudo apt cache policy firefox
E: Invalid operation cache

编辑2:

$ apt policy firefox
firefox:
  Installed: 99.0.1+build1-0ubuntu0.22.04.1~mt1
  Candidate: 1:98.0.2+build1-1~xtradeb3
  Version table:
     1:98.0.2+build1-1~xtradeb3 500
        500 https://ppa.launchpadcontent.net/xtradeb/apps/ubuntu jammy/main amd64 Packages
     1:1snap1-0ubuntu2 500
        500 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
 *** 99.0.1+build1-0ubuntu0.22.04.1~mt1 500
        500 https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

EDIT3:我认为已经修复

感谢@Henning Kockerbeck 的建议,我意识到添加 ppa 优先级是解决办法。

sudo vim /etc/apt/preferences.d/mozillateamppa

文件内容:

Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501

答案1

为了使 mozillateam 的 PPA 优先于 Ubuntu 软件源,请添加一条规则:

cat <<EOF | sudo tee /etc/apt/preferences.d/mozillateam.pref
# To prevent repository packages from triggering the installation of Ubuntus snap
# version of firefox, this file prioritizes the packages of mozillateam

Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
EOF

现在,sudo apt install firefox将从 mozillateam PPA 安装包。

相关内容