无法在 Ubuntu 22.04 LTS 上安装 ubuntu-desktop

无法在 Ubuntu 22.04 LTS 上安装 ubuntu-desktop

抱歉,这个问题是新手问的。我在 Ubuntu 22.04 LTS 中错误地删除了桌面管理器和许多 gnome 软件包。

我尝试过sudo apt install ubuntu-desktop,结果如下:

Reading package lists...
Building dependency tree...
Reading state information...
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:
 gdm3 : Depends: gir1.2-gdm-1.0 (= 42.0-1ubuntu6) but 42.0-1ubuntu7.22.04.3 is to be installed
        Depends: libgdm1 (= 42.0-1ubuntu6) but 42.0-1ubuntu7.22.04.3 is to be installed
 nautilus : Depends: gvfs (>= 1.3.2) but it is not installable
            Depends: libnautilus-extension1a (= 1:42.0-1ubuntu2) but 1:42.6-0ubuntu1 is to be installed
            Depends: nautilus-data (= 1:42.0-1ubuntu2) but 1:42.6-0ubuntu1 is to be installed
            Recommends: gvfs-backends
 software-properties-gtk : Depends: python3-software-properties (= 0.99.22) but 0.99.22.7 is to be installed
 ubuntu-release-upgrader-gtk : Depends: ubuntu-release-upgrader-core (= 1:22.04.10) but 1:22.04.17 is to be installed
                               Depends: python3-distupgrade (= 1:22.04.10) but 1:22.04.17 is to be installed
 update-manager : Depends: update-manager-core (= 1:22.04.9) but 1:22.04.10 is to be installed
 update-notifier : Depends: update-notifier-common (= 3.192.54) but 3.192.54.6 is to be installed

因此我尝试逐个安装特定版本的依赖项。我试过:

sudo apt update && sudo apt upgrade
sudo apt --fix-broken install
sudo apt install gir1.2-gdm-1.0=42.0-1ubuntu6
sudo apt install libgdm1=42.0-1ubuntu6
sudo apt install gvfs=1.3.2
sudo apt install libnautilus-extension1a=1:42.0-1ubuntu2
sudo apt install nautilus-data=1:42.0-1ubuntu2

并且我每次都会收到错误。例如:

Reading package lists...
Building dependency tree...
Reading state information...
E: Version '42.0-1ubuntu6
   ' for 'libgdm1' was not found

This may mean that the package is missing, has been obsoleted, or
is only available from another source

或者

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package 

Version '1.3.2
   ' for 'gvfs' was not found
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  gvfs:i386

以下是输出grep -r deb /etc/apt/sources.list

# deb cdrom:[Ubuntu 22.04.3 LTS _Jammy Jellyfish_ - Release amd64 (20230807.2)]/ jammy main restricted
deb http://ir.archive.ubuntu.com/ubuntu/ jammy main restricted
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy main restricted
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb http://ir.archive.ubuntu.com/ubuntu/ jammy universe
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy universe
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy-updates universe
deb http://ir.archive.ubuntu.com/ubuntu/ jammy multiverse
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy multiverse
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy-updates multiverse
#deb-src http://ir.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main restricted
#deb-src http://security.ubuntu.com/ubuntu jammy-security main restricted
deb http://security.ubuntu.com/ubuntu jammy-security universe
#deb-src http://security.ubuntu.com/ubuntu jammy-security universe
deb http://security.ubuntu.com/ubuntu jammy-security multiverse
#deb-src http://security.ubuntu.com/ubuntu jammy-security multiverse
# (e.g. netinst, live or single CD). The matching "deb cdrom"

以及输出grep -r deb /etc/apt/sources.list.d

/etc/apt/sources.list.d/danielrichter2007-ubuntu-grub-customizer-jammy.list.save:deb https://ppa.launchpadcontent.net/danielrichter2007/grub-customizer/ubuntu/ jammy main
/etc/apt/sources.list.d/danielrichter2007-ubuntu-grub-customizer-jammy.list.save:# deb-src https://ppa.launchpadcontent.net/danielrichter2007/grub-customizer/ubuntu/ jammy main
/etc/apt/sources.list.d/google-chrome.list.save:# deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/vscode.list.save:deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
/etc/apt/sources.list.d/danielrichter2007-ubuntu-grub-customizer-jammy.list:deb https://ppa.launchpadcontent.net/danielrichter2007/grub-customizer/ubuntu/ jammy main
/etc/apt/sources.list.d/danielrichter2007-ubuntu-grub-customizer-jammy.list:# deb-src https://ppa.launchpadcontent.net/danielrichter2007/grub-customizer/ubuntu/ jammy main
/etc/apt/sources.list.d/yannubuntu-ubuntu-boot-repair-jammy.list:deb https://ppa.launchpadcontent.net/yannubuntu/boot-repair/ubuntu/ jammy main
/etc/apt/sources.list.d/yannubuntu-ubuntu-boot-repair-jammy.list:# deb-src https://ppa.launchpadcontent.net/yannubuntu/boot-repair/ubuntu/ jammy main
/etc/apt/sources.list.d/google-chrome.list:# deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/vscode.list:deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main

我该如何解决这个问题?谢谢

答案1

我可以解决我的问题。我做的是:

打开我的消息来源:

sudo vim /etc/apt/sources.list

然后添加以下两行:

deb http://ir.archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://ir.archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse

然后更新了我的 apt:

sudo apt update

最后我可以安装桌面管理器:

sudo apt install ubuntu-desktop

我不知道包含和的那几行到底是什么jammy-updates意思,jammy-backports但它解决了我的问题。我还有其他选项,例如jammyjammy-security,但错过了上述两个条目。

如果有人能解释一下这些条目是什么以及它们是如何解决问题的,那还是很有用的。现在我又能使用桌面了。谢谢大家。

相关内容