APT - 依赖错误修复

APT - 依赖错误修复

我使用的是 Ubuntu 20.04

由于某种原因我需要重新安装 Gnome,但现在清除它后我无法重新安装它。我正进入(状态未满足的依赖关系错误。

确切的错误消息 -

sudo apt-get install ubuntu-gnome-desktop
Reading package lists... Done
Building dependency tree       
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:
 ubuntu-gnome-desktop : Depends: ubuntu-desktop but it is not going to be installed
                        Depends: gnome-session but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我尝试过的-

  1. 打扫
sudo apt autoclean

sudo apt clean

sudo apt autoremove

我的电脑已经干净了所以没有输出

  1. 使用 f 参数修复
sudo apt install -f ubuntu-gnome-desktop

sudo apt --fix broken

输出 -

sudo apt --fix-broken install

Reading package lists... Done

Building dependency tree
       
Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
  1. Dpkg 重新配置
sudo dpkg --configure -a

没有返回任何东西

  1. 使用能力
sudo aptitude install ubuntu-gnome-desktop

没用。


其他详情

  • 目前,我正在通过 xfce Desktop 进行此操作。我不喜欢它。

  • 我没有安装 GDM。

  • 我只想要 ubuntu-gnome-desktop。

  • 这个未满足的依赖关系问题仅存在于与 gnome 相关的软件包中。

  • 如果您没有任何有关 ubuntu-gnome-desktop 的解决方案,那么我也可以仅安装 gnome 桌面,但这不是首选。

  • sudo apt update 的输出 -

sudo apt update
Hit:1 http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu focal InRelease 
Hit:2 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
  • sudo apt update 的输出
sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • 我只想要 gnome 桌面

  • 已启用存储库

在此输入图像描述

答案1

对我有用的:

我只是安装了ubuntu-desktop.您可以通过以下方式安装它:

sudo apt install ubuntu-desktop^

^表示任务包

如果您更喜欢 GUI:

sudo apt install tasksel
sudo tasksel
# arrow keys to navigate and space bar to select.

选择ubuntu桌面并按回车键

其他一些可以尝试的事情:

首先,尝试更新存储库:

sudo apt update

如果这不起作用,请尝试使用强制安装:

sudo apt -f install ubuntu-desktop

您还可以尝试使用aptitude

# install aptitude
sudo apt install aptitude

# install the packages
sudo aptitude install ubuntu-desktop

## aptitude will suggest solutions to fix the error, if you find them ok then accept the solutions.

aptitude-f参数一起使用。

sudo aptitude -f install ubuntu-desktop

-f与任务包一起使用:

sudo aptitude -f install ubuntu-desktop^

尝试从缓存目录中删除错误.deb文件。apt

sudo rm /var/cache/apt/archives/*.deb

尝试清除冲突包的状态:

# create a backup first:
sudo cp -r /var/lib/dpkg/status /var/lib/dpkg/status.bak

# view the file:
view /var/lib/dpkg/status
# Now, find the information given about the error packages and try removing it.

尝试自己安装依赖项:

sudo apt install <package>

尝试安装正常版本的软件包 iegnome-session

sudo apt -f install gnome-session

请随意编辑和添加更多解决方案。

答案2

GitHub 要点

APT - 依赖错误修复

搭建舞台

一天晚上,我尝试使用这个方法APT: Package Manager——我之前已经成功地做过数千次了——然后我遇到了一个 公吨™️ 的依赖错误导致安装停止,例如 snail-crawl-parking-lot-exodus©️ 国家橄榄球联盟游戏或 仙妮亚唐恩音乐会。

反复冲刺后

相关内容