我意外安装了 gjs 的分阶段更新。如何恢复?

我意外安装了 gjs 的分阶段更新。如何恢复?
~ ❯ apt-cache policy gjs                                                      
gjs:
  Installed: 1.72.4-0ubuntu0.22.04.1
  Candidate: 1.72.4-0ubuntu0.22.04.1
  Version table:
 *** 1.72.4-0ubuntu0.22.04.1 500 (phased 0%)
        500 http://nl.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1.72.0-1 500
        500 http://nl.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

当我尝试安装 1.72.0-1 版本时,它想要这个,这听起来不太好:

~ ❯ sudo apt install libgjs0g=1.72.0-1                                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop
  ubuntu-desktop-minimal
The following packages will be DOWNGRADED:
  libgjs0g

我知道我很愚蠢,在强制升级软件包之前没有读得足够好,但我希望有人仍然可以帮助我解决这个问题。

编辑:

~ ❯ sudo apt remove gjs && sudo apt install gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  gjs gnome-characters gnome-shell-extension-desktop-icons-ng
  ubuntu-desktop ubuntu-desktop-minimal
0 upgraded, 0 newly installed, 5 to remove and 37 not upgraded.
After this operation, 1.487 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 596932 files and directories currently installed.)
Removing ubuntu-desktop (1.481.1) ...
Removing ubuntu-desktop-minimal (1.481.1) ...
Removing gnome-shell-extension-desktop-icons-ng (43-2ubuntu1) ...
Removing gnome-characters (41.0-4) ...
Removing gjs (1.72.4-0ubuntu0.22.04.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...
Processing triggers for libglib2.0-0:amd64 (2.72.4-0ubuntu2.2) ...
Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 gjs : Depends: libgjs0g (= 1.72.2-0ubuntu2) but 1.72.4-0ubuntu0.22.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

~ ❯ apt-cache policy libgjs0g                                          17s
libgjs0g:
  Installed: 1.72.4-0ubuntu0.22.04.1
  Candidate: 1.72.4-0ubuntu0.22.04.1
  Version table:
 *** 1.72.4-0ubuntu0.22.04.1 100
        100 /var/lib/dpkg/status
     1.72.2-0ubuntu2 500
        500 http://nl.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
     1.72.0-1 500
        500 http://nl.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

另外我不再有 ubuntu-desktop,但是一切仍然正常吗?

~ ❯ apt-cache policy ubuntu-desktop
ubuntu-desktop:
  Installed: (none)
  Candidate: 1.481.1
  Version table:
     1.481.1 500
        500 http://nl.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
     1.481 500
        500 http://nl.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

我想我需要这么做吗?

~ ❯ apt install --simulate libgjs0g=1.72.2-0ubuntu2 gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  gjs gnome-characters gnome-shell-extension-desktop-icons-ng
  ubuntu-desktop ubuntu-desktop-minimal
The following packages will be DOWNGRADED:
  libgjs0g
0 upgraded, 5 newly installed, 1 downgraded, 0 to remove and 37 not upgraded.
Inst libgjs0g [1.72.4-0ubuntu0.22.04.1] (1.72.2-0ubuntu2 Ubuntu:22.04/jammy-updates [amd64])
Inst gjs (1.72.2-0ubuntu2 Ubuntu:22.04/jammy-updates [amd64])
Inst gnome-characters (41.0-4 Ubuntu:22.04/jammy [amd64])
Inst gnome-shell-extension-desktop-icons-ng (43-2ubuntu1 Ubuntu:22.04/jammy-updates [all])
Inst ubuntu-desktop-minimal (1.481.1 Ubuntu:22.04/jammy-updates [amd64])
Inst ubuntu-desktop (1.481.1 Ubuntu:22.04/jammy-updates [amd64])
Conf libgjs0g (1.72.2-0ubuntu2 Ubuntu:22.04/jammy-updates [amd64])
Conf gjs (1.72.2-0ubuntu2 Ubuntu:22.04/jammy-updates [amd64])
Conf gnome-characters (41.0-4 Ubuntu:22.04/jammy [amd64])
Conf gnome-shell-extension-desktop-icons-ng (43-2ubuntu1 Ubuntu:22.04/jammy-updates [all])
Conf ubuntu-desktop-minimal (1.481.1 Ubuntu:22.04/jammy-updates [amd64])
Conf ubuntu-desktop (1.481.1 Ubuntu:22.04/jammy-updates [amd64])

答案1

gjs 软件包已从我的分阶段更新保留的软件包列表中删除。它是在运行后更新的sudo apt update && sudo apt upgrade,并且终端中还出现了以下消息,表明软件包已被保留。

The following packages have been kept back:
  language-pack-en language-pack-en-base language-pack-gnome-en
  language-pack-gnome-en-base libegl-mesa0 libegl1-mesa-dev libgbm1 
  libgl1-mesa-dev libgl1-mesa-dri libglapi-mesa libglx-mesa0 libxatracker2  
  mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers python-apt-common   
  python3-apt python3-distupgrade qemu-block-extra qemu-system-common   
  qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils  
  ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk unzip

这些是结果apt-cache policy gjs

gjs:
  Installed: 1.72.2-0ubuntu2
  Candidate: 1.72.2-0ubuntu2
  Version table:
 *** 1.72.2-0ubuntu2 500

如您所见,我的 gjs 版本比您的旧,并且我还有一长串通过分阶段更新保留的软件包。这些保留的软件包包括一些必不可少的软件包,如果更新不正确,可能会损坏您的系统!

如何解决此问题而不损坏您的系统?尝试模拟卸载并重新安装 gjs,但不对系统进行任何更改。无需 root 身份或使用 sudo 即可运行以下命令。

apt remove --simulate gjs && apt install --simulate gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal

模拟命令的结果显示我原来的软件包都还安全安装着,gjs已经是最新版本(1.72.2-0ubuntu2),而且我还在终端输出的第一个代码块中重复了这条消息,表示我仍然有和之前一样被分阶段更新保留下来的未升级的软件包。

由于您的 gjs 版本号比我的高,因此您应该仔细阅读模拟命令的结果,以确保将 gjs 版本从 1.72.4 降级到 1.72.2 不会破坏任何内容。您保留的软件包可能与我的不同。

在您的系统上模拟的结果apt remove --simulate gjs && apt install --simulate gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal表明ubuntu-desktop is already the newest version (1.481.1)。可以安全地运行此命令并将您的包管理恢复正常。

然后运行sudo apt install libgjs0g=1.72.2-0ubuntu2 gjs gnome-characters gnome-shell-extension-desktop-icons-ng ubuntu-desktop ubuntu-desktop-minimal重新安装 ubuntu-desktop 包。

从这次经历中可以吸取的教训是让 apt 决定何时升级分阶段更新所阻止的软件包。否则,手动升级分阶段更新所阻止的软件包可能会损坏您的系统。

相关内容